我正在尝试使用 PayPal REST API 而不是 PayPal Classic API,但似乎 REST API 缺少 Classic API 所具有的两个功能:
- 立即付款:当用户转到 PayPal 页面时,向他显示“立即付款”按钮而不是“继续”按钮和“您快完成了。您将在...确认您的付款”短语。
- 没有送货地址:避免在 PayPal 页面上要求用户确认他的送货地址(如果我没记错的话,在经典 API 中使用 NOSHIPPING=1 参数完成)
所以我的问题是:是否可以在不使用 REST API 询问送货地址的情况下立即付款?我必须回到经典 API 吗?
我在此处提供了有关如何使用 PayPal REST API 的更多信息。我正在使用 PayPal REST Java SDK。这是一个示例请求:
{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"currency": "USD",
"total": "5",
"details": {
"subtotal": "5"
}
},
"description": "This is the payment transaction description.",
"item_list": {
"items": [
{
"quantity": "1",
"name": "Item 1",
"price": "5",
"currency": "USD"
}
]
}
}
],
"redirect_urls": {
"return_url": "http://XXX/handlePayment.jsp?guid\u003dXXX",
"cancel_url": "http://XXX/cancelPayment.jsp?guid\u003dXXX"
}
}
及其回应:
{
"id": "XXX",
"create_time": "2014-06-29T08:52:55Z",
"update_time": "2014-06-29T08:52:55Z",
"state": "created",
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"shipping_address": {}
}
},
"transactions": [
{
"amount": {
"total": "5.00",
"currency": "USD",
"details": {
"subtotal": "5.00"
}
},
"description": "This is the payment transaction description.",
"item_list": {
"items": [
{
"name": "Item 1",
"price": "5.00",
"currency": "USD",
"quantity": "1"
}
]
}
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/XXX",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=XXX",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/XXX/execute",
"rel": "execute",
"method": "POST"
}
]
}