Pre-Filled Checkout Fields
When sharing a product on Lemon Squeezy, you receive a customizable link for easy integration in emails, social media, and websites, with options to prefill checkout fields.
The basic structure of a checkout link is as follows:
https://[STORE].lemonsqueezy.com/checkout/buy/[VARIANT_ID]
For example, a checkout link might look like:
https://my-store.lemonsqueezy.com/checkout/buy/d1f120fd-5adc-4fff-8915-cce713d29427
Pre-filling data in checkout links
If you already know some of your customer data before sending them to the checkout, you can add a few extra parameters to prefill customer data to make the checkout process more straightforward.
That can be done by adding parameters to the checkout link:
https://[STORE].lemonsqueezy.com/checkout/buy/[VARIANT_ID]
?checkout[email][email protected]
&checkout[name]=John Doe
&checkout[billing_address][country]=US
&checkout[billing_address][state]=NY
&checkout[billing_address][zip]=10038
&checkout[tax_number]=GB123456789
&checkout[discount_code]=10PERCENTOFF
Note
The checkout[billing_address][country]
field must use the ISO 3166-1 alpha-2 format. All data will undergo sanitization and validation before the checkout submission.
The list of available parameters are:
Parameter | Description | Example Value |
---|---|---|
checkout[email] | Customer’s email | [email protected] |
checkout[name] | Customer’s full name | John Doe |
checkout[billing_address][country] | Billing address country | US |
checkout[billing_address][state] | Billing address state | NY |
checkout[billing_address][zip] | Billing address ZIP/postal code | 10038 |
checkout[tax_number] | Business tax number | GB123456789 |
checkout[discount_code] | Discount code | 10PERCENTOFF |
Pre-filling data with the API
You can also pass custom data to checkout links created with the API by passing a JSON object inside checkout_data
.
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": {
"checkout_data": {
"email": "[email protected]",
"name": "John Doe"
}
},
"relationships": {
...
}
}
}'
More info can be found in the Create a checkout API docs.