- Pass custom tracking IDs for each payment
- Pre-fill customer information like email
- Set dynamic success URLs based on your app’s context
- Apply discount codes programmatically
- Add metadata for internal tracking
Prerequisites
Before creating checkout sessions, you’ll need:- A Creem account with an API key (Get your key)
- At least one product created in your dashboard
Creating a Checkout Session
Choose the integration method that works best for your stack:- Next.js
- TypeScript SDK
- Better Auth
- REST API
The Next.js adapter provides a route handler and React component for seamless integration.The
Install the package
Create the checkout route
Add a checkout button
CreemCheckout component automatically handles the checkout session creation and redirects the user to the payment page.Next.js SDK Documentation
Explore advanced features, server components, and webhook handling.
Handling Successful Payments
After a successful payment, users are redirected to yoursuccess_url with payment details as query parameters:
| Query parameter | Description |
|---|---|
checkout_id | The ID of the checkout session created for this payment. |
order_id | The ID of the order created after successful payment. |
customer_id | The customer ID, based on the email that executed the successful payment. |
subscription_id | The subscription ID of the product. |
product_id | The product ID that the payment is related to. |
request_id | Optional. The request/reference ID you provided when creating this checkout. |
signature | All previous parameters signed by creem using your API-key, verifiable by you. |
Advanced Features
Metadata
Add custom metadata to track additional information with each payment. Metadata is included in webhook events and can be retrieved later.- Next.js
- TypeScript SDK
- Better Auth
- REST API
Custom Success URL
Override the default success URL on a per-checkout basis. This is useful for directing users to specific pages after payment based on context.- Next.js
- TypeScript SDK
- Better Auth
- REST API
Pre-fill Customer Email
Lock the customer email at checkout to ensure users complete payment with the email they registered with on your platform.- Next.js
- TypeScript SDK
- Better Auth
- REST API
Apply Discount Codes
Apply discount codes programmatically to pre-fill them at checkout.- Next.js
- TypeScript SDK
- Better Auth
- REST API
Discount Codes
Learn how to create and manage discount codes in your dashboard.
Seat-Based Billing
Charge for multiple units or seats by specifying theunits parameter. The total price will be calculated as base_price × units.
- Next.js
- TypeScript SDK
- Better Auth
- REST API
Seat-Based Billing
Learn more about implementing and managing seat-based pricing models.