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