我在成功的 android paypal 付款后得到响应。回应如下。
{
"response": {
"state": "approved",
"id": "PAY-6PU626847B294842SKPEWXHY",
"create_time": "2014-07-18T18:46:55Z",
"intent": "sale"
},
"client": {
"platform": "Android",
"paypal_sdk_version": "2.11.0",
"product_name": "PayPal-Android-SDK",
"environment": "mock"
},
"response_type": "payment"
}
{
"short_description": "Pay List Payment",
"amount": "100",
"intent": "sale",
"currency_code": "USD"
}
然后我使用PAY-6PU626847B294842SKPEWXHY
支付密钥并使用 PHP curl GET 请求和以下代码获取交易详细信息。
$accessToken='<Access Token>';
$curl = curl_init("https://api.sandbox.paypal.com/v1/payments/payment/PAY-6PU626847B294842SKPEWXHY");
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $accessToken,
'Accept: application/json',
'Content-Type: application/json'
));
$response = curl_exec($curl);
print_r($response);
exit;
点击这个后,我得到以下响应,没有得到交易细节。
{"name":"INVALID_RESOURCE_ID","message":"The requested resource ID was not found","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID","debug_id":"ddc1e3a55f10e"}
任何人都有想法提前谢谢。