Skip to content

Instantly share code, notes, and snippets.

@cjavilla-stripe
Created June 23, 2020 19:39
Show Gist options
  • Save cjavilla-stripe/60df58dce2a0fecd140e8a7078c0f86d to your computer and use it in GitHub Desktop.
Save cjavilla-stripe/60df58dce2a0fecd140e8a7078c0f86d to your computer and use it in GitHub Desktop.
$session = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'price_data' => [
'unit_amount' => 5000, # $50 per month
'currency' => 'usd',
'product_data' => ['name' => 'My Service Plan'],
'recurring' => [
'interval' => 'month',
],
],
'quantity' => 1,
], [
'price_data' => [
'unit_amount' => 1000, # $10 one time setup fee
'currency' => 'usd',
'product_data' => ['name' => 'My Service Plan Setup fee'],
],
'quantity' => 1,
]],
'mode' => 'subscription',
'success_url' => 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => 'https://example.com/cancel',
]);
echo $session;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment