Build a checkout page with embedded components公開プレビュー
Use Elements and the Checkout Sessions API to build a checkout page.
Build a checkout page on your website using Stripe Elements and the Checkout Sessions API, an integration that manages tax, discounts, shipping rates, and more.
Set up the serverServer-side
Before you begin, you need to register for a Stripe account.
Use the official Stripe libraries to access the API from your application.
Set the SDK to use the custom_
beta version header.
Create a Checkout SessionServer-side
Add an endpoint on your server that creates a Checkout Session and returns its client secret to your front end. A Checkout Session represents your customer’s session as they pay for one-time purchases or subscriptions. Checkout Sessions expire 24 hours after creation.
Collect payment detailsClient-side
Collect payment details on the client with the Payment Element. The Payment Element is a prebuilt UI component that simplifies collecting payment details for a variety of payment methods.
Submit the paymentClient-side
Render a “pay” button that calls confirm to submit the payment.
Test your integration
- Navigate to your checkout page.
- Fill out the payment details with a payment method from the following table. For card payments:
- Enter any future date for card expiry.
- Enter any 3-digit number for CVC.
- Enter any billing postal code.
- Submit the payment to Stripe.
- Go to the Dashboard and look for the payment on the Payments page. If your payment succeeded, you’ll see it in that list.
- Click your payment to see more details, like billing information and the list of purchased items. You can use this information to fulfill the order.
実装内容をテストするためのその他の情報については、テストをご覧ください。