我正在使用PayPal-PHP。SDK,我想得到代码错误。当我输入错误的信用卡数据时,我得到这个 JSON 作为答案:
{
"name":"CREDIT_CARD_REFUSED",
"message":"Credit card was refused",
"information_link":"https://developer.paypal.com/webapps/developer/docs/api /#CREDIT_CARD_REFUSED",
"debug_id":"63a9cf220d272"
}
或者这个:
{"name":"VALIDATION_ERROR",
"details":[
{"field":"payer.funding_instruments[0].credit_card.expire_month","issue":"Must not be blank"},
{"field":"payer.funding_instruments[0].credit_card.expire_year","issue":"Must not be blank"},
{"field":"payer.funding_instruments[0].credit_card.cvv2","issue":"Must be numeric"}],
"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"8e61a15a1bf4a"}
但是我需要错误代码。我怎样才能得到它?
谢谢
REST API
通常不会像经典 API 那样返回错误代码。没有与错误消息关联的错误代码。
它只返回带有name
debug_id
message
information_link
details
的错误对象