views:

369

answers:

2

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 then 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?

A: 

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.

dar
A: 

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.

Alister Bulman
Interesting, I'm not sure what he means there by "profile IDs" though. I don't get any profile ID back from Paypal. There is a transaction ID but it doesn't start with an I- or S-.
Brian Armstrong