Create plan on stripe through laravel

前端 未结 2 2139
遥遥无期
遥遥无期 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:37

    Thanks so much. I learned lots of things by this thread. But for latest cashier and stripe-php versions few thing need to be changed.

    My cashier version is 7.0 ("laravel/cashier": "~7.0") and it automatically installs stripe-php 5. But some parameters has changed from stripe api. So this code will be working,

    \Stripe\Stripe::setApiKey("sk_test_your_key");
    
    \Stripe\Plan::create(array(
      "amount" => 5000,
      "interval" => "month",
      "product" => array(
        "name" => "Bronze standard"
      ),
      "currency" => "eur",
      "id" => "bronze-standard"
    ));
    

    And you can read more in PHP section of stripe api docs... (https://stripe.com/docs/api/php#create_plan)

提交回复
热议问题