#sarvesh-subs-proration

1 messages · Page 1 of 1 (latest)

sly gardenBOT
wooden python
#

👋 how can I help?

polar whale
#

Hi

#

we are creating subscription with billing_cycle_anchor by setting next billing date 1st of each next month. which is working fine BUT if we switch the plan to another plan then we are passing 'billing_cycle_anchor'=>'unchanged' but it charges for full amounth immdiately and not prorated

#

how to fix this?

wooden python
#

Can you share an example request ID?

polar whale
#

$subscription = $stripe->subscriptions->create([
'customer' => $stripeCustomerId,
'items' => [[
'price' => $stripePriceId,
]],
'billing_cycle_anchor' => $billingCycleAnchor, //Set billing cycle 1st day of next month
'metadata' => $metaData,
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
]);

#

$subscription = $stripe->subscriptions->update($subscriptionData['stripe_subscription_id'],[
'items' => [[
'id' => $subscriptionData['subscription_item_id'],
'price' => $stripePriceId,
]],
'metadata' => $metaData,
'billing_cycle_anchor'=>'unchanged',
'payment_behavior' => 'default_incomplete',
]);

#

the update subscription charge full amount even on 31 today. It should charge for remaining days in month unti 1st of each month

#

sub_1Oe9AAHbAvQl6Cwu54gs39Xr

#

this is todays example subscription id

#

what needs to do to fix it?

wooden python
#

I'm looking, give me a few

#

Where exactly are you seeing it charge the full month amount?

sly gardenBOT
#

sarvesh-subs-proration

polar whale
wooden python
#

that's the same link I shared above?

polar whale
#

yes, so it was not created invoice as of today but it will charge on 1st of next month?

wooden python
#

Yes, the prorated amount would be added to the next month invoice.

if you want to charge it at the time of the update then you'd need to set proration_behavior to always_invoice when you update the subscription
https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior

polar whale
#

no, I think 1st day of next month is fine

#

now, will test the cancellation