简体   繁体   English

Paypal 支付 SDK AUTHORIZATION_ERROR 在实时环境中

[英]Paypal Payout SDK AUTHORIZATION_ERROR In Live Environment

I've set up the Paypal Payout SDK With Composer.我已经使用 Composer 设置了 Paypal Payout SDK。

Paypal assured me that the Payouts-Feature is enabled for my account. Paypal 向我保证,我的账户启用了支付功能。 I've created a new Live Rest-App and used the Client-ID and the Client-Secret in the PayPalClient Class:我创建了一个新的 Live Rest-App 并在 PayPalClient Class 中使用了 Client-ID 和 Client-Secret:

<?php
namespace PaypalPayoutsSDK\Payouts;
use PaypalPayoutsSDK\Core\PayPalHttpClient;
use PaypalPayoutsSDK\Core\ProductionEnvironment;
class PayPalClient {
    public static function client() {
        return new PayPalHttpClient(self::environment());
    }
    public static function environment() {
        $clientId = getenv("CLIENT_ID") ?: "my-client-id";
        $clientSecret = getenv("CLIENT_SECRET") ?: "my-client-secret";
        return new ProductionEnvironment($clientId, $clientSecret);
    }
}
?>

Now I want to make a simple transaction.现在我想做一个简单的交易。 I've used the samples included with the PayPal Payout SDK an created a payout using the PayPalClient mentionned above:我使用了 PayPal 支付 SDK 附带的样本,并使用上面提到的 PayPalClient 创建了一个支付:

<?php
require __DIR__ . '/vendor/autoload.php';
use PaypalPayoutsSDK\Payouts\PayPalClient;
use PaypalPayoutsSDK\Payouts\PayoutsPostRequest;
$request = new PayoutsPostRequest();
$body= json_decode(
            '{
                "sender_batch_header":
                {
                  "email_subject": "SDK payouts test txn"
                },
                "items": [
                {
                  "recipient_type": "EMAIL",
                  "receiver": "myname@gmail.com",
                  "note": "Your 4$ payout",
                  "sender_item_id": "Test_txn_12",
                  "amount":
                  {
                    "currency": "USD",
                    "value": "4.00"
                  }
                }]
              }',             
            true);
$request->body = $body;
$client = PayPalClient::client();
$response = $client->execute($request);
?>

However when I execute the file I get the following errors:但是,当我执行该文件时,出现以下错误:

Fatal error: Uncaught PayPalHttp\HttpException: {"name":"AUTHORIZATION_ERROR","message":"Authorization error occurred.","debug_id":"d3c2fe720217b","information_link":"https://developer.paypal.com/docs/api/payments.payouts-batch/#errors","links":[]} in /hermes/bosnaweb27a/b1507/dom.mydomain/mydomain/payment/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php:215 Stack trace: #0 /hermes/bosnaweb27a/b1507/dom.mydomain/mydomain/payment/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php(100): PayPalHttp\HttpClient->parseResponse(Object(PayPalHttp\Curl)) #1 /hermes/bosnaweb27a/b1507/dom.mydomain/mydomain/payment/payuser.php(37): PayPalHttp\HttpClient->execute(Object(PaypalPayoutsSDK\Payouts\PayoutsPostRequest)) #2 {main} thrown in /hermes/bosnaweb27a/b1507/dom.mydomain/mydomain/payment/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php on line 215  

The error seems to occur with the HTTPClient. HTTPClient 似乎发生了该错误。 I've already provided the Technical Assistant of Paypal with the same information but he didn't seem to know anything.我已经向 Paypal 的技术助理提供了相同的信息,但他似乎什么都不知道。

What could be the problem here.这里可能是什么问题。 I'm sure the Client-ID and the Client-Secret are correct, I've already tried to do it with a new REST-APP.我确定 Client-ID 和 Client-Secret 是正确的,我已经尝试使用新的 REST-APP 来做到这一点。 Perhaps there's something wrong with my code?也许我的代码有问题? Or am I just missing something?还是我只是错过了什么?

Your PayPal account will need to be 'Verified' in order to send Payouts.您的 PayPal 帐户需要“验证”才能发送付款。 Try adding and confirming a Bank account, or contact PayPal for other possibilities.尝试添加并确认银行账户,或联系 PayPal 了解其他可能性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM