为什么 Paypal 需要 DoExpressCheckoutPayment? [英] Why is DoExpressCheckoutPayment required for Paypal?

查看:22
本文介绍了为什么 Paypal 需要 DoExpressCheckoutPayment?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个非常简单的由贝宝支持的购物车,以便用户可以购买多件商品.我想让贝宝处理所有的付款细节.我什至不想要订单确认.我会在贝宝上手动检查订单确认.

I am trying to build a very simple paypal-backed shopping cart so users can purchase multiple items. I want paypal to handle all the payment details. I don't even want an order confirmation. I will manually check for order confirmation on paypal.

起初我想使用网站支付标准",因为创建一个表单来发布到贝宝并让贝宝从那里处理它似乎很容易.但是不,这不起作用,因为网站付款标准"按钮/表单不支持提交多个项目.我在表单中尝试了各种键/值,但都没有奏效.

At first I wanted to use "Website Payments Standard" because it seemed easy to create a form that will post to paypal and let paypal handle it from there. But no, this did not work because the "Website Payments Standard" buttons/form do not support submitting multiple items. I tried all sorts of key/value in my form, and it never worked.

然后我尝试使用找到的说明进行快速结账这里.它在很大程度上有效,但据我所知,在发送 SetExpressCheckout 后,您必须听取来自贝宝的请求并执行 DoExpressCheckoutPayment 以完成交易.SO 参考.

Then I tried Express Checkout using the instructions found here. It largely worked, but as I understand it, after sending a SetExpressCheckout, you have to listen for a request from paypal and do a DoExpressCheckoutPayment to complete the transaction. SO reference.

我觉得这有点麻烦,因为如果我的服务器没有收到来自 paypal 的请求并且我从不发送 DoExpressCheckoutPayment 怎么办?因此,一位客户认为他们已经完成了提交订单,但从未收到该订单.

I find this a bit troublesome, because what if my server fails to receive the request from paypal and I never send a DoExpressCheckoutPayment? So a customer THINKS they have finished submitting an order, but the order was never received.

有人知道跳过这个确认"步骤的方法吗?我觉得没有必要,也不知道为什么 paypal 需要它.

Does anyone know of a way to skip this "confirmation" step? I find it unnecessary, and not sure why paypal requires it.

推荐答案

那是因为 Express Checkout 和 Website Payments Standard 是根本不同的产品.

That's because Express Checkout and Website Payments Standard are fundamentally different products.

要使用 Express Checkout,您需要调用 SetExpressCheckout API.在 API 调用中,您指定产品的详细信息、金额和 RETURNURL.
将此数据发布到 PayPal 的 API 端点后,您会收到一个令牌作为回报.然后,您将重定向买家,并将令牌附加到以下 URL:https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX

To use Express Checkout, you would call the SetExpressCheckout API. In the API call, you specify the details of the products, amounts, and the RETURNURL.
Once you post this data to PayPal's API endpoint, you receive a token in return. You would then redirect the buyer, and append the token to the following URL: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX

一旦买家同意您的购买,他就会被重定向回您在 RETURNURL 中指定的网址.
您现在应该显示订单确认信息,并调用 GetExpressCheckoutDetails API**.
调用 GetExpressCheckoutDetails 时,提供令牌.在 GetExpressCheckoutDetails API 响应中,您将找到一个 PayerID.

Once the buyer has agreed to your purchase, he is redirected back to the URL you specified in the RETURNURL.
You should now show the order confirmation, and call the GetExpressCheckoutDetails API**.
When calling GetExpressCheckoutDetails, supply the token. In the GetExpressCheckoutDetails API response you'll find a PayerID.

现在您可以调用 DoExpressCheckoutPayment 并向买家收费.请记住在调用 DoExpressCheckoutPayment 时包括令牌和付款人 ID.

Now you're ready to call DoExpressCheckoutPayment, and charge the buyer. Remember to include both the token and the payerID when calling DoExpressCheckoutPayment.

注意:如果您想立即通过调用 GetExpressCheckoutDetails 和 DoExpressCheckoutPayment 向买家收费,请将买家重定向到 https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX&useraction=commit.useraction=commit 会将 PayPal查看您的付款"页面上的继续"按钮更改为立即付款"按钮.

Note: If you want to charge the buyer immediately by calling GetExpressCheckoutDetails and DoExpressCheckoutPayment immediately, redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX&useraction=commit. The useraction=commit will change the "Continue" button on the PayPal 'Review your payment' page to a "Pay now" button.

--

快速结账"和网站支付标准"之间存在如此显着差异的原因在于,网站支付标准"旨在成为一种由 PayPal 处理整个交易流程的插入式工作解决方案.Express Checkout 是一种更灵活的解决方案,允许您将其与网站/购物车的现有结账流程深度集成.

The reason there's such a significant difference between Express Checkout and Website Payments Standard, is that Website Payments Standard is intended to be a drop-in working solution where PayPal handles the whole transaction flow. Express Checkout is a more flexible solution which allows you to integrate it deeply with an existing checkout flow of a website / shopping cart.

对于您的用例;使用 PayPal 的购物车上传"按钮查看.有关示例,请参见 https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_cart_upload

For your use case; lookat using PayPal 'cart upload' buttons. See for an example https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_cart_upload

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="seller@designerfotos.com">
<input type="hidden" name="item_name_1" value="Item Name 1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item Name 2">
<input type="hidden" name="amount_2" value="2.00">
<input type="submit" value="PayPal">
</form> 

但是请注意,默认情况下这是不安全的,因为您要收取的金额将在 HTML 中清晰可见.

Note however, that this is insecure by default, as the amounts you're going to charge will be plainly visible in the HTML.

** PayerID 也附加在您的 RETURNURL 的 GET 中.因此,如果您愿意,可以跳过调用 GetExpressCheckoutDetails.

** The PayerID is appended in the GET of your RETURNURL as well. So you could skip calling GetExpressCheckoutDetails if you wanted to.

这篇关于为什么 Paypal 需要 DoExpressCheckoutPayment?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆