#Rohit89
1 messages ยท Page 1 of 1 (latest)
Hello ๐
We have a guide here for the usecase
https://stripe.com/docs/billing/subscriptions/backdating?dashboard-or-api=api
But it wont charge the user when we create subscriptions ?
You can choose if you want to charge the users OR not
https://stripe.com/docs/billing/subscriptions/backdating?dashboard-or-api=api#backdating-no-charge
I'd recommend reading through the doc
I read it but won't fully understand it. If user is already in our stripe account A and subscribed on 15th April.
We are going to move on 5th of May in stripe account B and create subscription in that.
Could you please help in code snippet to create subscription if we want o charge or if we dont want to charge?
Unfortunately, we can't help write the code for you ๐
Have you tried the approach mentioned in the guide in test mode to see what you're seeing? If not, I'd highly recommend backdating a subscription in test mode to see how it behaves
Earlier I got a code snippet here. No worries ๐ I mean examples
Not tried yet.
Would recommend trying in test mode!
Sure. But we want to set the subscription date in new stripe account as the current date when we subscribed and charge prorated amount, we dont want to set the subscription date when they originally subscribed in stripe account B.
The prorated amount should be 8th May to 15th and next billing cycle will be on 15th May?
Assuming that with "Current date" you mean the date users subscribed in your old account, this section of the doc shows exactly how you can do that
https://stripe.com/docs/billing/subscriptions/backdating?dashboard-or-api=api#backdating-billing-cycle
I dont want to set backdate subscription date. I want to set subscription date as new date 8th may in new stripe account.
but only want to charge prorate amount according to old stripe account subscription
subscription start date should be new date when user is added in new stripe account
Ah so you can't create a subscription today and expect API to charge a prorated ๐
It would be considered a brand new subscription fwiw.
The only way to charge the prorated amount would be to calculate the prorated amount yourself, charge it as one-off payment & start a subscription with a trial period upto the natural billing cycle day (May 15th)
Ok. To charge a prorated amount I need to use start date as backdate
Yup
Ok not possible to set subscription date as today date and charge prorate amount
correct because if you set the subscription start date as today then its pretty much a brand new subscription
OK so I have to set backdate as 15th April - start date of old stripe account.
Stripe::Subscription.create(
{
customer: '{{CUSTOMER_ID}}',
backdate_start_date: OLD subscription,
items: [{price: '{{PRICE_ID}}'}],
},
)
It will set the the billing cycle anchor to the current date. It't will charge the prorated amount ?
Have you tested this?
Not yet. I can give a try!
When you start mixing backdated start dates and billing cycle anchors I would always recommend testing it using your Test API keys just to be sure the behavior is what you expect. I do this all the time and I still need to test things myself ๐
Sure.
I thought I will get quick answer before testing, but definitely going to test
But just to be clear. Even with the backdated start date, when you create the Subscription as you show it above, it will create a billing cycle that starts today and goes for 1 month.
If you want to create a prorated charge, you will want to also set the billing cycle anchor to the next billing cycle date
So if you create it today, you want to set the billing cycle anchor to May 15th