Stripe subscribtion upgrade - php

I have 1 basic yearly subscription and 1 premium yearly subscription, when user wanted to upgrade from basic to premium, it will be free upgrade to premium for the remaining time of the basic plan, but I want to collect the premium subscription fee in advance for the next year.
so after the user completes the payment the remaining time of the premium subscription is the remaining time of the basic plan + 1-year premium subscription
Any idea how could I achieve this using stripe API?
here is the related document link
https://stripe.com/docs/api/subscriptions/update
Expecting to allow user to upgrade to a premium subscription for free in the remaining time of the basic subscription, but collect the premium subscription fee in advance for next year.

If I understand correctly, you want to break the timeline in 3 sections:
(a) 1st year on basic (e.g. 1 Jan - 31 June 2022).
(b) 1st year after upgrade to premium (e.g. 1 Jul - 31 Dec 2022).
(c) 2nd year on premium (e.g. 1 Jan - 31 Dec 2023).
Price for (a) and (b) is basic, for (c) is premium. Service in (a) is basic, in (b) and (c) is premium. The payment for the 2nd year is done between (a) and (b), e.g. on June 31. Please, correct me if I’m wrong.
One way of doing it is to have 3 different prices:
Basic subscription for basic price e.g. $10.
Premium subscription for basic price e.g. $10.
Premium subscription for premium price e.g. $30.
When the customer upgrades, you perform 3 steps one after another:
Create a standalone Invoice and charge the customer once for the 1 year of Price #3, e.g. $30. You can’t charge the customer for the upcoming invoice of the new subscription, however you can add a discount in the step 3.
Update the existing subscription to Price #2 - the customer gets premium service for a basic price e.g. $10. Set cancel_at_period_end: true.
Create a new subscription schedule, with Price #3 - $30, and set the start_date after the old subscription ends. Add a one-time 100% discount to the subscription for the first year (because the customer paid for it in step 1).
I know it is a bit convoluted, as this is quite an uncommon scenario, but I managed to get it working on my end. You can use the Stripe Test Clock to make the testing easier.

Related

Recurring Paypal payment with dynamic amount in Standard paypal method

I have one simple PayPal Standard HTML form with 3 textbox and one button .
textbox 1 : <Amount pay now>
textbox 2 : <Out standing Amount pay on specific date>
textbox 3 : <recurring payment date>
Now when user clicks on a button, it redirects to PayPal for payment process as I have used PayPal standard method.
I want the amount to be processed from textbox1 and another amount should process automatically on a specific date.
Can someone please help out me to achieve this ?
srt - Recurring times
src - 1 //Subscription payments recur.
sra - 1. Reattempt failed recurring payments before canceling.
a3 - Regular subscription price.
p3 - Subscription duration. Specify an integer value
t3 - Regular subscription units of duration.
Valid range for p3 is 1 to 90 in D. similarly M, etc
business - your business email
item_name - order id / descripiton of item sold
currency_code - USD / INR
This is the reference URL
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#recurring-payment-variables
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/html_example_subscribe/#product-options-as-text-boxes
Ex. This sample HTML code illustrates a basic Subscribe button with these features:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/html_example_subscribe/#basic-subscribe-button
No trial periods. A subscription price of $5.00 USD. A monthly
billing cycle. The subscription ends only when the merchant or
subscriber cancels it.
This isn't a simple bit of programming.
Why don't you use a third party like Stripe to handle this for you? It's built in and will be a lot easier for you to setup and you could focus on creating a decent custom dashboard where you could pull via the API of Stripe customer information and opportunity to change/cancel their subscription?

Recurring payment with stripe with varying amount

I am working on a project where the subscriber can limit his subscription on monthly basis.
As an example below
Lets say i have 5 products A - Euro 40 ,B - Euro 40, C - Euro 40, D- Euro 40,E - Euro 40
Month 1 - A + B + C + D -> First order. I am using stripe ideal to generate the payment for 4 products. Total Euro 160
Month 2 - Subscriber cancels product D subscription. So now the recursive payment must work only for the price of A+B+C. So now the total comes Euro 120
Month 3 - Subscriber cancels product C subscription. So now the recursive payment must work only for the price of A+B. So now the total comes Euro 80
Month 4 - Subscriber cancels product A + B subscription. So the subscription should be cancelled.
Work done till now:
The stripe ideal is only one time payment. In this case, i can use SEPA but will get the update 14-16 working days.
https://stripe.com/docs/sources/ideal/recurring
I am using wordpress and initiating the ideal payment programatically (not using plugin) using Stripe PHP library.
What is the alternative i can go for iDEAL?
Is it possible, if i collect the card details of the customer and charge the card on recurring basis without user authorization.
Hope i made my question clear.
I'm admittedly not particularly learned in this world, but Stripe does have some guidance here:
https://stripe.com/docs/sources/ideal/recurring
Basically, you have to turn it into a SEPA Direct Debit source, then every month inform your customer of what they're going to owe. Hopefully that's helpful!

How to build a monthly subscription with Stripe?

I am working with Stripe subscription and I don't want to create different plans with xy users included but set the price simple to 10$ per user per month. See the pricing at https://www.box.com/en_GB/pricing/ to get an idea what I mean.
How can i realize that subscription behavior in Stripe? Do I need to create an own plan for every count of users? (eg. oneuserplan 10$, twouserplan 20$, threeuserplan 30$,.....)
Or can I somehow multiply the 10$/month base subscription with with the count of users?
You can find a quantity field in stripe documentation
The quantity you'd like to apply to the subscription you're creating.
For example, if your plan is $10/user/month, and your customer has 5
users, you could pass 5 as the quantity to have the customer charged
$50 (5 x $10) monthly....

Paypal NVP API Recurring Profile Upgrade Profile Charge surplus amount at a time and Next Billing Cycle

I tried using simple CreateRecurringProfile and UpdateRecurringPaymentsProfile of Paypal NVP apis.
I have confusion If i can achieve my goal or not Please suggest me the solutions
Case 1:
Silver Package = $20
Gold Package = $100
My Custome created Recurring Payment with Billing Cycle of $20 Per month for 6 months on Jan 1st For silver Subscription Plan.
Later on Customer come back on Feb 2nd and updates his subscription package from silver to gold subscription at that time i want to update to subscription plan as All next billing cycle will charge to $100 from $20 but when he upgrades he/she must be charges $80 (i.e sur plus amount) because remaining $20 is paid on Feb 1st's Bill.
Thanks in Advance
Please suggest me some solutions.
In such a case, You can cancel Recurring payment Profile, And create new Profile for $100 as Recurring amount And $80 as Initial Amount ( INITAMT as given in documentation of CreateRecurringPaymentsProfile)

Calculate new subscription cost on upgrade / downgrade

I am currently developing a subscription system for a web application.
I need help regarding the approach for new subscription costs when a user decides to downgrade or upgrade their account.
I created a image to make an example of a user that keeps changing levels.
A user can choose to pay each month, quarter or year.
I want to add a discount when the user decides to downgrade. The discount is currently factored into the new cost using this formula:
[final plan cost] = [new plan cost] * 12 - [discount] / [12 - month / 3 - quarter / 1 - year]
If we have a user that keeps changing plans like this, how can I calculate the discount dynamically? It's easy for one change - I can take the difference between the two plans and multiply it for each payment that was made before. But I need some help regarding the approach for several changes, and how I can keep track of the discount.
I think you should put all that information in a database table and just call the cells. If the user it at the plan where they are getting the discount based on the sub; then
eg
if(price is this)
discount is {discount value from the database} x price of subscription..
You will not have to worry if someone changes their subscription in the middle of the month, all you have to do is put that information in a different table and at the end of the month all the application would do is apply the new subscription and do the calculations. It is not hard just the approach..

Categories