gpt4 book ai didi

Paypal REST API : how to do an immediate payment and without asking for shipping address

转载 作者:太空宇宙 更新时间:2023-11-03 15:40:02 25 4
gpt4 key购买 nike

我正在尝试使用 PayPal REST API 而不是 PayPal Classic API,但 REST API 似乎缺少 Classic API 具有的两个功能:

  1. 立即付款:当用户转到 PayPal 页面时,向他显示“立即付款”按钮而不是“继续”按钮和“您快完成了。您将在...确认您的付款”短语。<
  2. 没有送货地址:避免在 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"
}
]
}

最佳答案

在研究 REST API 时,我遇到了 this

我相信这意味着您不必像这样创建任何“配置文件”,只需将它们与付款电话一起传递...

根据要求进一步解释:)

下面是使用客户端 JS 方法传递 PayPal 体验参数以及特定付款调用以进行快速结账的示例。

        payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '1.00', currency: 'USD' }
}
]
},

experience: {
input_fields: {
no_shipping: 1
}
}
});
},

希望这对你们有足够的意义! :)

关于 Paypal REST API : how to do an immediate payment and without asking for shipping address,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24474656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com