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

Api Paypal内部服务器错误Rest批准付款,api,rest,paypal,payment,Api,Rest,Paypal,Payment,我在使用RESTAPI创建批准付款时遇到问题。 我正在使用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."} ] ,

我在使用RESTAPI创建批准付款时遇到问题。 我正在使用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支付,则需要取消并返回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"
    }
}
{
“重定向URL”:{
“返回url”:“http://”,
“取消url”:“http://”
},
“交易”:[
{
“金额”:{
“货币”:“美元”,
“总计”:“12.00”
},
“说明”:“这是付款交易说明。”
}
],
“意图”:“出售”,
“付款人”:{
“付款方式”:“贝宝”
}
}

有关指南,请参阅

Paypal经常返回内部服务器错误。这在沙箱模式中很常见。 最常见的方法是重试并获取execute

尝试:

在我的例子中,我将
内容类型
标题设置为
应用程序/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>
java.lang.NullPointerException