Skip to main content

Creating a Checkout Session

Learn how to programmatically create checkout sessions for your products using Creem’s APIs and SDKs.

Video Tutorial

What is a Checkout Session?

A checkout session is a dynamically generated payment page that gives you programmatic control over the payment flow. Unlike static payment links, checkout sessions allow you to:
  • Pass custom tracking IDs for each payment
  • Pre-fill customer information
  • Set dynamic success URLs based on your app’s context
  • Apply discount codes programmatically
  • Add metadata for internal tracking

Prerequisites

Before you begin, make sure you have:
  • A Creem account with an API key
  • At least one product created in your dashboard
  • Your development environment set up
Find your product ID by going to the Products tab, clicking on a product, and selecting “Copy ID” from the options menu.

Quick Start

Choose your preferred integration method:

Common Use Cases

1. Pre-fill Customer Email

Ensure users complete payment with their registered email:
const checkout = await creem.checkouts.create({
  productId: 'prod_YOUR_PRODUCT_ID',
  customer: {
    email: '[email protected]',
  },
});

2. Track Payments with Custom IDs

Associate payments with your internal system:
const checkout = await creem.checkouts.create({
  productId: 'prod_YOUR_PRODUCT_ID',
  requestId: 'order_12345',
  metadata: {
    userId: 'internal_user_id',
    source: 'marketing_campaign',
  },
});

3. Apply Discount Codes

Pre-fill discount codes for special offers:
const checkout = await creem.checkouts.create({
  productId: 'prod_YOUR_PRODUCT_ID',
  discountCode: 'LAUNCH50',
});

4. Seat-Based Billing

Charge for multiple units or seats:
const checkout = await creem.checkouts.create({
  productId: 'prod_YOUR_PRODUCT_ID',
  units: 5, // Charge for 5 seats
});

Next Steps

Need Help?

Having trouble? Check out our complete Checkout API documentation or contact us