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

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

问题描述

我正在尝试构建一个非常简单的以贝宝为后盾的购物车,以便用户可以购买多个商品.我希望贝宝处理所有付款细节.我什至不希望订单确认.我将手动在Paypal上检查订单确认.

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.

起初,我想使用网站付款标准",因为创建要张贴到Paypal并让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之后,您必须侦听来自paypal的请求并执行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.

有人知道跳过此确认"步骤的方法吗?我发现它是不必要的,也不知道为什么贝宝需要它.

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

推荐答案

这是因为Express Checkout和网站付款标准"是根本不同的产品.

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中指定的URL.
现在,您应该显示订单确认,并调用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时同时包括令牌和payerID.

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立即向买方收取费用,请将买方重定向到

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.

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

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