Create plan on stripe through laravel

前端 未结 2 2127
遥遥无期
遥遥无期 2021-02-14 09:45

I want to create a plan from my application on stripe. The scenario is that users are charged with different prices as recurring payments. So, that is why I want to create plan

2条回答
  •  失恋的感觉
    2021-02-14 10:25

    laravel/cashier just doesn't have this functionality baked in. You aren't out of luck though as it is easy to just use Stripe's API which should be downloaded as a dependency in your vendor folder. If not you can just download it with composer.

    composer require stripe/stripe-php 2.*
    

    You can use it with

    use \Stripe\Plan;
    
    Plan::create(array(
      "amount" => 2000,
      "interval" => "month",
      "name" => "Amazing Gold Plan",
      "currency" => "usd",
      "id" => "gold")
    );
    

    You can read more here - https://stripe.com/docs/api#create_plan

提交回复
热议问题