#mathankumar-subscription
1 messages ยท Page 1 of 1 (latest)
Discord is a bit busy now. Looking into it
Okay
From https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
If both prices have the same billing periods โ combination of interval and interval_count, the subscription retains the same billing dates
Since the new plan has the same recurring interval, the billing dates remain the same
my scenario is that when I upgrade, I need to start that new plan with current start date, not the same billing period !!?
what i do for this scenario?
can you explain in more detail?
for example, I upgraded my subscription plan but my current_period_start and current_perion_date are not updated for my updated plan how can I do that also I need a billing cycle for this new plan
$this->stripeSubscriptionPlan = \Stripe\Subscription::update('stripe_subscription_id', [
'cancel_at_period_end' => false,
'proration_behavior' => 'create_prorations',
'items' => [
[
'id' => $subscription->items->data[0]->id,
'price' => $plan->stripe_id,
],
],
]);
using this code
you can set billing_cycle_anchor=>"now on the request then to also start a new billing cycle at the same time.
make sure to read https://stripe.com/docs/billing/subscriptions/billing-cycle#changing
and invoice will be created for that previous plan?
what would that mean?
I updated one plan it shows overdue, what does it mean?
I understand from "previous invoices are not paid correctly?"
sounds right
Okay
How can I get the previous plan usage details in usage-based plans?
I just got the current plan usage but I did not find ways for previous plan usage!
not sure exactly. Can you tell me how exactly you get the current usage in code so it refreshes my memory?
$stripe = new \Stripe\StripeClient( 'sk_test_51LKL0hSF6Qh6F24itprFyspHFL8jPfQ6cmgj0zKL1vljEzMFNzsLJiBtJOTLBwaHW2tdt7pB2x7ImW99RHcU19Z800rQB7JDTG' ); $stripe->subscriptionItems->allUsageRecordSummaries( 'si_DAyhPiOTjrdfTv', ['limit' => 3] );
by using this
well that will give you the previous usage as well, you just have to keep paginating(https://stripe.com/docs/api/pagination/auto?lang=php) through the data. It starts at the most recent usage but if you keep going back it returns data from previous periods