Paypal + PHP:如何获得成功销售的价值 [英] Paypal + PHP: how to receive a value on success sale

查看:54
本文介绍了Paypal + PHP:如何获得成功销售的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个表单形式的 paypal 按钮.该表单有一个名为 ID 的附加输入,用户必须在其中输入特定值.

I have a paypal button on my site in a form. The form has an additional input called ID, where the user must enter a specific value.

销售完成后,Paypal 将用户返回到 domain.com/credits?done

After the sale is complete, Paypal returns the user to domain.com/credits?done

如何接收用户在/credits 中输入的原始 ID 值?完成?需要它自动修改他的数据库记录.

How can i receive the original ID value entered by the user in /credits?done ? need it to modify his database record automatically.

谢谢.

推荐答案

您可以创建一个简单的购物车系统,该系统将有一个唯一的发票来区分每笔交易.将付款数据发送到贝宝时,将此发票作为参数传递.任何其他数据都可以存储在您的数据库中,无需将其发送到贝宝,因为您可以使用发票作为唯一标识符来确定每笔交易.

You can create a simple cart system that will have a unique invoice to distinguish each transaction. Pass this invoice as parameter when sending payment data to paypal. Any other data can be just stored in your database, no need to sent it to paypal, since you can determine each transaction with the invoice as the unique identifier.

您还需要创建一个 ipn 处理程序页面,以便在用户在那里付款时从贝宝接收数据,以便您可以更新数据库中的付款状态.通过这种方式,用户在付款后不必点击返回您的站点链接,但您仍然可以更新相关数据.

You also need to create a ipn handler page to receive data from paypal when user making the payment there, so you can update the payment status in your database. With this way, the user do not have to click return to your site link after making the payment, but you can still update the related data.

为了使集成更容易,您可以考虑使用 Micah Carrick 的 Paypal IPN 课程.基本上它和paypal提供的代码是一样的,但是它被包装成一个类,所以你可以在你的页面中使用它.

To make integration easier, you can consider using Micah Carrick's Paypal IPN Class. Basically it's the same code with the one provided by paypal, but it's wrapped into a class, so you can just use it in your page.

这篇关于Paypal + PHP:如何获得成功销售的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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