PayPal-美国和加拿大地址错误400
我将在结帐时向PayPal发送此请求:PayPal-美国和加拿大地址错误400,paypal,Paypal,我将在结帐时向PayPal发送此请求: Request >>>> { "intent": "authorize", "payer": { "payment_method": "paypal" }, "transactions": [ { "amount": { "total": "2386.81", "currency": "GBP", "details": {
Request >>>> {
"intent": "authorize",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"total": "2386.81",
"currency": "GBP",
"details": {
"subtotal": "1854.81",
"shipping": "532.00",
"tax": "0.00"
}
},
"item_list": {
"shipping_address": {
"recipient_name": "Johnny",
"type": "business",
"line1": "245",
"line2": "5th Avenue ",
"city": "Columbia -",
"country_code": "US",
"postal_code": "MO 65201",
"phone": "001 212 12345678"
}
},
"description": "907 items"
}
],
"redirect_urls": {
"return_url": "http://localhost:3000/payment/paypal-approved",
"cancel_url": "http://localhost:3000/payment/paypal-cancelled"
}
}
但我得到了以下错误:
{
"cause": {
"response": {
"name": "UNKNOWN_ERROR",
"message": "An unknown error has occurred",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNKNOWN_ERROR",
"debug_id": "b005dc4a36cc6",
"httpStatusCode": 400
},
"httpStatusCode": 400
},
"isOperational": true,
"response": {
"name": "UNKNOWN_ERROR",
"message": "An unknown error has occurred",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNKNOWN_ERROR",
"debug_id": "b005dc4a36cc6",
"httpStatusCode": 400
},
"httpStatusCode": 400
}
如果我将地址更改为除加拿大以外的任何其他国家,则请求有效
查看文档,只需要第1行、城市和国家代码
对于美国和加拿大,我是否遗漏了任何具体信息?您的请求中似乎遗漏了state字段。由于加拿大和美国有州字段,您需要通过它。 API请求:
{
"intent": "authorize",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"total": "2386.81",
"currency": "GBP",
"details": {
"subtotal": "1854.81",
"shipping": "532.00",
"tax": "0.00"
}
},
"item_list": {
"shipping_address": {
"recipient_name": "Johnny",
"type": "business",
"line1": "245",
"line2": "5th Avenue ",
"city": "Columbia",
"country_code": "US",
"state": "MO",
"postal_code": "65201",
"phone": "001 212 12345678"
}
},
"description": "907 items"
}
],
"redirect_urls": {
"return_url": "http://localhost:3000/payment/paypal-approved",
"cancel_url": "http://localhost:3000/payment/paypal-cancelled"
}
}
API响应:
{
"id": "PAY-4NK43903V190842KVLY5JA",
"create_time": "2015-05-16T18:38:28Z",
"update_time": "2015-05-16T18:38:28Z",
"state": "created",
"intent": "authorize",
"payer": {
"payment_method": "paypal",
"payer_info": {
"shipping_address": {}
}
},
"transactions": [
{
"amount": {
"total": "2386.81",
"currency": "GBP",
"details": {
"subtotal": "1854.81",
"shipping": "532.00"
}
},
"description": "907 items",
"item_list": {
"shipping_address": {
"recipient_name": "Johnny",
"line1": "245",
"line2": "5th Avenue ",
"city": "Columbia",
"state": "MO",
"phone": "001 212 12345678",
"postal_code": "65201",
"country_code": "US"
}
},
"related_resources": []
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-4NK43903V1908425XKVLY5JA",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-9XM291481W9678205",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-4NK43903V1908425XKVLY5JA/execute",
"rel": "execute",
"method": "POST"
}
]
}
但是fromstate
对象不是必填字段