Stripe: add free days to a subscription - stripe-payments

Is it possible to add free days to an active subscription on Stripe?
I'd like to do it in order to create a referral program: when a user refers someone, he gets 10 free days.
I think a good way to do it would be to update the current_period_end var, but I can't find how to do it in the doc.
For example:
Bob is subscribed and will be charged on the 15th of this month
He refers Alice
He gets 10 free days on his account, and his next billing date is now on the 25th

I believe the closest you could do would be apply some sort of credit to her account, so instead of 10 free days, it's earn (33% of monthly fee) per referral.

Related

Anchor a Stripe subscription after next natural billing date

I am working on a Stripe integration for a user with some very specific rules for a yearly subscription plan on Stripe:
If the user starts the subscription between 2022-01-01 and 2022-09-30, they shall be charged the full amount immediately and next on 2023-01-01 - From then on, the charge will be yearly
If the user starts the subscription between 2022-10-01 and 2022-12-31, they shall be charged the full amount immediately and once again on 2024-01-01 - From then on, the charge will be yearly
My immediate guess is that case #1 should be possible with a combination of backdates, anchors, no-prorate and/or trial periods, although I haven't tested the specifics yet.
How can I implement case #2, when the anchor for the next charge is in more than 12 months? To my knowledge, Stripe disallows anchor dates that are further into the future than the next natural billing date (which is 12 months for a yearly subscription). It is also not possible to have a trial_end later than the anchor date.
I am using Laravel Cashier/PHP on the backend, but I doubt it comes out-of-the-box, so I am merely looking for the API options for creating the subscription in any language.
You can achieve your first scenario by setting backdate_start_date to 2022-01-01 and billing_cycle_anchor to 2023-01-01.
As you note, Stripe does not allow billing periods of longer than 12 months but there are some workarounds for it.
One option is to create a subscription with a year+ long trial but with a one time charge of the subscription's yearly fee. To do this when creating the subscription you would backdate the start date to 2022-01-01, set a trial_end and billing_cycle_anchor of 2024-01-01, and use the add_invoice_items[1] parameter to create a one time charge with the same amount as your yearly fee.
Alternatively you can create a subscription schedule[2] with a first phase that ends 2023-01-01, a trial phase that lasts a year, and then a phase with your year-long price.
[1] https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items
[2] https://stripe.com/docs/billing/subscriptions/subscription-schedules

stripe subscription from first date of the month with initial fee

I want to do stripe monthly subscription with these conditions
monthly charge 30 dollars
payment should be done first date of the month
when registration is done in the middle of the month daily rate fee should be paid at the timing registration is done
for example, user registered August 10th
20 dollars should be paid at that timing
30 us dollar subscription is done at September 1st and following first date of the month
how can I configure this?
I want to know the configuration for stripe.checkout.sessions
In general, you would achieve exactly what you seek by setting the billing cycle anchor on the 1st of the next month and allow a prorated invoice to be generated for the partial period until then:
https://stripe.com/docs/billing/subscriptions/billing-cycle#new-subscriptions
However, this option for the Subscription create API is not available via Checkout:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data
You could achieve a similar result by setting subcription_data[trial_end] to be the 1st of the next month to effectively set the billing anchor then:
https://stripe.com/docs/billing/subscriptions/billing-cycle#using-a-trial-to-change-the-billing-cycle
You'll need to calculate your own prorated amount for the first month, and then add a one-time Price in the line_items alongside the recurring Price to add the prorated amount to the first invoice only:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items

Stripe: Is it possible to bill the user immediately and change the billing cycle at the same time?

I've been trying to solve this problem for quite some time now.
For example, the user has subscribed to a monthly plan starting May 1, 2020 which will end on June 1, 2020. The user cancelled the subscription with remaining 5 unused days and switched over to another monthly plan.
I want to be able to carry over the unused day to the new subscription and add to the new billing cycle.
So the user should be charged immediately when user switched over to another monthly plan and the next billing date should be Date when the user has switched over to another plan + the 5 unused days.
I'm using node js for this one.
Thank you
Stripe doesn't bill the customer for the new period until that period actually starts. Thus there isn't a concept of paying now and actually starting the subscription five days from now.
What you can do is bill for the first period up front and then set the second period to begin on the later date (essentially extending the end of the first period, rather than delaying the start of it). The new plan's first period starts on May 26 and ends on July 1.
Update the Subscription to change the plan (whether or not you use proration is up to you). In your example, you would make this call on May 26, 2020.
Make sure the customer is charged for the new plan/period.
After payment, update the subscription to give it a trial period until the end of the "period + 5 days". In your example, you'd update the subscription with a trial period ending on July 1, 2020.

Stripe API Annual subscription

Is anyone aware of a way to enter a user into an annual subscription which is paid monthly.
Essentially the customer is agreeing to pay £300 a year spread over 12 months (so 12 payments of £25)
The customer cannot cancel before the 12 month term is over and must give 1 month notice to cancel their plan.
What would be the best way to implement this as I cannot see this as an option in their subscription API
The "Update a subscription" endpoint takes a cancel_at parameter that sets the subscription to end at a specific date/time.
If your user initiates a cancellation, update it with a cancel_at date that's the end of their one year subscription period (or the next year's, if they're under the one month notification period).

Creating a stripe subscription with a loyalty/tiered discount

I'm trying to create a subscription in stripe which depending on how long people have been subscribed the price per month goes down e.g.:
1st month 1000$
2nd,3rd,4th month 800$
5-9 months 750$
9-12 600$
< 12 500$
I looked into tiered discounts but couldn't find a relation to the single subscription price since tiered discount seems to only look at currently subscribed units, and not total volume of units since subscription started. Any advice?
You can do this by listening for upcoming invoices and then changing the Plan on the Subscription based on how long the Subscription has been active.
Another option is to use Subscription Schedules.

Resources