Paypal内部服务器错误Rest批准付款



我在使用REST API创建批准付款时遇到了问题。我正在创建一个支付pyment_method = 'paypal'

 while i'm sending to paypal server my json file as 
"{"transactions":[
{"amount":{"currency":"USD","total":"12","details":{}},
"description":"This is the payment transaction description."}
]
,"links":[],
"intent":"sale","payer":{
"funding_instruments":[],"payment_method":"paypal"}
}"
this is 
result: Object
debug_id: "086b180fbe2f1"
information_link: "https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR"
message: "An internal service error has occurred"
name: "INTERNAL_SERVICE_ERROR"

Paypal经常返回内部服务器错误。这在沙盒模式中很常见。最常见的是再试一次,然后get execute。

试题:https://github.com/paypal/rest-api-sdk-nodejs/issues/1

您包含了不应该包含的元素,并且遗漏了重要的元素。如果你正在设置PayPal支付,你需要取消并返回url:

{
    "redirect_urls":{
        "return_url":"http://<return URL here>",
        "cancel_url":"http://<cancel URL here>"
    },
    "transactions":[
        {
            "amount":{
                "currency":"USD",
                "total":"12.00"
            },
            "description":"This is the payment transaction description."
        }
    ],
    "intent":"sale",
    "payer":{
        "payment_method":"paypal"
    }
}

参见接受PayPal付款获取指南

在我的情况下,我将Content-Type标头设置为application/json,并获得有意义的响应:

{"name":"MALFORMED_REQUEST","message":"Incoming JSON request does not map to API request","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"688b8ab4b2895"}

代替:

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.NullPointerException</ns1:faultstring></ns1:XMLFault>

最新更新