#kajaldhameliya_64534

1 messages · Page 1 of 1 (latest)

long shardBOT
dry fractal
#

hello

candid owl
#

That's not how our billing intervals work. They're billed on the same calendar date each month

dry fractal
#

so it has to be create cycle of the march month and need to set 31st march as an end date

candid owl
#

Yes if that is what you need

dry fractal
#

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'
];

candid owl
dry fractal
#

we are not updating the subscription but we are creating the new subscription with the difference amount

candid owl
#

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

dry fractal
#

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

  1. create unique id coupon with old plan amount
  2. 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'
    ];
  3. Create subscription
    $stripe->subscriptions->create($subscription_paramter);
  4. Delet ccoupon $stripe->coupons->delete($coupon_title, []);
  5. 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

candid owl
#

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

dry fractal
#

so there is only way is i have to use update subscription API

#

Correct?

candid owl
#

Yes, after you've created it you need to reset the billing anchor as I shared earlier

dry fractal
#

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

candid owl
#

Then you need to use a trial period as the doc states

long shardBOT
candid owl
#

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)

dry fractal
#

Than it charge an extra amount
For example, if i create subscription for $3 dollar then it charge $3.01