开发者

Paypal subscriptions IPN - problem with users subscribing multiple times

I'm using paypal subscriptions and the instant payment notification (IPN) to handle subscribers on my site.

For the most part it works well but there is one occasional problem I've encountered.

Usually if a user cancels their subscription, I wait for the "end of term" (subscr_eot) notification before disabling access to my site.

So if they prepay for the whole month, and th开发者_JAVA技巧en cancel right away, they still have access for the rest of the month (as it should be).

But some users are having this problem where they:

  1. Cancel their subscription
  2. Before the "end of term" is reached they decide to re-subscribe
  3. When the "end of term" is reached for their first subscription, my app receives the notification and fires off an email to the user with something like "your account has been disabled, if you ever want to sign up again, you can re-subscribe by clicking here".
  4. This confuses them because they are thinking...that's weird, I thought I subscribed like a week ago (and they did). So they go subscribe AGAIN. Now they have two concurrent running subscriptions to my site and I get a support email in a month or two ("wtf you billed me twice this month jerk!!")

So I haven't found a good way to fix this. I guess the best solution would be to do an additional API call when the "end of term" notification is received which asks paypal "hey did this person already re-subscribe?". If so then no need to fire off that email. But I haven't seen any way to do this API call yet.

Another solution is to disable their account immediately when they cancel (the "subscr_cancel" notification) but then I get different angry support emails "hey I prepaid for the whole month why was my account disabled already!!".

Anyone else solved this?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜