Create a Checkout
/v1/checkouts
Creates a unique checkout for a specific variant with specified attributes.
Attributes
custom_price
A positive integer in cents representing the custom price of the variant.
If the purchased product is a subscription, this custom price is used for all renewal payments. If the subscription’s variant changes in the future (i.e. the customer is moved to a different subscription “tier”) the new variant’s price will be used from that moment forward.
product_options
An object containing any overridden product options for this checkout. Possible options include:
- name- A custom name for the product
- description- A custom description for the product
- media- An array of image URLs to use as the product’s media
- redirect_url- A custom URL to redirect to after a successful purchase
- receipt_button_text- A custom text to use for the order receipt email button
- receipt_link_url- A custom URL to use for the order receipt email button
- receipt_thank_you_note- A custom thank you note to use for the order receipt email
- enabled_variants- An array of variant IDs to enable for this checkout. If this is empty, all variants will be enabled.
checkout_options
An object containing checkout options for this checkout. Possible options include:
- embed- If- true, show the checkout overlay
- media- If- false, hide the product media
- logo- If- false, hide the store logo
- desc- If- false, hide the product description
- discount- If- false, hide the discount code field
- skip_trial- If- true, remove the free trial
- subscription_preview- If- false, hide the “You will be charged…” subscription preview text
- background_color- A custom hex color to use for the background of the checkout page.
- headings_color- A custom hex color to use for the headings on the checkout page.
- primary_text_color- A custom hex color to use for the primary text on the checkout page.
- secondary_text_color- A custom hex color to use for the secondary text on the checkout page.
- links_color- A custom hex color to use for the links on the checkout page.
- borders_color- A custom hex color to use for the borders on the checkout page.
- checkbox_color- A custom hex color to use for the checkboxes on the checkout page.
- active_state_color- A custom hex color to indicate an active state on the checkout page.
- button_color- A custom hex color to use for the checkout button.
- button_text_color- A custom hex color to use for the text within the checkout button.
- terms_privacy_color- A custom hex color to use for the terms and privacy text on the checkout page.
- darkdeprecated - If- true, use the dark theme. This has been deprecated in favor of the color options.
checkout_data
An object containing any prefill or custom data to be used in the checkout. Possible options include:
- email- A pre-filled email address
- name- A pre-filled name
- billing_address.country- A pre-filled billing address country in a ISO 3166-1 alpha-2 format
- billing_address.zip- A pre-filled billing address zip/postal code
- tax_number- A pre-filled tax number
- discount_code- A pre-filled discount code
- custom- An object containing any custom data to be passed to the checkout
- variant_quantities- A list containing quantity data objects
custom should be an object like this:
"custom": {
  "user_id": "123"
}variant_quantities should be a list of objects containing a variant ID and a quantity value (both integers):
"variant_quantities": [
  {
    "variant_id": 123,
    "quantity": 3
  }
]preview
A boolean indicating whether to return a preview of the checkout. If true, the checkout will include a preview object with the checkout preview data.
test_mode
A boolean indicating whether the checkout should be created in test mode.
expires_at
An ISO 8601 formatted date-time string indicating when the checkout expires. Can be null if the checkout is perpetual.
Relationships
store
The store this checkout belongs to.
variant
The variant associated with this checkout.
By default, all variants of the related product will be shown in the checkout, with your selected variant highlighted. If you want hide to other variants, you can utilise the product_options.enabled_variants option to determine which variant(s) are displayed in the checkout.
curl -X "POST" "https://api.lemonsqueezy.com/v1/checkouts" \
  -H 'Accept: application/vnd.api+json' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Authorization: Bearer {api_key}' \
  -d $'{
  "data": {
    "type": "checkouts",
    "attributes": {
      "custom_price": 50000,
      "product_options": {
        "enabled_variants": [1]
      },
      "checkout_options": {
        "button_color": "#7047EB"
      },
      "checkout_data": {
        "discount_code": "10PERCENTOFF",
        "custom": {
          "user_id": 123
        }
      },
      "expires_at": "2022-10-30T15:20:06Z",
      "preview": true
    },
    "relationships": {
      "store": {
        "data": {
          "type": "stores",
          "id": "1"
        }
      },
      "variant": {
        "data": {
          "type": "variants",
          "id": "1"
        }
      }
    }
  }
}'Returns
Returns a Checkout object.
{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195"
  },
  "data": {
    "type": "checkouts",
    "id": "5e8b546c-c561-4a2c-a586-40c18bb2a195",
    "attributes": {
      "store_id": 1,
      "variant_id": 1,
      "custom_price": 50000,
      "product_options": {
        "name": "",
        "description": "",
        "media": [],
        "redirect_url": "",
        "receipt_button_text": "",
        "receipt_link_url": "",
        "receipt_thank_you_note": "",
        "enabled_variants": [1]
      },
      "checkout_options": {
        "embed": false,
        "media": true,
        "logo": true,
        "desc": true,
        "discount": true,
        "skip_trial": false,
        "subscription_preview": true,
        "button_color": "#7047EB"
      },
      "checkout_data": {
        "email": "",
        "name": "",
        "billing_address": [],
        "tax_number": "",
        "discount_code": "",
        "custom": [],
        "variant_quantities": []
      },
      "preview": {
        "currency": "USD",
        "currency_rate": 1,
        "subtotal": 5000,
        "discount_total": 0,
        "tax": 0,
        "total": 5000,
        "subtotal_usd": 5000,
        "discount_total_usd": 0,
        "tax_usd": 0,
        "total_usd": 5000,
        "subtotal_formatted": "$50.00",
        "discount_total_formatted": "$50.00",
        "tax_formatted": "$0.00",
        "total_formatted": "$5.00"
      },
      "expires_at": "2022-10-30T15:20:06.000000Z",
      "created_at": "2022-10-14T13:03:37.000000Z",
      "updated_at": "2022-10-14T13:03:37.000000Z",
      "test_mode": false,
      "url": "https://my-store.lemonsqueezy.com/checkout/custom/5e8b546c-c561-4a2c-a586-40c18bb2a195?expires=1667143206&signature=8f7248ad2022ef1d4111752ae02d14f8d04332274861ca5c3589eb22b5086a5b"
    },
    "relationships": {
      "store": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/store",
          "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/relationships/store"
        }
      },
      "variant": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/variant",
          "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195/relationships/variant"
        }
      }
    },
    "links": {
      "self": "https://api.lemonsqueezy.com/v1/checkouts/5e8b546c-c561-4a2c-a586-40c18bb2a195"
    }
  }
}