Skip to content

Instantly share code, notes, and snippets.

@vsitaraman
Created May 18, 2021 15:13
Show Gist options
  • Select an option

  • Save vsitaraman/5698d986258183770dc23902436b672b to your computer and use it in GitHub Desktop.

Select an option

Save vsitaraman/5698d986258183770dc23902436b672b to your computer and use it in GitHub Desktop.
Stripe PHP Redirect to Checkout.js: Free Trial Subscriptions + One-Time Fee (Client-Side Flow)
$stripe->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'payment_method_types' => ['card'],
'line_items' => [
[
'price' => 'price_recurring',
'quantity' => 1,
],
[
'price' => 'price_one_time',
'quantity' => 1,
],
],
'mode' => 'subscription',
'subscription_data' => [
'trial_period_days' => 14,
],
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment