首页 > 解决方案 > PayPal 支付请求返回 HTTP 400 响应

问题描述

我尝试通过 为不同的用户发出付款https://api.paypal.com/v1/payments/payment请求,但对于某些请求,40%,PayPal api 返回 HTTP 400 响应,其余的都很好。请求的主体类似于:

{
"intent": "sale",
"payer": {
    "payment_method": "PAYPAL",
    "funding_instruments": [
        {
            "billing": {
                "billing_agreement_id": "B-XXXXX"
            }
        }
    ]
},
"transactions": [
    {
        "amount": {
            "currency": "EUR",
            "details": {
                "subtotal": "11.99",
                "tax": "0.0",
                "shipping": "0.0",
                "handling_fee": "0.0",
                "shipping_discount": "0.0",
                "insurance": "0.0"
            },
            "total": "11.99"
        },
        "invoice_number": "pp_XXXX",
        "custom": "\"{\"payment_id\": \"6102645598795\", \"user_id\": \"28233184743\", \"cid\": \"DE:282331858548:30\"}\""
    }
],
"redirect_urls": {
    "return_url": "https://example.com/return",
    "cancel_url": "https://example.com/cancel"
}
}

并且响应类似于

{
"name": "TRANSACTION_REFUSED",
"message": "The request was refused",
"information_link": "https://developer.paypal.com/docs/api/payments/#errors",
"debug_id": "8e0a927a12",
"code": "TRANSACTION_REFUSED"
}

响应不是信息性的。任何想法?

标签: pythonpaypalhttprequest

解决方案


在联系 PayPal 支持并分享后debug_id,他们告诉我该错误与无效的资金来源有关。该问题意味着资金来源、信用卡或银行账户已被删除。


推荐阅读