Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal Subscription IPN Next Billing Date

My web app uses PayPal monthly subscriptions. I receive IPN notifications when payments are made, users signup/cancel, etc and this all seems to work well.

One thing that appears to be missing from the IPN messages is any sort of indication about the next billing date. https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id091EB0901HT

At first I thought that since it's a monthly subscription, I can simply add a month to the previous date, but PayPal seems to have a funky way of figuring out the next payment date - it's not always 30 or 31 days or a month.

The next billing date is available from within PayPal itself, but doesn't seem to be sent along in any IPN messages.

Does anyone know of a simple way to work this out from the information that is available in the IPN messages?

like image 232
JohnB Avatar asked Jan 29 '14 10:01

JohnB


2 Answers

I recently came across this issue too. I'm not sure one can get a consistent scheme as to what a "month" of subscription means. For instance, if you sign up for your service on the 31st of March, is the next payment due on the 30th of April or on the 1st of May? You just have to pick one and communicate clearly it to your users. Its unfortunate PayPal doesn't afford us this courtesy.

In the end I decided to give the users access to the service for 32 days or 367 days, for monthly and annual subscriptions respectively. I know you may "lose" out on a day or two here and there but I think its better to allow some grace access rather than risk giving the user less time than paid for.

If all goes well, it doesn't actually matter how long you activated the account for if you also listen for the subscr_eot and subscr_payment IPNs (see https://stackoverflow.com/a/1195246/1852838). I renew the above period from the date of the next payment so that the subscription is always in sync with the PayPal payment cycle. PayPal will send you the eot IPN when the last paid period ends so you can terminate the subscription on the server side. This means it doesn't matter so much how much "grace" you decide to give them.

In terms of a providing a "paid until" I would simply provide the "grace" date as you are the one who actually decides how long this is. I would, however, recommend that you also let them know that they should make a payment by the next most conservative estimate for the next payment. This would be 30 days after the last payment or the end of the month if that falls after it.

like image 75
jeteon Avatar answered Sep 19 '22 13:09

jeteon


this might help you. to specify exactly days, do not use paypal's MONTHLY type. instead specify DAY like this:

following will charge the client each 30 days:

    ->setfrequency_interval('30')
    ->setfrequency('DAY')
like image 37
ulkas Avatar answered Sep 22 '22 13:09

ulkas