Stripe | Billing Cycle | Proration

Hey,

So I am using stripe API to charge the user. When creating a billing portal session I am trying to pass the billing_cycle_anchor=now as a parameter so when a user updates a subscription he should be charged immediately/invoice.

https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_thresholds-reset_billing_cycle_anchor

But it is not working. Also, I disabled the proration.

I tested this use case, and it works from the stripe dashboard but not the API.

Any solution?

It says it needs to be a future time. The billing cycle anchor should be Current date time +months (1):formatted as UNIX (i.e the date of the next invoice)

@georgecollier Thank you for your response. I am unable to initialize the call. Please check the following screenshots


2

Well that’s because you’re calling the billing portal session endpoint… Stripe API reference – Create a portal session – curl - that doesn’t support billing_cycle_anchor.

You can set the billing cycle anchor / proration behaviour in the Stripe dashboard then redirect customers to a portal. Alternatively, you can use the update a subscription API call detailed here: Stripe API reference – Update a subscription – curl and the billing_cycle_anchor parameter like you’ve done correctly as a parameter in your portal session API call.

Worked!

Thanks man

1 Like

I am having a similar issue - any chance you can screenshot how to use the API call to update a subscription alongside the billing portal API call in the workflow? I am using a custom billing portal, but need to be able to update the billing cycle anchor and proration date

Hey there! Would you mind sharing how you incorporated the billing cycle anchor parameter into your portal session API call?

You need to make the API call and set the anchor parameter. For further information please refer to the stripe documentation as it explains everything in detail.

I have read the Stripe documentation and scoured the forum for weeks, but it is not clear how to incorporate the ‘update customer subscription’ call that has the billing_cycle_anchor parameter with the configured portal session. I was hoping someone could screenshot their workflow setup to see how they did this. Thanks anyway.