1
有什麼問題在我的代碼:使用保存的貝寶信用卡信息庫API,但在使用保存的卡我然後得到錯誤在貝寶庫使用存儲卡時,其返回內部服務出錯
function paypalPaymentViaStoredCreditCard_post()
{
$access_token = "XXXXXXXX";
$ch = curl_init();
$data = '{
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments":[
{
"credit_card_token": {
"credit_card_id": "CARD-6F0009583J819301DK5DO5JA",
"payer_id": "BAAAA"
}
}
]
},
"transactions":[
{
"amount":{
"total":"100.00",
"currency":"USD"
},
"description": "This is the payment transaction description."
}
]
}';
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payment");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type:application/json",
"Authorization: Bearer " . $access_token,
"Content-length: " . strlen($data))
);
curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Some-Agent/1.0");
$result = curl_exec($ch);
print_r($result);die;
if (empty($result)) die("Error: No response.");
else {
$json = json_decode($result);
print_r($json);
die;
return $json;
}
curl_close($ch);
}
OUTPUT這裏
{"name":"INTERNAL_SERVICE_ERROR","information_link":"https://api.sandbox.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"b33db4a496dfc"}