从Paypal API获取订单详细信息



我是贝宝智能按钮的新手。

我已经能够成功地进行购买,当返回我的网站时,我能够获得订单的ID。

我想验证transactionID是否是下一步的合法ID。

为此,我尝试使用PHP SDK

我已经创建了以下代码

require  'vendor/autoload.php';
$apiContext = new PayPalRestApiContext(
new PayPalAuthOAuthTokenCredential(
'sandboxclient',     
'sandboxsecret'
)
);
$payment = new PayPalApiOrder();
try {
$payment->get("8T0564921E866114V",$apiContext);
echo $payment;
}
catch (PayPalExceptionPayPalConnectionException $ex) {
echo $ex->getData();
}

然而,我收到一个错误:

{"name":"INVALID_RESOURCE_ID","message":"The requested resource ID was not found","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"cae19ebc8e1b1"}```
I tried both the Order API calls and also the Payment API calls, both ended up with the same error. How do I get this to work. Does it matter that I am using the Paypal Sandbox at the moment for this?

您可能正在使用已弃用的v1 PayPal PHP SDK。

不要用那个。应该使用v2 Checkout PHP SDK。

相关内容

最新更新