简体   繁体   中英

Paypal recurring payment with update billing cycle

I am using laravel 4.2 . I am working on a project that provides video services. The requirement is to integrate the PayPal payment gateway with recurring profile .

Although I had worked on creating recurring profile a lot using PayPal classical API , I've almost achieved my goal. But I am miserably failed to know that you cannot update a billing cycle's dates in already created recurring profile .

Now I am feeling helpless.

I've a project that provides video services to the users. The basic idea is, while sign-up, user select a subscription plan and insert credit card details. As it is a monthly subscription, the payment should be auto-renewed each month.

In between, at some point if user upgrades the higher plan, then he will be charged for the difference of new subscription amount and currently active subscription amount for current month and his billing cycle must be updated from today to next month.

For example, there are three type of subscription plan as below :

Basic for $10/month, 
Economy  for $20/month and 
Premium for $30/month

If an user has subscribed for basic plan on 1st May for $10 , his billing cycle will be set from 1st May to 1st June and so on. Each month he will be charged for $10 automatically until he unsubscribes or stops recurrence of his profile.

Now, in-between on 5th May , he upgrade his plan to Economy (that provides more videos) having actual amount of $20 , he will be charged for difference = $20-$10 = $10 for current month (ie May ), his billing cycle will be set from 5th May to 5th June now and he will be charged $20 each month from 5th June automatically .

Also the user should be asked to insert the credit card details only once while subscribing 1st time, after that for any upgrade or recurrence he should not be asked to insert the credit card.

All these process should be done on my web-site only, the user should not be redirected to PayPal site.

Anyone knows how to achieve this?

Two parts to this: Paypal and billing logic.

Paypal lets users pre-authorize companies to deduct arbitrary amounts from PayPal. Blizzard and MyUS.com are two examples of this. Users authorize a $0.00 once-off, then the sites can use that same authorization to charge any amount - look into using that instead. I'm not sure what the feature is called off the top of my head.

EDIT: It's called Billing Agreements (/Reference Transactions).

In terms of billing logic, when you upgrade a user mid-cycle, don't change the cycle dates. If they signed up on the 1st of January, keep billing them on the first of every month. Instead, if a user upgrades, do this:

  1. Update the billing profile on your site to charge the higher amount on the next payment cycle
  2. Charge the user a pro-rated amount immediately to cover the difference.

In your example: I sign up on 1 May 2015 for the $10/month service. On 5 May, 4 days into my subscription, I decide to upgrade to $20/month. So now you do those 2 things. Set my profile to deduct $20 on 1 June 2015, then calculate the pro-rated amount for the upgrade:

There are 26 days left in this billing cycle, which represents 83.8% of the cycle. Charge me $8.38 ($10 diff * 0.838) right now to get the full benefit of the next pricing tier. If I upgraded later in the month, say on the 15th, I would be 50% into the cycle. If I upgraded on the 30th, there'd be 1 day (3.2%) left in the billing cycle and the pro-rated fee would be $0.32.

If I downgraded again on the 5th of February, the reverse would be true. Change my billing profile to charge me $10 on 1 March, then work out the pro-rated discount. I was 4 days into a 28-day cycle, so I need to be refunded for the remainder of the cycle (24 days), which is 85.7%, so I get a $8.57 credit on my account immediately, and will only be charged $1.43 on 1 March.

If I waited until 27 February to downgrade to $10/month, there would only be 3.5% of the cycle remaining, and I'd only get a $0.35 credit applied to my account.

If I downgraded again on the 5th of February, the reverse would be true. Change my billing profile to charge me $10 on 1 March, then work out the pro-rated discount. I was 4 days into a 28-day cycle, so I need to be refunded for the remainder of the cycle (24 days), which is 85.7%, so I get a $8.57 credit on my account immediately, and will only be charged $1.43 on 1 March.

If I waited until 27 February to downgrade to $10/month, there would only be 3.5% of the cycle remaining, and I'd only get a $0.35 credit applied to my account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM