我可以向贝宝发送一个变量,并在付款完成后将其寄回给我吗? [英] Can I send a variable to paypal, and have it post it back to me when payment completes?

查看:19
本文介绍了我可以向贝宝发送一个变量,并在付款完成后将其寄回给我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用快速结账 API 在付款后将人们在我网站上的帐户转换为高级帐户.唯一的问题是它不会将用户发送回站点,直到他们单击按钮返回,并且在发生这种情况时更新他们的权限.大约 40% 的用户似乎没有这样做......所以他们的帐户在付款后永远不会被记入.

Ive been using express checkout API to convert people's accounts on my site to premium accounts after paying. The only problem with it is that it doesn't send the user back to the site until they click the button to return, and it updates their permission when that happens. About 40% of the users don't seem to do that.... so their accounts never get credited after payment.

尽管 paypal 在成功付款后会立即回传,但我始终无法让它立即真正更新用户的帐户,因为我无法让它发回某种可以识别用户身份的信息完成支付.我只能在您被发送回发送交易 ID 的站点时执行此操作,该站点是我使用回发登录的.它会搜索它,如果在数据库中找到它就授予权限.

Although paypal does an instant post-back upon the successful payment, I was never able to make it actually update the user's account right away, since I cant get it to send back some sort of informational that would identify the user that just completed the payment. I could only do that when you are sent back to the site, which sends the transaction ID, that I logged with a post-back. It searches for it, and grants permission if it was found int he DB.

有没有办法将某种变量提交给贝宝,然后它会发回给我?像 &user_id=123 这样的东西,它可以非常方便地更新用户的权限.

Is there a way to submit some sort of a variable to paypal, that it will then post back to me? Something like &user_id=123, which would make it very handly to update the user's permission.

推荐答案

是的,如果您发送 item_numberIPN 通知 将在回复给您时包含该通知.当用户开始付款过程时,我会在数据库中记录一个唯一 ID,并在将它们发送到 PayPal 时包含该 ID.当 IPN 进入时,该唯一 ID 与数据库中的记录匹配,为我提供所需的所有信息.

Yes, if you send item_number, the IPN notification will include that when it posts back to you. I record a unique ID in the database when the user starts the payment process, and include that when sending them to PayPal. When the IPN comes in, that unique ID matches up with the record in the database, giving me all the info I need.

编辑重新评论:

我希望上面链接的网站上有一个代码示例,但基本上就我而言,我使用的是我发布到 https://www.paypal.com/cgi-bin/webscr.在该表单中是 IPN 内容中记录的各种隐藏字段(cmd 用于执行什么命令,business 用于指定您的业务 ID,item_name 用于PayPal UI 中的一个很好的描述,item_number 用于我上面提到的商品编号,等等).当 IPN 回发到您的 IPN 地址时,它包括各种字段(例如 payment_status — 有点重要!&mdash 和您输入的 item_number发布给他们时).

I expect there's a code example somewhere on the site linked above, but basically in my case I'm using a form that I POST to https://www.paypal.com/cgi-bin/webscr. Within that form are various hidden fields documented in the IPN stuff (cmd for what command to perform, business to specify your business ID, item_name for a nice description in the PayPal UI, item_number for the item number I mentioned above, etc., etc.). When IPN posts back to your IPN address, it includes various fields (such as payment_status — kind of important! &mdash and the item_number you fed in when posting to them).

这篇关于我可以向贝宝发送一个变量,并在付款完成后将其寄回给我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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