python - 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"
}
响应不是信息性的。任何想法?
解决方案
在联系 PayPal 支持并分享后debug_id
,他们告诉我该错误与无效的资金来源有关。该问题意味着资金来源、信用卡或银行账户已被删除。
推荐阅读
- scala - Circe Scala - 编码和解码 Map[] 和案例类
- c# - 如何使用回调函数跳出一个方法?
- sql-server - 在 openrowset 中使用存储过程会引发 login_mapping 错误
- android - 如果项目已在屏幕上显示设定的时间,则需要更新回收站视图中的项目
- vue.js - 使用 vue-test-utils 配置过滤器
- python - 如何从不同的模块访问树视图内容?
- excel - Power Query 中的条件列标题
- javascript - 在当前处理程序中访问新状态
- c++ - MFC 中的抗锯齿
- npm - npm 给 UNABLE_TO_GET_ISSUER_CERT_LOCALLY