Search code examples
paypalpaypal-ipn

PayPal recurring payment cancelled with remaining days


I've a subscription-based membership, however I encountered the following problem:

  1. User subscribed on May 1st 2012 with a monthly indefinite payment.
  2. IPN sent to server, activating subscription
  3. User cancelled on May 3rd 2012.
  4. IPN sent to server, subscription is cancelled and server cancelled the membership.

However as the user subscribed on May 1st 2012, he still has some days left if he were to cancel before one month. Any way to solve this? Does PayPal sends any IPN for this type of issue?

One solution I thought of is doing a cronjob every night to check if the month is up.


Solution

  • When we implemented subscription services on our own website, we basically handle the events like this:

    • subscription confirmation - we mark the user's subscription on our server as "automatic renewal"
    • money received - we move the user's subscription expiry date based on the agreed term (monthly or yearly); using trial periods, this event only gets sent when the trial period finishes
    • subscription cancelation - we mark the user's subscription on our server as "manual renewal"
    • money refunded - we move the user's subscription expiry date back based on the agreed term.

    Upon user sign in, we check whether the subscription has expired (which is easy if you store that in your db).

    Basically, subscription events are separate from payment events. A subscription can be cancelled but that doesn't mean the payment gets refunded; that would be a separate event.

    Btw, payment and subscription events can come in different order (e.g. payment can come first, followed by subscription notification); it's important to cater for that.