Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/app/Console/Commands/StripeProductCreate.php
Назад
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Models\Package; use Illuminate\Support\Facades\Http; class StripeProductCreate extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'app:stripe_product_create'; /** * The console command description. * * @var string */ protected $description = 'Creates four products in stripe'; /** * Execute the console command. */ public function handle() { $headers = [ 'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Bearer '.config('constants.stripe.secret_key'), ]; $stripe = new \Stripe\StripeClient(config('constants.stripe.secret_key')); $object = $stripe->products->create([ 'name' => 'Free', 'active' => true, 'default_price_data[currency]' => 'usd', 'default_price_data[unit_amount]' => 0, 'default_price_data[recurring][interval]' => 'month' ]); $data = $object->values(); Package::where('id',1)->update(['stripe_plan' => $data[0], 'stripe_price_id' => $data[5]]); $object = $stripe->products->create([ 'name' => 'Basic', 'active' => true, 'default_price_data[currency]' => 'usd', 'default_price_data[unit_amount]' => 1000, 'default_price_data[recurring][interval]' => 'month' ]); $data = $object->values(); Package::where('id',2)->update(['stripe_plan' => $data[0], 'stripe_price_id' => $data[5]]); $object = $stripe->products->create([ 'name' => 'Premium', 'active' => true, 'default_price_data[currency]' => 'usd', 'default_price_data[unit_amount]' => 1500, 'default_price_data[recurring][interval]' => 'month' ]); $data = $object->values(); Package::where('id',3)->update(['stripe_plan' => $data[0], 'stripe_price_id' => $data[5]]); $object = $stripe->products->create([ 'name' => 'Unlimited', 'active' => true, 'default_price_data[currency]' => 'usd', 'default_price_data[unit_amount]' => 2800, 'default_price_data[recurring][interval]' => 'month' ]); $data = $object->values(); Package::where('id',4)->update(['stripe_plan' => $data[0], 'stripe_price_id' => $data[5]]); $this->info('Successfully Ran Making Products Command in Stripe.'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка