简体   繁体   English

贝宝订阅按钮:付款通知

[英]paypal Subscription button : payment notification

I have two payment methods one is through subscription and another one is single payment. 我有两种付款方式,一种是通过订阅,另一种是单次付款。

for single payment: I receive the message payment_status 'completed' to return url then I do the database update. 单次付款:我收到消息payment_status'completed'以返回url,然后进行数据库更新。

for subscription : I receive the message txn_type subscr_signup.to return url not subscr_payment. 订阅:我收到消息txn_type subscr_signup。返回url而不是subscr_payment。 But I need to immediately tell give the product to the user. 但是我需要立即告诉将产品提供给用户。

How to know in the success page itself the payment is collected by paypal... for subscription 如何知道成功页面本身中的付款是由贝宝收取的...

In short I want to know the payment status. 简而言之,我想知道付款状态。

please help me 请帮我

for single payment: I receive the message payment_status 'completed' to return url then I do the database update. 单次付款:我收到消息payment_status'completed'以返回url,然后进行数据库更新。

That's where I feel you are doing it wrong. 那是我觉得您做错了地方。 You are relying on the buyer to go back to your webpage (in order to do the database update) by clicking on the link at the end of the checkout or by Paypal automatically redirecting to your webpage. 您可以通过单击结帐末尾的链接或Paypal自动重定向到您的网站来依靠买家返回到您的网页(以便进行数据库更新)。 What's the problem with that? 这是什么问题? If the buyer doesn't click the link or wait for the redirect, then they do not go back to the webpage and therefore no database update gets made. 如果买家没有单击链接或等待重定向,则他们不会返回该网页,因此不会进行数据库更新。

So how can I get the payment information? 那么我如何获得付款信息? There is a better (but not 100% reliable) way to do this and that is by using IPN . 有一种更好的方法(但不是100%可靠)来做到这一点,那就是使用IPN With both payment methods, you can add a notify_url variable. 使用这两种付款方式,您都可以添加notify_url变量。 This is the URL of a listener script to which Paypal will post information about the transaction that is made. 这是贝宝(Paypal)将向其发布有关所进行的交易的信息的侦听器脚本的URL。 So when a buyer makes a payment, your script will be called to make the necessary database update. 因此,当买家付款时,将调用您的脚本来进行必要的数据库更新。 Just be aware the script has to do certain things in order for Paypal to send you the information. 请注意,脚本必须执行某些操作才能使Paypal向您发送信息。 I have used this implementation in the past and it has worked for the most part. 我过去曾使用过此实现 ,并且在大多数情况下都有效。

How to know in the success page itself the payment is collected by paypal... for subscription 如何知道成功页面本身中的付款是由贝宝收取的...

Above might not answer your original question. 以上可能无法回答您的原始问题。 From looking at their documentation , you might be able to use return and cancel_return variables in both methods to determine whether the payment was complete or not, respectively. 通过查看他们的文档 ,您也许可以在这两种方法中分别使用returncancel_return变量来确定付款是否完成。

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

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