Why use a checkout session?
With checkout sessions generated dynamically instead of just using a product payment link, you are able to pass arequest_id to the session.
This allows you to track the payment status and the user that made the payment in your system in a more organized way, and gives you the flexibility to track that payment with any ID you choose instead of relying on Creem IDs.
Create a checkout session
You can create a checkout session with a product ID Additionally, you can pass arequest_id to the session to track the payment in your system.
You will also need the API key to authenticate the request.
Building on Next.js? Use the
@creem_io/nextjs adaptor as your primary
path. It creates the checkout route and component for you while still letting
you call the REST API directly when needed.
checkout_url that you can use to redirect the user to the payment page.
Any payments made with this checkout session will have the request_id you provided on the Redirect URL, as well as the webhook event.
Metadata
Therequest_id is only returned in the checkout.completed webhook (which is very useful for one-time payments), but it’s not sent with every new subscription transaction.
To make things easier, we also allow you to pass metadata in a checkoutSession with or without the request_id. This metadata will be saved in the Subscription object and returned with every subsequent webhook.
Success URL
You can pass a customsuccess_url for each checkout_session, which will override the success_url set on the product.
This allows you to dynamically redirect users to custom pages after each payment (useful for directing users to their specific account resources after payment).
Customer Email
You can pass acustomer.email directly in the checkout session.
This email will be pre-filled for the user on the checkout session page and cannot be changed.
This is useful if you want to ensure that the user completes the payment using the email they registered on your platform.
Discount Codes
You can pass adiscount_code directly in the checkout session.
This discount code will be pre-filled for the user on the checkout session page.
Seat Based Billing
You can pass aunits amount directly in the checkout session.
The product price will be used as the base price for one seat/unit of the product and the checkout session will reflect the (base price x units) to be charged.