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,
"custom_price": 1500,
"discount_code": "SUMMER2024",
"affiliate_code": "aff_abc123",
"customer": {
"id": "cust_1234567890",
"email": "user@example.com",
"name": "John Doe"
},
"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"
}
}
'import requests
url = "https://api.creem.io/v1/checkouts"
payload = {
"product_id": "prod_1234567890",
"request_id": "<string>",
"units": 1,
"custom_price": 1500,
"discount_code": "SUMMER2024",
"affiliate_code": "aff_abc123",
"customer": {
"id": "cust_1234567890",
"email": "user@example.com",
"name": "John Doe"
},
"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"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_id: 'prod_1234567890',
request_id: '<string>',
units: 1,
custom_price: 1500,
discount_code: 'SUMMER2024',
affiliate_code: 'aff_abc123',
customer: {id: 'cust_1234567890', email: 'user@example.com', name: 'John Doe'},
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'}
})
};
fetch('https://api.creem.io/v1/checkouts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.creem.io/v1/checkouts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'product_id' => 'prod_1234567890',
'request_id' => '<string>',
'units' => 1,
'custom_price' => 1500,
'discount_code' => 'SUMMER2024',
'affiliate_code' => 'aff_abc123',
'customer' => [
'id' => 'cust_1234567890',
'email' => 'user@example.com',
'name' => 'John Doe'
],
'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'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.creem.io/v1/checkouts"
payload := strings.NewReader("{\n \"product_id\": \"prod_1234567890\",\n \"request_id\": \"<string>\",\n \"units\": 1,\n \"custom_price\": 1500,\n \"discount_code\": \"SUMMER2024\",\n \"affiliate_code\": \"aff_abc123\",\n \"customer\": {\n \"id\": \"cust_1234567890\",\n \"email\": \"user@example.com\",\n \"name\": \"John Doe\"\n },\n \"custom_fields\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"custom_field\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"success_url\": \"<string>\",\n \"metadata\": {\n \"userId\": \"user_123\",\n \"visitCount\": 42,\n \"lastVisit\": \"2023-04-01\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.creem.io/v1/checkouts")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"product_id\": \"prod_1234567890\",\n \"request_id\": \"<string>\",\n \"units\": 1,\n \"custom_price\": 1500,\n \"discount_code\": \"SUMMER2024\",\n \"affiliate_code\": \"aff_abc123\",\n \"customer\": {\n \"id\": \"cust_1234567890\",\n \"email\": \"user@example.com\",\n \"name\": \"John Doe\"\n },\n \"custom_fields\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"custom_field\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"success_url\": \"<string>\",\n \"metadata\": {\n \"userId\": \"user_123\",\n \"visitCount\": 42,\n \"lastVisit\": \"2023-04-01\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_id\": \"prod_1234567890\",\n \"request_id\": \"<string>\",\n \"units\": 1,\n \"custom_price\": 1500,\n \"discount_code\": \"SUMMER2024\",\n \"affiliate_code\": \"aff_abc123\",\n \"customer\": {\n \"id\": \"cust_1234567890\",\n \"email\": \"user@example.com\",\n \"name\": \"John Doe\"\n },\n \"custom_fields\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"custom_field\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"success_url\": \"<string>\",\n \"metadata\": {\n \"userId\": \"user_123\",\n \"visitCount\": 42,\n \"lastVisit\": \"2023-04-01\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"mode": "test",
"object": "<string>",
"status": "completed",
"product": "<string>",
"request_id": "<string>",
"units": 1,
"custom_price": 1500,
"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>",
"recovered": false
},
"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",
"license_keys": [
{
"id": "<string>",
"mode": "test",
"object": "<string>",
"product_id": "prod_abc123",
"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"
}
}
],
"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>",
"product_id": "prod_abc123",
"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"
}
},
"customer_credits": {
"amount": "100",
"unit_label": "tokens",
"bucket_name": "images",
"requires_moderation": false,
"resets_each_period": false
},
"license": {
"id": "<string>",
"mode": "test",
"object": "<string>",
"product_id": "prod_abc123",
"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"
},
"discount": {
"id": "dis_3e6Z6TzvHKdsjEgXnGDEp0",
"discountCode": "HOLIDAY2024",
"name": "<string>",
"type": "percentage",
"amount": 123,
"duration": "forever",
"durationInMonths": 123
}
}Creates a new checkout session
Create a new checkout session to accept one-time payments or start subscriptions. Returns a checkout URL to redirect customers.
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,
"custom_price": 1500,
"discount_code": "SUMMER2024",
"affiliate_code": "aff_abc123",
"customer": {
"id": "cust_1234567890",
"email": "user@example.com",
"name": "John Doe"
},
"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"
}
}
'import requests
url = "https://api.creem.io/v1/checkouts"
payload = {
"product_id": "prod_1234567890",
"request_id": "<string>",
"units": 1,
"custom_price": 1500,
"discount_code": "SUMMER2024",
"affiliate_code": "aff_abc123",
"customer": {
"id": "cust_1234567890",
"email": "user@example.com",
"name": "John Doe"
},
"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"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_id: 'prod_1234567890',
request_id: '<string>',
units: 1,
custom_price: 1500,
discount_code: 'SUMMER2024',
affiliate_code: 'aff_abc123',
customer: {id: 'cust_1234567890', email: 'user@example.com', name: 'John Doe'},
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'}
})
};
fetch('https://api.creem.io/v1/checkouts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.creem.io/v1/checkouts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'product_id' => 'prod_1234567890',
'request_id' => '<string>',
'units' => 1,
'custom_price' => 1500,
'discount_code' => 'SUMMER2024',
'affiliate_code' => 'aff_abc123',
'customer' => [
'id' => 'cust_1234567890',
'email' => 'user@example.com',
'name' => 'John Doe'
],
'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'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.creem.io/v1/checkouts"
payload := strings.NewReader("{\n \"product_id\": \"prod_1234567890\",\n \"request_id\": \"<string>\",\n \"units\": 1,\n \"custom_price\": 1500,\n \"discount_code\": \"SUMMER2024\",\n \"affiliate_code\": \"aff_abc123\",\n \"customer\": {\n \"id\": \"cust_1234567890\",\n \"email\": \"user@example.com\",\n \"name\": \"John Doe\"\n },\n \"custom_fields\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"custom_field\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"success_url\": \"<string>\",\n \"metadata\": {\n \"userId\": \"user_123\",\n \"visitCount\": 42,\n \"lastVisit\": \"2023-04-01\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.creem.io/v1/checkouts")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"product_id\": \"prod_1234567890\",\n \"request_id\": \"<string>\",\n \"units\": 1,\n \"custom_price\": 1500,\n \"discount_code\": \"SUMMER2024\",\n \"affiliate_code\": \"aff_abc123\",\n \"customer\": {\n \"id\": \"cust_1234567890\",\n \"email\": \"user@example.com\",\n \"name\": \"John Doe\"\n },\n \"custom_fields\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"custom_field\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"success_url\": \"<string>\",\n \"metadata\": {\n \"userId\": \"user_123\",\n \"visitCount\": 42,\n \"lastVisit\": \"2023-04-01\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_id\": \"prod_1234567890\",\n \"request_id\": \"<string>\",\n \"units\": 1,\n \"custom_price\": 1500,\n \"discount_code\": \"SUMMER2024\",\n \"affiliate_code\": \"aff_abc123\",\n \"customer\": {\n \"id\": \"cust_1234567890\",\n \"email\": \"user@example.com\",\n \"name\": \"John Doe\"\n },\n \"custom_fields\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"custom_field\": [\n {\n \"type\": \"text\",\n \"key\": \"companyName\",\n \"label\": \"Company Name\",\n \"optional\": true,\n \"text\": {\n \"max_length\": 200,\n \"min_length\": 1\n },\n \"checkbox\": {\n \"label\": \"I agree to the [terms and conditions](https://example.com/terms)\"\n }\n }\n ],\n \"success_url\": \"<string>\",\n \"metadata\": {\n \"userId\": \"user_123\",\n \"visitCount\": 42,\n \"lastVisit\": \"2023-04-01\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"mode": "test",
"object": "<string>",
"status": "completed",
"product": "<string>",
"request_id": "<string>",
"units": 1,
"custom_price": 1500,
"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>",
"recovered": false
},
"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",
"license_keys": [
{
"id": "<string>",
"mode": "test",
"object": "<string>",
"product_id": "prod_abc123",
"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"
}
}
],
"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>",
"product_id": "prod_abc123",
"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"
}
},
"customer_credits": {
"amount": "100",
"unit_label": "tokens",
"bucket_name": "images",
"requires_moderation": false,
"resets_each_period": false
},
"license": {
"id": "<string>",
"mode": "test",
"object": "<string>",
"product_id": "prod_abc123",
"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"
},
"discount": {
"id": "dis_3e6Z6TzvHKdsjEgXnGDEp0",
"discountCode": "HOLIDAY2024",
"name": "<string>",
"type": "percentage",
"amount": 123,
"duration": "forever",
"durationInMonths": 123
}
}Authorizations
Body
Create checkout request payload
Override the unit price of the product for this checkout session, in cents (e.g. 1500 = $15.00). The product currency is used, and the amount is per unit: with units: 3 and custom_price: 1500 the customer pays 4500. Must be between 100 (one whole unit of the currency) and 99999999. Only supported for one-time payment products. Use this for dynamic pricing models such as pay-what-you-want, donations, or amounts calculated by your application.
1500
Attribute this checkout to an affiliate using the affiliate's referral code (the unique code from their referral link). Use this to manually credit a sale to a specific affiliate when you already hold their code on your backend, instead of relying on referral-link clicks/cookies. The code must belong to an active affiliate of this store; an invalid, inactive, or foreign-store code is rejected.
"aff_abc123"
Response
Successfully created a checkout session