简体   繁体   English

收到PayPal付款后如何执行代码?

[英]How can I execute code after receiving a paypal payment?

I have finished designing a program, and am ready to create a commerce system. 我已经完成了一个程序的设计,并准备创建一个商务系统。 Ideally, I would like to use Paypal to handle all the transactions for me, how ever I want this to be done on my own website, and have the information securely sent over to Paypal. 理想情况下,我想使用Paypal为我处理所有交易,我希望在我自己的网站上完成这些交易,并将信息安全地发送到Paypal。 I understand how to do this entire process, how ever I do not understand where I would add code to have my server generate a serial code and store it alongside customer information in a database. 我理解如何完成整个过程,我怎么不明白我在哪里添加代码让我的服务器生成一个串行代码并将它与客户信息一起存储在数据库中。

The Paypal API isn't very helpful, so I am wondering if there is a variable passed back to the merchant website by PayPal, via a POST or similar, that can be checked to verify that a payment was accepted, and then react depending upon that status. Paypal API不是很有用,所以我想知道是否有一个变量通过PayPal通过POST或类似方式传回商家网站,可以检查以验证付款被接受,然后根据具体情况做出反应那个地位。

I understand that I can have it send the user back to the merchant website, but I would like it to generate a page along the lines of... 我知道我可以让它将用户发送回商家网站,但我希望它能够生成一个页面...

Thank you for your purchase (NAME)! 感谢您的购买(NAME)! A copy of your serial for (LICENSE_COUNT) licenses has been sent to your e-mail at (EMAIL). 您的(LICENSE_COUNT)许可证序列副本已通过(EMAIL)发送到您的电子邮箱。

And then have a script run to automatically generate the serial, send it to the user, and save it in a database. 然后运行脚本以自动生成序列,将其发送给用户,并将其保存在数据库中。

Any language is acceptable. 任何语言都可以接受。

Are you working with Payments Standard or Express Checkout ? 您是使用Payments Standard还是Express Checkout

If you're using Payments Standard you would need to use PDT + Auto-Return to get data back to your page for display. 如果您使用的是Payments Standard,则需要使用PDT +自动返回功能将数据恢复到您的页面以供显示。 That said, I wouldn't rely on it to deliver the necessary details to your user because they're not always guaranteed to make it back there even with Auto-Return enabled. 也就是说,我不会依赖它向用户提供必要的细节,因为即使启用了自动返回功能,它们也不能保证能够恢复到那里。

Instant Payment Notification (IPN) is recommend for this sort of thing. 建议使用即时付款通知(IPN)进行此类操作。 It will POST transaction data to a listener script you have on your server. 它会将事务数据POST到您服务器上的侦听器脚本。 This happens separate from the checkout system itself. 这与结账系统本身不同。 You can automate tasks like updating your database, hitting 3rd party web services, sending email notifications, etc. from within this script. 您可以在此脚本中自动执行更新数据库,访问第三方Web服务,发送电子邮件通知等任务。 It also allows you to handle e-checks correctly (only delivery the e-goods when the payment clears.) 它还允许您正确处理电子支票(仅在付款清除时交付电子货物。)

If you're using Express Checkout you can handle this within the checkout flow rather than using IPN if you want to because the user is always guaranteed to make it back to your site. 如果您使用的是Express Checkout,您可以在结帐流程中处理此问题,而不是使用IPN,因为用户始终可以保证将其恢复到您的网站。 That said, if you're accepting e-checks you'd still want to use IPN instead. 也就是说,如果您接受电子支票,您仍然希望使用IPN。 If you've disabled e-checks then this would work just fine. 如果您已禁用电子支票,那么这样就可以了。

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

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