How To Update Stripe Subscription Plan in Laravel ?

Admin   Laravel   255  2021-03-14 23:30:06

Hello Friends,

Now let's see example of how to change stripe subscription plan in laravel application. We will talk about how to update stripe subscription plan in laravel app. I am going to learn you stripe update subscription plan in laravel. This tutorial will give you how to update an existing subscription plan in laravel.

You can integrate stripe payment integration in laravel so let's click here Laravel 8 Stripe Payment Gateway Integration Tutorial

In this tutorial i will give you simple and easy way update stripe subscription in laravel So let's see the bellow solution:

 

\Stripe\Stripe::setApiKey('STRIPE_SECRET');

$subscription = \Stripe\Subscription::retrieve('subscription id';

// Change Plan

$charge = \Stripe\Subscription::update('subscription id', [

'cancel_at_period_end' => false,

'proration_behavior' => 'create_prorations',

'billing_cycle_anchor' => 'unchanged',

'items' => [

[

'id' => $subscription->items->data[0]->id,

'price' => 'plan id',

],

],

]);

It will help you...