Usage
First, initialize the checkout SDK in the browser:
When the user begins the checkout process, create a checkout session on your server. Usually, this is when they click a "Checkout" or "Buy" button.
Send the checkout session's client_secret to the browser and use it to call beginCheckout:
Customizing appearance
Use the appearance option to change the the components’ colors, fonts, spacing, focus states, and more.
Creating components
Create checkout components by calling checkout.createElement with the component type and an element to mount to:
Client completion event
A success message can be shown by adding an event listener to the checkout instance:
Server completion event
Order fulfillment should be handled on the server side by subscribing to the API event stream:
server.ts
Learn more about how to interact with the components in the SDK reference.