Stripe Checkout creates a secure, Stripe-hosted payment page that lets you collect payments quickly. It works across devices and can help increase your conversion. Checkout makes it easy to build a first-class payments experience.
This repo corresponds to the Checkout integration built in the Checkout 101 video series. The initial code is the code provided by the Checkout Quickstart Integration Builder.
This repo differs slightly from the Integration Builder code:
- The hard coded API key has been replaced with an environment variable.
- Calls to
Stripe.set_app_info
andStripe.api_version
have been added toserver.rb
.
- Rename or copy
.env.example
to.env
and setSTRIPE_SECRET_KEY
to your test secret API key. - Update the price id used in the
Stripe::Checkout::Session.create
in server.rb - Build the server
bundle install
- Run the server
ruby server.rb
- Visit http://localhost:4242/checkout.html to start the Checkout flow.
You can see the code shown in each 101 episode by video by viewing the corresponding pull request:
- Getting started wtih a Payment Link: A no code way to get up and running quickly with a Checkout (no code)
- Accept a payment with Checkout and the integration builder: Use the Checkout Quickstart Integration Builder to get up and running quickly with Checkout (initial commit of repo)
- Build notifications into Checkout: Add a webhook handler to your Checkout integration so you know when you've gotten paid and can fulfill the order. PR
- Build a customer order confirmation page with Checkout: Use the Checkout Session ID to look up order information after the customer has completed their purchase to display on the success page. Allow your customers to return to their Checkout session from the cancel page. PR
- Add support for adjustable quantities: Let your customer adjust their order during Checkout. Display the total price and quantities for each line item purchased on the success page. PR
- Recover abandoned carts: Configure Checkout to generate a new session when the original session is abandoned by the customer and expires. Collect consent to send promotional emails and listen for session expired events to know when to reach out to encourage a customer to complete their purchase. PR
If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.
If you have questions, comments, or need help with code, we're here to help:
- on Discord
- on Twitter at @StripeDev
- on Stack Overflow at the stripe-payments tag
- by email
Sign up to stay updated with developer news.
Photography credit for box of chocolates: Louis Mornaud