weixin_39943202 2020-11-30 16:04
浏览 0

response code 401 when retrieve payment details

i wastrying to retrieve a payment details by payment id received from a created transaction but i got the following response: Got Http response code 401 when accessing https://api.sandbox.paypal.com/v1/payments/payment/PAY-xxxxxxxxxxxxxxxxxxxxxxxxxxx.

Here are my code:


    $this->apiContext = new \PayPal\Rest\ApiContext(
            new \PayPal\Auth\OAuthTokenCredential(
            'xxxxxxxx', // ClientID
            'xxxxxxxx'      // ClientSecret
            )
    );
    $tokenInfo = new OpenIdTokeninfo();
    $tokenInfo = $tokenInfo->createFromRefreshToken(array('refresh_token' => $refreshToken), $this->apiContext);
    $cred = "Bearer " . $tokenInfo->getAccessToken();
    $this->apiContext->addRequestHeader("Authorization", $cred);
    $payment = Payment::get($paymentId, $this->apiContext);

is there anything wrong with my codes?

该提问来源于开源项目:paypal/PayPal-PHP-SDK

  • 写回答

0条回答 默认 最新

    报告相同问题?