gpt4 book ai didi

php - 在 Paypal Vault 中使用存储卡时返回内部服务错误

转载 作者:太空宇宙 更新时间:2023-11-03 15:58:58 25 4
gpt4 key购买 nike

我的代码有什么问题:在保存的 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 上关注以下帖子并获得获得成功

PayPal Sandbox API endpoint returning 503 "Internal Service Error" error

PayPal Sandbox returning Internal Service Error

关于php - 在 Paypal Vault 中使用存储卡时返回内部服务错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37461436/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com