Stripe: set date of invoice charge in subscription model - stripe-payments

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.

Related

Billing cycle in strip subscription on every 1st of month

I am creating stripe subscription and selecting Start billing cycle on
1st of every month, now even the 1st date already passed but on stripe subscription it is still showing as Next invoice on 1 Nov and i am not able to add usage record as it throws error
Cannot create the usage record with this timestamp because timestamps must be before the subscription's current period end time.

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

Define a limit on which a stripe subscription invoice is effective or not

I've been using Stripe to start subscriptions for my clients recently and I have a specific issue.
I have a metered price for a product that's let's say 0.09€ per item (an SMS in that case) on a monthly cycle. Since you pay on Stripe for your invoices, I'd like to define an amount limit to have this invoice sent or not. For example, let's say this amount is 10€ and the the pending invoice amount at the end of the month for a user is 5€, I'd like to carry these 5€ over the next month.
I read about the billing_thresholds.amount_gte which does basically the opposite of what I need from what I understand.
Is this possible?

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

Resources