Paypal 全额退款无效

标签 paypal

我正在尝试使用 PayPal API 发起全额退款:

$header = Array(
    "Content-Type: application/json",
    "Authorization: Bearer $token",
);

$ch = curl_init($aurl . "/v1/payments/sale/{$params['transid']}/refund");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$res = json_decode(curl_exec($ch));
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

我收到状态码 400 和这条消息:

["name"]=> string(19) "TRANSACTION_REFUSED"
["message"]=> string(23) "Request was refused.{0}" 
["information_link"]=> string(76) "https://developer.paypal.com/webapps/developer/docs/api/#TRANSACTION_REFUSED" ["debug_id"]=> string(13) "e1df77fc1910c"

部分退款使用此代码:

$header = Array(
    "Content-Type: application/json",
    "Authorization: Bearer $token",
);

$ch = curl_init($aurl . "/v1/payments/sale/{$params['transid']}/refund");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(Array("amount" => Array("total" => $_POST['amount'], "currency" => $params['currency']))));
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$res = json_decode(curl_exec($ch));
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

PayPal says ,使用空的 JSON 负载可以全额退款,但这不起作用。有人有想法吗?

最佳答案

您已经为此交易进行了部分退款。当您再次尝试为同一笔交易进行全额退款时,交易将被拒绝。

部分退款后不能做全额退款

关于 Paypal 全额退款无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38576975/

相关文章:

paypal - 在 Fancybox 弹出窗口中添加 paypal 按钮

php - Omnipay 与 PayPal 快速结账

Paypal 付款验证

php - 需要设置Braintree\Configuration::merchantId(或者需要将accessToken传给Braintree\Gateway)

python - Python 中的 PayPal 自适应支付 ConvertCurrency 请求(已弃用的 API)

javascript - PayPal 开发人员关于逗号的问题

paypal自适应支付错误: 550001 - You do not have permission to constrain funding sources

paypal - Sole 模式下 Paypal Cart 不显示金额

ruby-on-rails - Railscast 143(Paypal 安全)导致 "We were unable to decrypt the certificate id."

php - Woocommerce 订单状态 Hook 不适用于 PayPal 交易