#Rohit89

1 messages ยท Page 1 of 1 (latest)

lean haloBOT
fringe marsh
humble arrow
#

But it wont charge the user when we create subscriptions ?

fringe marsh
#

I'd recommend reading through the doc

humble arrow
#

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?

fringe marsh
#

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

humble arrow
#

Earlier I got a code snippet here. No worries ๐Ÿ™‚ I mean examples

Not tried yet.

fringe marsh
#

Would recommend trying in test mode!

humble arrow
#

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?

fringe marsh
humble arrow
#

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

fringe marsh
#

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)

lean haloBOT
humble arrow
#

Ok. To charge a prorated amount I need to use start date as backdate

fringe marsh
#

Yup

humble arrow
#

Ok not possible to set subscription date as today date and charge prorate amount

fringe marsh
#

correct because if you set the subscription start date as today then its pretty much a brand new subscription

humble arrow
#

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 ?

karmic olive
#

Have you tested this?

humble arrow
#

Not yet. I can give a try!

karmic olive
#

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 ๐Ÿ˜…

humble arrow
#

Sure.

#

I thought I will get quick answer before testing, but definitely going to test

karmic olive
#

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