Jam*_*sir 8 laravel stripe-payments laravel-5 laravel-cashier
我想从条带上的应用程序创建一个计划.这种情况是,用户需要支付不同的价格作为定期付款.所以,这就是我想为每个用户创建计划的原因.
我正在使用laravel 5并使用"laravel/cashier": "~5.0"
God*_*ard 12
laravel/cashier只是没有这个功能.虽然因为很容易使用Stripe的API,它应该作为依赖项下载到你的供应商文件夹中.如果没有,你可以用作曲家下载它.
composer require stripe/stripe-php 2.*
Run Code Online (Sandbox Code Playgroud)
你可以用它
use \Stripe\Plan;
Plan::create(array(
"amount" => 2000,
"interval" => "month",
"name" => "Amazing Gold Plan",
"currency" => "usd",
"id" => "gold")
);
Run Code Online (Sandbox Code Playgroud)
您可以在这里阅读更多内容 - https://stripe.com/docs/api#create_plan
非常感谢。我通过这个线程学到了很多东西。但是对于最新的收银员和 stripe-php 版本,几乎没有什么需要改变的。
我的收银员版本是 7.0 ( "laravel/cashier": "~7.0") 并且它会自动安装 stripe-php 5。但是一些参数从stripe api改变了。所以这段代码将起作用,
\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"
));
Run Code Online (Sandbox Code Playgroud)
您可以在 stripe api docs 的 PHP 部分阅读更多内容...(https://stripe.com/docs/api/php#create_plan)
| 归档时间: |
|
| 查看次数: |
2802 次 |
| 最近记录: |