Skip to main content
POST
/
v1
/
checkouts
Creates a new checkout session.
curl --request POST \
  --url https://api.creem.io/v1/checkouts \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "product_id": "prod_1234567890",
  "request_id": "<string>",
  "units": 1,
  "discount_code": "SUMMER2024",
  "customer": {
    "id": "cust_1234567890",
    "email": "[email protected]"
  },
  "custom_fields": [
    {
      "type": "text",
      "key": "companyName",
      "label": "Company Name",
      "optional": true,
      "text": {
        "max_length": 200,
        "min_length": 1
      },
      "checkbox": {
        "label": "I agree to the [terms and conditions](https://example.com/terms)"
      }
    }
  ],
  "custom_field": [
    {
      "type": "text",
      "key": "companyName",
      "label": "Company Name",
      "optional": true,
      "text": {
        "max_length": 200,
        "min_length": 1
      },
      "checkbox": {
        "label": "I agree to the [terms and conditions](https://example.com/terms)"
      }
    }
  ],
  "success_url": "<string>",
  "metadata": {
    "userId": "user_123",
    "visitCount": 42,
    "lastVisit": "2023-04-01"
  }
}
'
{
  "id": "<string>",
  "mode": "test",
  "object": "<string>",
  "status": "completed",
  "product": "<string>",
  "request_id": "<string>",
  "units": 1,
  "order": {
    "id": "<string>",
    "mode": "test",
    "object": "<string>",
    "product": "<string>",
    "amount": 2000,
    "currency": "USD",
    "status": "pending",
    "type": "recurring",
    "created_at": "2023-09-13T00:00:00Z",
    "updated_at": "2023-09-13T00:00:00Z",
    "customer": "<string>",
    "transaction": "tx_1234567890",
    "discount": "dis_1234567890",
    "sub_total": 1800,
    "tax_amount": 200,
    "discount_amount": 100,
    "amount_due": 1900,
    "amount_paid": 1900,
    "fx_amount": 15,
    "fx_currency": "EUR",
    "fx_rate": 1.2,
    "affiliate": "<string>"
  },
  "subscription": "<string>",
  "customer": "<string>",
  "custom_fields": [
    {
      "type": "text",
      "key": "<string>",
      "label": "<string>",
      "optional": true,
      "text": {
        "max_length": 123,
        "minimum_length": 123,
        "value": "<string>"
      },
      "checkbox": {
        "label": "<string>",
        "value": true
      }
    }
  ],
  "checkout_url": "<string>",
  "success_url": "https://example.com/return",
  "feature": [
    {
      "id": "feat_abc123",
      "description": "Get access to the full course materials.",
      "type": "licenseKey",
      "private_note": "Thank you for your purchase! Here is your access code: XYZ123",
      "file": {
        "files": [
          {
            "id": "file_abc123",
            "file_name": "ebook.pdf",
            "url": "https://storage.creem.io/files/ebook.pdf",
            "type": "application/pdf",
            "size": 1024000
          }
        ]
      },
      "license_key": {
        "id": "<string>",
        "mode": "test",
        "object": "<string>",
        "status": "active",
        "key": "ABC123-XYZ456-XYZ456-XYZ456",
        "activation": 5,
        "created_at": "2023-09-13T00:00:00Z",
        "activation_limit": 1,
        "expires_at": "2023-09-13T00:00:00Z",
        "instance": {
          "id": "<string>",
          "mode": "test",
          "object": "license-instance",
          "name": "My Customer License Instance",
          "status": "active",
          "created_at": "2023-09-13T00:00:00Z"
        }
      },
      "license": {
        "id": "<string>",
        "mode": "test",
        "object": "<string>",
        "status": "active",
        "key": "ABC123-XYZ456-XYZ456-XYZ456",
        "activation": 5,
        "created_at": "2023-09-13T00:00:00Z",
        "activation_limit": 1,
        "expires_at": "2023-09-13T00:00:00Z",
        "instance": {
          "id": "<string>",
          "mode": "test",
          "object": "license-instance",
          "name": "My Customer License Instance",
          "status": "active",
          "created_at": "2023-09-13T00:00:00Z"
        }
      }
    }
  ],
  "metadata": {
    "userId": "user_123",
    "visitCount": 42,
    "lastVisit": "2023-04-01"
  }
}

Authorizations

x-api-key
string
header
required

API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.

Body

application/json

Create checkout request payload

product_id
string
required

The ID of the product associated with the checkout session.

Example:

"prod_1234567890"

request_id
string

Identify and track each checkout request.

units
number

The number of units for the order.

Example:

1

discount_code
string

Prefill the checkout session with a discount code.

Example:

"SUMMER2024"

customer
object

Customer data for checkout session. This will prefill the customer info on the checkout page.

custom_fields
object[]

Collect additional information from your customer using custom fields. Up to 3 fields are supported.

custom_field
object[]
deprecated

DEPRECATED: Use custom_fields instead. Collect additional information from your customer using custom fields. Up to 3 fields are supported.

success_url
string

The URL to which the user will be redirected after the checkout process is completed.

metadata
object

Metadata for the checkout in the form of key-value pairs

Example:
{
"userId": "user_123",
"visitCount": 42,
"lastVisit": "2023-04-01"
}

Response

Successfully created a checkout session

id
string
required

Unique identifier for the object.

mode
enum<string>
required

String representing the environment.

Available options:
test,
prod,
sandbox
object
string
required

String representing the object's type. Objects of the same type share the same value.

status
enum<string>
required

Status of the checkout.

Available options:
pending,
processing,
completed,
expired
Example:

"completed"

product
required

The product associated with the checkout session.

request_id
string

Identify and track each checkout request.

units
number
default:1

The number of units for the of the product.

order
object

The order associated with the checkout session.

subscription

The subscription associated with the checkout session.

customer

The customer associated with the checkout session.

custom_fields
object[]

Additional information collected from your customer during the checkout process.

checkout_url
string

The URL to which the customer will be redirected to complete the payment.

success_url
string | null

The URL to which the user will be redirected after the checkout process is completed.

Example:

"https://example.com/return"

feature
object[]

Features issued for the order.

metadata
object

Metadata for the checkout in the form of key-value pairs

Example:
{
"userId": "user_123",
"visitCount": 42,
"lastVisit": "2023-04-01"
}