Paypal subscriptions IPN - problem with users subscribing multiple times

妖精的绣舞 提交于 2019-12-06 11:31:49

I know this is an old thread, but I haven't seen an actual answer to this question, so if someone happens to wonder across this like I did, here's a solution.

If someone cancels their account (subscr_cancel) before their end of term (subscr_eot) I would set it up in my database to handle it. For instance, if you have a "Users" table in your database, just add a new "int" field and call it "Term." By default, this field should be set to "0." Then, inside of your IPN, set it up so that if a user cancels their subscription before the end of the term, it sets the "Term" field for that user to "1." If that user goes back and re-subscribes to your services, have the IPN update the "Term" field for that user back to "0."

Then, inside of your mailing script, just have it check the "Term" field for that user when it runs for the end of term. If it's set to "0" then don't send the email. If it's set to "1" then send the email saying, "Adios!"

As far as I know there is no paypal api to examine subscriptions if you are using website payment standard/pro buttons, which I assume you are.

I deal with this by keeping the active/cancel/resubscribe state in my database and update the state based on the IPN messages I get from paypal. I map the IPN messages to my uses with the custom field in the button, which is sent back on every IPN message.

There are also a lot of third parties which help you manage this process since paypal's api is a little weak in this area. Recurly is one I've looked at and plan to implement, and there are others out there as well.

Cite: Re: When is subscr_eot issued?

If you started accepting subscriptions after November 2009, the subscriber ID's will start 'I-' - and will not return a 'subscr_eot' at the end of their time. Paypal expect you to keep note of how long they are subscribed for and update the account to downgrade (or whatever) when that period expires, unless the customer pays again in the meantime.

JMHeap

How to prevent duplicate PayPal payments?

You would want to add a unique identifier to the "invoice" parameter; and enable "Block duplicate payments" within the 'Profile' > 'My selling tools' section on your account at www.paypal.com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!