简体   繁体   English

接受单一的贝宝付款

[英]Accepting single paypal payments

My site is coded in Python and I want to offer the ability to accept payments on my site via paypal. 我的网站使用Python编码,我希望能够通过Paypal在我的网站上接受付款。 I want to use the free paypal service (no monthly fees) to do this where the user is redirected to paypals site to login and pay. 我想使用免费的贝宝服务(不收取月费)来执行此操作,其中用户被重定向到贝宝网站进行登录和付款。 I want the workflow to work something like this: 我希望工作流像这样工作:

  • User clicks to pay via paypal 用户点击通过贝宝付款
  • User clicks "pay with paypal" button 用户单击“用贝宝付款”按钮
  • User is redirected to paypal website to login 用户被重定向到贝宝网站登录
  • After successful payment user to redirected back to my site and sees the confirmation page. 付款成功后,用户将重定向到我的网站并看到确认页面。

I understand everything apart from the bit about paypal redirecting back to my site. 除了关于贝宝重定向回我的网站的知识外,我了解所有其他信息。 How can I code it so that I can tell if paypal has been successful and only process the confirmation page on a successful payment? 我该如何编码,以便我可以告诉我贝宝是否成功,并且仅在成功付款后才处理确认页面?

NB NB

  • I will not be using recurring payments 我不会使用定期付款
  • I would rather not use a large unwieldy library for this if possible since it seems like a small task 如果可能的话,我宁愿不使用大型笨拙的库,因为这似乎是一个小任务

You could use PayPal's PDT to check to see if the transaction was valid or not. 您可以使用PayPal的PDT来检查交易是否有效。 Payment Data Transfer (PDT) is a secure method to retrieve the details about a PayPal transaction so that you can display them to your customer. 付款数据传输(PDT)是检索有关PayPal交易的详细信息的安全方法,以便您可以将其显示给客户。 It is used in combination with Website Payments Standard, so that after a customer returns to your website after paying on the PayPal site, they can instantly view a confirmation message with the details of the transaction. 它与网站付款标准结合使用,以便客户在通过PayPal网站付款后返回您的网站后,他们可以立即查看包含交易详细信息的确认消息。 PDT is not meant to be used with credit card or Express Checkout transactions. PDT不适用于信用卡或Express Checkout交易。 This page describes how PDT works and how to configure your account to use PDT. 本页介绍PDT的工作方式以及如何配置您的帐户以使用PDT。

How PDT Works When a customer pays you, PayPal sends the transaction ID of the payment to you by appending the transaction ID to a URL you specify in your account Profile. PDT的工作原理当客户付款给您时,贝宝通过将交易ID附加到您在帐户资料中指定的URL来向您发送付款的交易ID。 This information is sent via a HTTP GET as this name/value pair: 此信息通过HTTP GET作为此名称/值对发送:

tx=transactionID 

After you get the transaction ID, you post a FORM to PayPal that includes the transaction ID and your identity token, a string value that identifies your account to PayPal. 获得交易ID后,您将向PB发布一个包含交易ID和身份令牌的FORM,这是一个标识您到PayPal的帐户的字符串值。 There are instructions below that describe how to get your identity token. 下面有说明,说明了如何获取您的身份令牌。 The form looks like this: 该表格如下所示:

<form method=post action="https://www.paypal.com/cgi-bin/webscr"> 
<input type="hidden" name="cmd" value="_notify-synch"> 
<input type="hidden" name="tx" value="TransactionID"> 
<input type="hidden" name="at" value="YourIdentityToken"> 
<input type="submit" value="PDT"> 
</form> 

In PayPal's reply to your post, the first line will be SUCCESS or FAIL. 在PayPal对您的帖子的回复中,第一行是SUCCESS或FAIL。

Activating PDT To use PDT, you must activate PDT and Auto Return in your PayPal account profile. 激活PDT要使用PDT,必须在PayPal帐户资料中激活PDT和自动退货。 You must also acquire a PDT identity token, which is used in all PDT communication you send to PayPal. 您还必须获取一个PDT身份令牌,该令牌将在您发送到PayPal的所有PDT通信中使用。

Follow these steps to configure your account for PDT: 请按照以下步骤为PDT配置您的帐户:

1.Log in to your PayPal account. 1.登录到您的PayPal帐户。 2.Click the Profile subtab. 2.单击配置文件子选项卡。 3.Click Website Payment Preferences in the Seller Preferences column. 3.单击“卖家首选项”列中的“网站付款首选项”。 4.Under Auto Return for Website Payments, click the On radio button. 4.在“网站付款的自动退还”下,单击“打开”单选按钮。 5.For the Return URL, enter the URL on your site that will receive the transaction ID posted by PayPal after a customer payment. 5.对于Return URL,请在您的网站上输入URL,该URL将在客户付款后接收PayPal发布的交易ID。 6.Under Payment Data Transfer, click the On radio button. 6.在“付款数据传输”下,单击“打开”单选按钮。 7.Click Save. 7.单击保存。 8.Click Website Payment Preferences in the Seller Preferences column. 8.单击“卖家首选项”列中的“网站付款首选项”。 9.Scroll down to the Payment Data Transfer section of the page to view your PDT identity token. 9.向下滚动到页面的“付款数据传输”部分,以查看您的PDT身份令牌。

The links below will also help you: 以下链接也将为您提供帮助:

PDT varaibles that can be returned 可以退回的PDT变量

Description of PDT PDT的描述

Sample Code 样例代码

PDT Troubleshooting Tips PDT故障排除技巧

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

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