使用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"
答案 0 :(得分:1)
Paypal经常返回内部服务器错误。这在沙箱模式中很常见。 最常见的是再次尝试并执行。
答案 1 :(得分:0)
您要包含不应该存在的元素,并且缺少重要的元素。如果您要设置PayPal付款,则需要取消并返回网址:
{
"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"
}
}
有关指南,请参阅Accepting a PayPal Payment
答案 2 :(得分:0)
在我的情况下,我将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>