[英]when using stored card in Paypal Vault it return INTERNAL SERVICE ERROR
我的代码有什么问题:在保存的 paypal 信用卡信息中使用 Vault 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);
}
在这里输出
{"name":"INTERNAL_SERVICE_ERROR","information_link":"https://api.sandbox.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"b33db4a496dfc"}
由于我没有从任何人那里得到任何解决方案,所以我一步一步地研究了我的代码并找到了解决方案。我的代码中没有错误,只有信用卡没有和负面测试问题。我按照 stackoverflow 上的以下帖子进行操作并获得成功
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.