Prebuilt Checkout page
Explore a full, working code sample of an integration with Stripe Checkout. The client- and server-side code redirects to a prebuilt payment page hosted on Stripe.
Before you get started, confirm the payment methods you want to offer in your payment method settings. We enable cards and other common payment methods for you by default, and we recommend that you enable additional payment methods that are relevant for your business and customers.
Set up the server
Install the Stripe Ruby library
Install the Stripe ruby gem and require it in your code. Alternatively, if youโre starting from scratch and need a Gemfile, download the project files using the link in the code editor.
Create a Checkout Session
Add an endpoint on your server that creates a Checkout Session. A Checkout Session controls what your customer sees on the payment page such as line items, the order amount and currency, and acceptable payment methods. We enable cards and other common payment methods for you by default, and you can enable or disable payment methods directly in the Stripe Dashboard.
Define a product to sell
Always keep sensitive information about your product inventory, such as price and availability, on your server to prevent customer manipulation from the client. Define product information when you create the Checkout Session using predefined price IDs or on the fly with price_data.
Prebuilt Checkout page
Explore a full, working code sample of an integration with Stripe Checkout. The client- and server-side code redirects to a prebuilt payment page hosted on Stripe.
Before you get started, confirm the payment methods you want to offer in your payment method settings. We enable cards and other common payment methods for you by default, and we recommend that you enable additional payment methods that are relevant for your business and customers.
Set up the server
Install the Stripe Ruby library
Install the Stripe ruby gem and require it in your code. Alternatively, if youโre starting from scratch and need a Gemfile, download the project files using the link in the code editor.
Create a Checkout Session
Add an endpoint on your server that creates a Checkout Session. A Checkout Session controls what your customer sees on the payment page such as line items, the order amount and currency, and acceptable payment methods. We enable cards and other common payment methods for you by default, and you can enable or disable payment methods directly in the Stripe Dashboard.
Define a product to sell
Always keep sensitive information about your product inventory, such as price and availability, on your server to prevent customer manipulation from the client. Define product information when you create the Checkout Session using predefined price IDs or on the fly with price_data.