Stripe API Annual subscription - stripe-payments

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).

Related

Stripe: set date of invoice charge in subscription model

Hi I have subscription
I created checkout session with mode=subscription and price model id
then redirect client to stripe checkout url for pay
then I have web hook and I wait for invoice.payment_succeeded
After first invoice is pay, I need set date of charge next invoice.
For example I have 1 month plan, after first pay I need change date of next invoice 3 days before end of month.
How can I do it?
Thx.
I recommend using the billing_cycle_anchor parameter of the Subscription object. To align with your current flow, you'd want to update the subscription 3 days before the end of the month, passing billing_cycle_anchor: "now" as your parameter.
Additional billing cycle options can be found here.

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

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.

Stripe: add free days to a subscription

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.

Resources