#kajaldhameliya_64534
1 messages · Page 1 of 1 (latest)
hello
That's not how our billing intervals work. They're billed on the same calendar date each month
so it has to be create cycle of the march month and need to set 31st march as an end date
Yes if that is what you need
Yes but its not working like that so is there any way i can amange
im passing this parameter while creating a subscription
$subscription_paramter = [
'customer' => $customer_id,
'default_payment_method' => $payment_method_id,
'items' => [
['price' => $plans, 'quantity' => 1]
],
'backdate_start_date' => 'Jan 31 Timestamp',
'billing_cycle_anchor' => 'Feb 29 Timestamp',
'coupon' => 'Old plan amount coupon'
];
Not possible without updating the subscription post creation to reset the billing_cycle_anchor: https://docs.stripe.com/billing/subscriptions/billing-cycle#changing
we are not updating the subscription but we are creating the new subscription with the difference amount
Yep, but you can't do what you want without updating the subscription after you create it
Alternatively look at using a schedule to set billing cycle anchor to March 31st after the Feb 29th phase/cycle ends
Okay Let me share the scenario what i need
We have one WordPress site where we are using Stripe APIs for managing plans and subscriptions for different customers we have on feature called change plan, where we use Stripe to create subscription API and delete old subscriptions.
So for only 30th Jan and 31st Jan, we are facing an issue while creating a new subscription.
We perform below step to upgrade using stripe APIs
- create unique id coupon with old plan amount
- create subscription with below parameter
$subscription_paramter = [
'customer' => $customer_id,
'default_payment_method' => $payment_method_id,
'items' => [
['price' => $plans, 'quantity' => 1]
],
'backdate_start_date' => 'Jan 31 Timestamp',
'billing_cycle_anchor' => 'Feb 29 Timestamp',
'coupon' => 'Old plan amount coupon which generate in step 1'
]; - Create subscription
$stripe->subscriptions->create($subscription_paramter); - Delet ccoupon $stripe->coupons->delete($coupon_title, []);
- Remove old subscription $stripe->subscriptions->cancel($subscription_id, []);
So let me know how i have to code so the new subscription charge difference amount only and next billing cycle will be the 29th feb to 31st march
I already told you, you can't do that in a Subscription creation call
29/2 - 31/3 is greater than a single month interval. That is impossible
By fixing billing_cycle_anchor to 29/2, the billing periods will run between 29th of each month
Yes, after you've created it you need to reset the billing anchor as I shared earlier
Okay
$stripe->subscriptions->update(
'sub_49ty4767H20z6a',
[
'billing_cycle_anchor' => 'now',
'proration_behavior' => 'create_prorations',
]
);
billing_cycle_anchor which date i have to pass if it's regarding 29th Feb, I can't set it to now, becuas eit will affect the whole cycle with the current date which is wrong
Then you need to use a trial period as the doc states
@dry fractal following up here, you should be able to use the billing_cycle_anchor_config parameter on creation: https://docs.stripe.com/billing/subscriptions/billing-cycle#use
For example:
billing_cycle_anchor_config: {
day_of_month: 31
}
That will set the anchor on the initial period to Feb 29th, and then subsequently March 31st (and the last day of the month beyond)
Than it charge an extra amount
For example, if i create subscription for $3 dollar then it charge $3.01