Created
May 18, 2021 15:13
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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