简体   繁体   English

如何将PayPal经典付款表单转换为PayPal REST API PHP应用程序?

[英]How to transform PayPal Classic Payment form into PayPal REST API PHP Application?

The following is the simplest PayPal interface form: 以下是最简单的PayPal界面形式:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" /> 
  <input type="hidden" name="cmd" value="_xclick" /> 
  <input type="hidden" name="business" value="JohnDoe2@example.com" /> 
  <input type="hidden" name="item_name" value="Purchase at the Virtual Store" /> 
  <input type="hidden" name="item_number" value="Organic-001" />
  <input type="hidden" name="amount" value="17.4" /> 
  <input type="hidden" name="currency_code" value="EUR" /> 
  <input type="hidden" name="notify_url" value="http://www.example.com/paypalnotify.php" /> 
  <input type="submit" name="submit" value="Pay now By PayPal" />
</form>

This form is specific to a PayPal premier business account and a given amount to pay, with following key parameters: 该表格特定于PayPal高级企业帐户和给定的付款金额,并具有以下关键参数:

  1. business=JohnDoe2@example.com. business=JohnDoe2@example.com。
  2. amount=17.4EUR. 金额= 17.4EUR。
  3. currency_code=EUR or USD. currency_code = EUR或USD。
  4. notify_url as the callback for PayPal.com as it ends. notify_url作为PayPal.com结束时的回调。

By clicking on the [submit] button, it perfoms this: 通过单击[提交]按钮,可以执行以下操作:

  1. It redirects the customer to the paypal.com site. 它将客户重定向到paypal.com网站。
  2. The user will login into her/his PayPal account, and validate the payment. 用户将登录到他/他的PayPal帐户,并验证付款。
  3. The PayPal site will call the paypalnotify.php like a callback, passes information indicating if the payment has suceeded, cancelled, or not valid... PayPal网站将像回调一样调用paypalnotify.php,传递指示付款是否成功,取消或无效的信息。

Now in the new interface using PalPal REST API, using PHP development kit , how one has to proceed to accomplish the payment ? 现在,在使用PalPal REST API的新界面和PHP开发工具包中 ,如何进行付款?

There are a few options. 有一些选择。 Start by looking at the code in these files: 首先查看这些文件中的代码:

https://github.com/paypal/rest-api-sdk-php/blob/master/sample/payments/CreatePayment.php https://github.com/paypal/rest-api-sdk-php/blob/master/sample/payments/CreatePaymentUsingPayPal.php https://github.com/paypal/rest-api-sdk-php/blob/master/sample/payments/CreatePayment.php https://github.com/paypal/rest-api-sdk-php/blob/master /sample/payments/CreatePaymentUsingPayPal.php

Obviously they don't have any interactive forms, but they show the general process. 显然,它们没有任何交互形式,但是它们显示了一般过程。 Dig in and work through creating your code. 深入研究并创建代码。 Then when you hit problems, open a new question with the specific issues. 然后,当您遇到问题时,请针对具体问题打开一个新问题。 StackOverflow is not for "how do I" type questions. StackOverflow不适用于“我如何”类型的问题。 https://stackoverflow.com/help/on-topic https://stackoverflow.com/help/on-topic

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM