### Create Customer Response Example Source: https://docs.lemonsqueezy.com/api/customers/create-customer This is an example of the JSON response received after successfully creating a customer. It includes details of the created customer, their relationships, and relevant links. ```json { "jsonapi": { "version": "1.0" }, "links": { "self": "https://api.lemonsqueezy.com/v1/customers/1" }, "data": { "type": "customers", "id": "1", "attributes": { "store_id": 1, "name": "John Doe", "email": "johndoe@example.com", "status": "subscribed", "city": "New York", "region": "NY", "country": "US", "total_revenue_currency": 0, "mrr": 0, "status_formatted": "Subscribed", "country_formatted": "United States", "total_revenue_currency_formatted": "0.00", "mrr_formatted": "$0.00", "urls": { "customer_portal": null }, "created_at": "2022-12-01T13:01:07.000000Z", "updated_at": "2022-12-09T09:05:21.000000Z", "test_mode": false }, "relationships": { "store": { "links": { "related": "https://api.lemonsqueezy.com/v1/customers/1/store", "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/store" } }, "orders": { "links": { "related": "https://api.lemonsqueezy.com/v1/customers/1/orders", "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/orders" } }, "subscriptions": { "links": { "related": "https://api.lemonsqueezy.com/v1/customers/1/subscriptions", "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/subscriptions" } }, "license-keys": { "links": { "related": "https://api.lemonsqueezy.com/v1/customers/1/license-keys", "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/license-keys" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/customers/1" } } } ``` -------------------------------- ### Subscription Item Usage Response Example Source: https://docs.lemonsqueezy.com/api/subscription-items/retrieve-subscription-item-current-usage This is an example of the JSON response received when querying the current usage of a subscription item. It contains meta information about the billing period start and end dates, the total quantity used, and the interval unit and quantity for the subscription. ```json { "jsonapi": { "version": "1.0" }, "meta": { "period_start": "2023-08-10T13:08:16+00:00", "period_end": "2023-09-10T13:03:16+00:00", "quantity": 5, "interval_unit": "month", "interval_quantity": 1 } } ``` -------------------------------- ### Custom Paginated API Request Example Source: https://docs.lemonsqueezy.com/api/getting-started/requests Demonstrates how to construct a GET request to retrieve a specific page of orders with a custom number of results per page using query parameters. ```http GET /v1/orders?page[number]=3&page[size]=100 ``` -------------------------------- ### Multiple Filters API Request Example Source: https://docs.lemonsqueezy.com/api/getting-started/requests Provides an example of applying multiple filters to an API request, specifically filtering subscription invoices by both status and store ID. ```http GET /v1/subscription-invoices?filter[status]=open&filter[store_id]=1 ``` -------------------------------- ### GET /v1/products/:id Source: https://docs.lemonsqueezy.com/api/products/retrieve-product Retrieves the product with the given ID. Requires authentication. ```APIDOC ## GET /v1/products/:id ### Description Retrieves the product with the given ID. ### Method GET ### Endpoint /v1/products/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the product to retrieve. ### Request Headers - **Accept**: application/vnd.api+json - **Content-Type**: application/vnd.api+json - **Authorization**: Bearer {api_key} ### Request Example ```bash curl "https://api.lemonsqueezy.com/v1/products/1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` ### Response #### Success Response (200) Returns a Product object. #### Response Example ```json { "jsonapi": { "version": "1.0" }, "links": { "self": "https://api.lemonsqueezy.com/v1/products/1" }, "data": { "type": "products", "id": "1", "attributes": { "store_id": 1, "name": "Lemonade", "slug": "lemonade", "description": "

Lorem ipsum...

", "status": "published", "status_formatted": "Published", "thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg", "large_thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg", "price": 999, "price_formatted": "$9.99", "from_price": null, "to_price": null, "pay_what_you_want": false, "buy_now_url": "https://my-store.lemonsqueezy.com/checkout/buy/0a841cf5-4cc2-4bbb-ae5d-9529d97deec6", "from_price_formatted": null, "to_price_formatted": null, "created_at": "2021-05-27T12:54:47.000000Z", "updated_at": "2021-07-14T11:25:24.000000Z", "test_mode": false }, "relationships": { "store": { "links": { "related": "https://api.lemonsqueezy.com/v1/products/1/store", "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/store" } }, "variants": { "links": { "related": "https://api.lemonsqueezy.com/v1/products/1/variants", "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/variants" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/products/1" } } } ``` ``` -------------------------------- ### GET /v1/products/{id} Source: https://docs.lemonsqueezy.com/api/products Retrieve the details of a specific product by its unique identifier. ```APIDOC ## GET /v1/products/{id} ### Description Retrieves a single product object by its ID. This object contains all attributes related to the digital good. ### Method GET ### Endpoint /v1/products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the product. ### Response #### Success Response (200) - **type** (string) - The resource type, always 'products'. - **id** (string) - The unique ID of the product. - **attributes** (object) - The product details including name, slug, status, price, and media URLs. #### Response Example { "type": "products", "id": "1", "attributes": { "store_id": 1, "name": "Example Product", "slug": "example-product", "description": "

Lorem ipsum...

", "status": "published", "price": 999, "price_formatted": "$9.99", "created_at": "2021-05-27T12:54:47.000000Z", "test_mode": false } } ``` -------------------------------- ### List All License Key Instances (cURL) Source: https://docs.lemonsqueezy.com/api/license-key-instances/list-all-license-key-instances This snippet demonstrates how to list all license key instances using cURL. It includes the necessary headers for authentication and content type. The second example shows how to filter the results by a specific license key ID. ```curl curl "https://api.lemonsqueezy.com/v1/license-key-instances" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` ```curl curl "https://api.lemonsqueezy.com/v1/license-key-instances?filter[license_key_id]=1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### POST /v1/licenses/activate Source: https://docs.lemonsqueezy.com/api/license-api/activate-license-key Activates a specific license key for a product and registers a new instance name. ```APIDOC ## POST /v1/licenses/activate ### Description Activates a license key for a Lemon Squeezy product. This endpoint associates a unique instance name with the license key to track usage. ### Method POST ### Endpoint /v1/licenses/activate ### Parameters #### Request Body - **license_key** (string) - Required - The license key to activate. - **instance_name** (string) - Required - A label for the new instance to identify it in Lemon Squeezy. ### Request Example curl -X POST https://api.lemonsqueezy.com/v1/licenses/activate \ -H "Accept: application/json" \ -d "license_key=38b1460a-5104-4067-a91d-77b872934d51" \ -d "instance_name=Test" ### Response #### Success Response (200) - **activated** (boolean) - Indicates whether the license key was successfully activated. - **error** (string|null) - An error message if the activation failed. - **license_key** (object) - Information about the activated license key. - **instance** (object) - Information about the created license instance. - **meta** (object) - Additional metadata including order, product, and customer details. #### Response Example { "activated": true, "error": null, "license_key": { "id": 1, "status": "active", "key": "38b1460a-5104-4067-a91d-77b872934d51", "activation_limit": 1, "activation_usage": 5, "created_at": "2021-01-24T14:15:07.000000Z", "expires_at": null }, "instance": { "id": "47596ad9-a811-4ebf-ac8a-03fc7b6d2a17", "name": "Test", "created_at": "2021-04-06T14:15:07.000000Z" }, "meta": { "store_id": 1, "order_id": 2, "order_item_id": 3, "product_id": 4, "product_name": "Example Product", "variant_id": 5, "variant_name": "Default", "customer_id": 6, "customer_name": "John Doe", "customer_email": "johndoe@example.com" } } ``` -------------------------------- ### List Subscription Items by Subscription ID (GET /v1/subscription-items) Source: https://docs.lemonsqueezy.com/api/subscription-items/list-all-subscription-items This example shows how to filter subscription items by a specific subscription ID. By appending `?filter[subscription_id]={id}` to the API endpoint, you can retrieve only the subscription items associated with that particular subscription. This is useful for managing items within a single subscription. ```curl curl "https://api.lemonsqueezy.com/v1/subscription-items?filter[subscription_id]=1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### Create Checkout with Checkout Options and Data Source: https://docs.lemonsqueezy.com/api/checkouts/create-checkout This example shows how to create a checkout with various checkout options, such as embedding the checkout, hiding elements, and setting colors. It also includes pre-filling checkout data like email and billing address. ```javascript fetch("/v1/checkouts", { method: "POST", headers: { "Content-Type": "application/json", "Accept": "application/json" }, body: JSON.stringify({ "variant_id": 456, "checkout_options": { "embed": true, "media": false, "logo": false, "discount": false, "background_color": "#f0f0f0", "button_color": "#007bff", "button_text_color": "#ffffff", "locale": "en" }, "checkout_data": { "email": "customer@example.com", "name": "John Doe", "billing_address": { "country": "US", "zip": "10001" }, "custom": { "user_id": "user-abc" } } }) }) .then(response => response.json()) .then(data => console.log(data)); ``` -------------------------------- ### Variant Object Example Source: https://docs.lemonsqueezy.com/api/variants/the-variant-object This section provides a JSON example of the Variant object, illustrating its structure and the typical values for its attributes. ```APIDOC ## Variant Object Example ### Request Example ```json { "type": "variants", "id": "1", "attributes": { "product_id": 1, "name": "Example Variant", "slug": "46beb127-a8a9-33e6-89b5-078505657239", "description": "

Lorem ipsum...

", "price": 999, "is_subscription": false, "interval": null, "interval_count": null, "has_free_trial": false, "trial_interval": "day", "trial_interval_count": 30, "pay_what_you_want": false, "min_price": 0, "suggested_price": 0, "has_license_keys": false, "license_activation_limit": 5, "is_license_limit_unlimited": false, "license_length_value": 1, "license_length_unit": "years", "is_license_length_unlimited": false, "sort": 1, "status": "published", "status_formatted": "Published", "created_at": "2021-05-24T14:15:06.000000Z", "updated_at": "2021-06-24T14:44:38.000000Z", "test_mode": false } } ``` ### Response Example ```json { "type": "variants", "id": "1", "attributes": { "product_id": 1, "name": "Example Variant", "slug": "46beb127-a8a9-33e6-89b5-078505657239", "description": "

Lorem ipsum...

", "price": 999, "is_subscription": false, "interval": null, "interval_count": null, "has_free_trial": false, "trial_interval": "day", "trial_interval_count": 30, "pay_what_you_want": false, "min_price": 0, "suggested_price": 0, "has_license_keys": false, "license_activation_limit": 5, "is_license_limit_unlimited": false, "license_length_value": 1, "license_length_unit": "years", "is_license_length_unlimited": false, "sort": 1, "status": "published", "status_formatted": "Published", "created_at": "2021-05-24T14:15:06.000000Z", "updated_at": "2021-06-24T14:44:38.000000Z", "test_mode": false } } ``` ``` -------------------------------- ### List Orders via cURL Source: https://docs.lemonsqueezy.com/api/orders/list-all-orders Demonstrates how to retrieve a list of orders using the cURL command-line tool. Includes examples for fetching all orders and filtering by user email. ```bash curl "https://api.lemonsqueezy.com/v1/orders" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` ```bash curl "https://api.lemonsqueezy.com/v1/orders?filter[user_email]=johndoe@example.com" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### Order Refund Response Example Source: https://docs.lemonsqueezy.com/api/orders/issue-refund This is an example of the JSON response received after successfully issuing a refund for an order. It includes updated attributes such as 'refunded_amount' and 'refunded_at'. ```json { "type": "orders", "id": "1", "attributes": { "store_id": 1, "customer_id": 1, "identifier": "104e18a2-d755-4d4b-80c4-a6c1dcbe1c10", "order_number": 1, "user_name": "John Doe", "user_email": "johndoe@example.com", "currency": "USD", "currency_rate": "1.0000", "subtotal": 999, "setup_fee": 999, "discount_total": 0, "tax": 200, "total": 1199, "refunded_amount": 100, "subtotal_usd": 999, "setup_fee_usd": 999, "discount_total_usd": 0, "tax_usd": 200, "total_usd": 1199, "refunded_amount_usd": 100, "tax_name": "VAT", "tax_rate": "20.00", "tax_inclusive": false, "status": "paid", "status_formatted": "Paid", "refunded": false, "refunded_at": null, "subtotal_formatted": "$9.99", "setup_fee_formatted": "$9.99", "discount_total_formatted": "$0.00", "tax_formatted": "$2.00", "total_formatted": "$11.99", "refunded_amount_formatted": "$1.00", "first_order_item": { "id": 1, "order_id": 1, "product_id": 1, "variant_id": 1, "product_name": "Test Limited License for 2 years", "variant_name": "Default", "price": 1199, "created_at": "2021-08-17T09:45:53.000000Z", "updated_at": "2021-08-17T09:45:53.000000Z", "test_mode": false }, "urls": { "receipt": "https://app.lemonsqueezy.com/my-orders/104e18a2-d755-4d4b-80c4-a6c1dcbe1c10?signature=8847fff02e1bfb0c7c43ff1cdf1b1657a8eed2029413692663b86859208c9f42" }, "created_at": "2021-08-17T09:45:53.000000Z", "updated_at": "2021-08-17T09:45:53.000000Z", "test_mode": false } } ``` -------------------------------- ### List All Discounts (cURL) Source: https://docs.lemonsqueezy.com/api/discounts/list-all-discounts This cURL command demonstrates how to fetch a paginated list of all discounts. It includes necessary headers for authentication and content type. An optional query parameter `filter[store_id]` can be added to retrieve discounts for a specific store. ```bash curl "https://api.lemonsqueezy.com/v1/discounts" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` ```bash curl "https://api.lemonsqueezy.com/v1/discounts?filter[store_id]=1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### Fetch Stores using cURL Source: https://docs.lemonsqueezy.com/api/getting-started/responses Example of how to fetch a list of stores from the Lemon Squeezy API using cURL. It demonstrates the necessary headers for authentication and content type, and shows a typical JSON:API compliant response structure. ```bash curl "https://api.lemonsqueezy.com/v1/stores" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### List All Usage Records (cURL) Source: https://docs.lemonsqueezy.com/api/usage-records/list-all-usage-records Demonstrates how to list all usage records using cURL. It shows the basic request structure and how to include authentication headers. ```bash curl "https://api.lemonsqueezy.com/v1/usage-records" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### GET /v1/affiliates/:id Source: https://docs.lemonsqueezy.com/api/affiliates/retrieve-affiliate Retrieves the affiliate with the given ID. This endpoint allows you to get detailed information about a specific affiliate, including their earnings, status, and other relevant data. ```APIDOC ## GET /v1/affiliates/:id ### Description Retrieves the affiliate with the given ID. ### Method GET ### Endpoint /v1/affiliates/:id ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the affiliate to retrieve. ### Request Example ```bash curl "https://api.lemonsqueezy.com/v1/affiliates/1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` ### Response #### Success Response (200) - **jsonapi** (object) - JSON API version information. - **links** (object) - Links related to the affiliate resource. - **data** (object) - Contains the affiliate object with its attributes and relationships. - **type** (string) - The resource type, always 'affiliates'. - **id** (string) - The unique identifier of the affiliate. - **attributes** (object) - Key-value pairs of affiliate details. - **store_id** (integer) - The ID of the store the affiliate belongs to. - **user_id** (integer) - The ID of the user associated with the affiliate. - **user_name** (string) - The username of the affiliate. - **user_email** (string) - The email address of the affiliate. - **share_domain** (string) - The domain used for affiliate sharing. - **status** (string) - The current status of the affiliate (e.g., 'active'). - **products** (null) - Placeholder for product information (currently null). - **application_note** (string) - A note from the affiliate regarding their application. - **total_earnings** (integer) - The total earnings of the affiliate in cents. - **unpaid_earnings** (integer) - The current unpaid earnings of the affiliate in cents. - **created_at** (string) - The timestamp when the affiliate was created. - **updated_at** (string) - The timestamp when the affiliate was last updated. - **relationships** (object) - Relationships to other resources like store and user. #### Response Example ```json { "jsonapi": { "version": "1.0" }, "links": { "self": "https://api.lemonsqueezy.com/v1/affiliates/1" }, "data": { "type": "affiliates", "id": "1", "attributes": { "store_id": 1, "user_id": 2, "user_name": "John Doe", "user_email": "johndoe@example.com", "share_domain": "example.com", "status": "active", "products": null, "application_note": "I'm a digital content creator and marketer promoting B2B solutions via my newsletter", "total_earnings": 169550, "unpaid_earnings": 132000, "created_at": "2023-11-22T04:12:50.000000Z", "updated_at": "2023-11-22T04:12:50.000000Z" }, "relationships": { "store": { "links": { "related": "https://api.lemonsqueezy.com/v1/affiliates/1/store", "self": "https://api.lemonsqueezy.com/v1/affiliates/1/relationships/store" } }, "user": { "links": { "related": "https://api.lemonsqueezy.com/v1/affiliates/1/user", "self": "https://api.lemonsqueezy.com/v1/affiliates/1/relationships/user" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/affiliates/1" } } } ``` ``` -------------------------------- ### Create a standard discount via cURL Source: https://docs.lemonsqueezy.com/api/discounts/create-discount This snippet demonstrates how to create a basic percentage-based discount using the Lemon Squeezy API. It requires an API key for authorization and specifies the store ID in the relationships object. ```shell curl -X "POST" "https://api.lemonsqueezy.com/v1/discounts" \ -H "Accept: application/vnd.api+json" \ -H "Content-Type: application/vnd.api+json" \ -H "Authorization: Bearer {api_key}" \ -d '{ "data": { "type": "discounts", "attributes": { "name": "10% Off", "code": "10PERCENT", "amount": 10, "amount_type": "percent" }, "relationships": { "store": { "data": { "type": "stores", "id": "1" } } } } }' ``` -------------------------------- ### GET /v1/subscription-items/:id Source: https://docs.lemonsqueezy.com/api/subscription-items/retrieve-subscription-item Retrieves the subscription item with the given ID. This endpoint allows you to get detailed information about a specific subscription item, including its quantity, associated subscription and price, and creation/update timestamps. ```APIDOC ## GET /v1/subscription-items/:id ### Description Retrieves the subscription item with the given ID. ### Method GET ### Endpoint /v1/subscription-items/:id ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the subscription item to retrieve. ### Request Example ```bash curl "https://api.lemonsqueezy.com/v1/subscription-items/1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` ### Response #### Success Response (200) - **data** (object) - The subscription item object. - **type** (string) - The resource type, always "subscription-items". - **id** (string) - The unique identifier of the subscription item. - **attributes** (object) - Contains the subscription item's properties. - **subscription_id** (integer) - The ID of the associated subscription. - **price_id** (integer) - The ID of the associated price. - **quantity** (integer) - The quantity of the item in the subscription. - **is_usage_based** (boolean) - Indicates if the item is usage-based. - **created_at** (string) - The timestamp when the subscription item was created. - **updated_at** (string) - The timestamp when the subscription item was last updated. - **relationships** (object) - Contains links to related resources. - **subscription** (object) - Link to the associated subscription. - **price** (object) - Link to the associated price. - **usage-records** (object) - Link to associated usage records. #### Response Example ```json { "jsonapi": { "version": "1.0" }, "links": { "self": "https://api.lemonsqueezy.com/v1/subscription-item/1" }, "data": { "type": "subscription-items", "id": "1", "attributes": { "subscription_id": 1, "price_id": 1, "quantity": 1, "is_usage_based": false, "created_at": "2023-07-18T12:16:24.000000Z", "updated_at": "2023-07-18T12:16:24.000000Z" }, "relationships": { "subscription": { "links": { "related": "https://api.lemonsqueezy.com/v1/subscription-items/1/subscription", "self": "https://api.lemonsqueezy.com/v1/subscription-items/1/relationships/subscription" } }, "price": { "links": { "related": "https://api.lemonsqueezy.com/v1/subscription-items/1/price", "self": "https://api.lemonsqueezy.com/v1/subscription-items/1/relationships/price" } }, "usage-records": { "links": { "related": "https://api.lemonsqueezy.com/v1/subscription-items/1/usage-records", "self": "https://api.lemonsqueezy.com/v1/subscription-items/1/relationships/usage-records" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/subscription-items/1" } } } ``` ``` -------------------------------- ### Activate a License Key via cURL Source: https://docs.lemonsqueezy.com/api/license-api/activate-license-key Sends a POST request to the Lemon Squeezy API to activate a specific license key. Requires the license_key and instance_name parameters. ```bash curl -X POST https://api.lemonsqueezy.com/v1/licenses/activate \ -H "Accept: application/json" \ -d "license_key=38b1460a-5104-4067-a91d-77b872934d51" \ -d "instance_name=Test" ``` -------------------------------- ### Example API Response for Checkouts Source: https://docs.lemonsqueezy.com/api/checkouts/list-all-checkouts This is an example of the JSON response received when listing checkouts via the Lemonsqueezy API. It includes pagination details, API version information, links for navigation, and a data array containing checkout objects with their attributes and relationships. ```json { "meta": { "page": { "currentPage": 1, "from": 1, "lastPage": 1, "perPage": 10, "to": 10, "total": 10 } }, "jsonapi": { "version": "1.0" }, "links": { "first": "https://api.lemonsqueezy.com/v1/checkouts?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt", "last": "https://api.lemonsqueezy.com/v1/checkouts?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt" }, "data": [ { "type": "checkouts", "id": "ac470bd4-7c41-474d-b6cd-0f296f5be02a", "attributes": { "store_id": 1, "variant_id": 1, "custom_price": null, "product_options": { "name": "", "description": "", "media": [], "redirect_url": "", "receipt_button_text": "", "receipt_link_url": "", "receipt_thank_you_note": "", "enabled_variants": [] }, "checkout_options": { "embed": false, "media": true, "logo": true, "desc": true, "discount": true, "skip_trial": true, "dark": false, "subscription_preview": true, "button_color": "#7047EB" }, "checkout_data": { "email": "", "name": "", "billing_address": [], "tax_number": "", "discount_code": "", "custom": [], "variant_quantities": [] }, "expires_at": null, "created_at": "2022-10-14T12:36:27.000000Z", "updated_at": "2022-10-14T12:36:27.000000Z", "test_mode": false, "url": "https://my-store.lemonsqueezy.com/checkout/custom/ac470bd4-7c41-474d-b6cd-0f296f5be02a?signature=ee3fd20c5bac48fe5e976cb106e743bc3f6f330540f8003ab331d638e2ce3b8b" }, "relationships": { "store": { "links": { "related": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/store", "self": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/relationships/store" } }, "variant": { "links": { "related": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/variant", "self": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a/relationships/variant" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/checkouts/ac470bd4-7c41-474d-b6cd-0f296f5be02a" } }, {...}, {...}, ] } ``` -------------------------------- ### GET /v1/stores Source: https://docs.lemonsqueezy.com/api/getting-started/responses Retrieves a list of stores associated with the authenticated account. ```APIDOC ## GET /v1/stores ### Description Retrieves a list of stores associated with the authenticated account. This endpoint returns a collection of store resources. ### Method GET ### Endpoint https://api.lemonsqueezy.com/v1/stores ### Parameters #### Query Parameters - **page[number]** (integer) - Optional - The page number to retrieve. - **page[size]** (integer) - Optional - The number of resources per page. - **sort** (string) - Optional - Field to sort the results by. ### Request Example curl "https://api.lemonsqueezy.com/v1/stores" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ### Response #### Success Response (200) - **data** (array) - A list of store resource objects. - **meta** (object) - Pagination metadata. #### Response Example { "data": [ { "type": "stores", "id": "1", "attributes": { "name": "My Store", "slug": "my-store", "currency": "USD" } } ] } ``` -------------------------------- ### GET /v1/webhooks/:id Source: https://docs.lemonsqueezy.com/api/webhooks/retrieve-webhook Retrieves the details of a specific webhook by its unique ID. ```APIDOC ## GET /v1/webhooks/:id ### Description Retrieves the webhook with the given ID from your Lemon Squeezy account. ### Method GET ### Endpoint https://api.lemonsqueezy.com/v1/webhooks/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the webhook to retrieve. ### Request Example curl "https://api.lemonsqueezy.com/v1/webhooks/1" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ### Response #### Success Response (200) - **data** (object) - The Webhook object containing store_id, url, events, and timestamps. #### Response Example { "jsonapi": { "version": "1.0" }, "data": { "type": "webhooks", "id": "1", "attributes": { "store_id": 1, "url": "https://mysite.com/webhooks/", "events": ["order_created", "subscription_created"], "test_mode": false } } } ``` -------------------------------- ### Create Customer Request (cURL) Source: https://docs.lemonsqueezy.com/api/customers/create-customer This snippet demonstrates how to create a customer using a cURL command. It sends a POST request to the /v1/customers endpoint with customer details in the request body. Ensure you replace {api_key} with your actual API key. ```bash curl -X "POST" "https://api.lemonsqueezy.com/v1/customers" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' \ -d $'{ "data": { "type": "customers", "attributes": { "name": "John Doe", "email": "johndoe@example.com", "city": "New York", "region": "NY", "country": "US" }, "relationships": { "store": { "data": { "type": "stores", "id": "1" } } } } }' ``` -------------------------------- ### Authenticated API Request Example (cURL) Source: https://docs.lemonsqueezy.com/api/getting-started/requests Demonstrates how to make an authenticated request to the /v1/users/me endpoint using cURL. It includes the necessary Accept, Content-Type, and Authorization headers for proper authentication with an API key. ```bash curl "https://api.lemonsqueezy.com/v1/users/me" \ -H 'Accept: application/vnd.api+json' \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer {api_key}' ``` -------------------------------- ### GET /stores/{id} Source: https://docs.lemonsqueezy.com/api/stores Retrieves the details of a specific store by its unique identifier. ```APIDOC ## GET /stores/{id} ### Description Retrieves a single store object by its unique ID. This object contains all relevant metadata, billing information, and performance metrics for the store. ### Method GET ### Endpoint /stores/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the store. ### Response #### Success Response (200) - **type** (string) - The resource type (stores). - **id** (string) - The store ID. - **attributes** (object) - The collection of store attributes including name, slug, domain, and revenue metrics. #### Response Example { "type": "stores", "id": "1", "attributes": { "name": "My Store", "slug": "my-store", "domain": "my-store.lemonsqueezy.com", "url": "https://my-store.lemonsqueezy.com", "avatar_url": "https://app.lemonsqueezy.com/storage/avatars/stores/1/czTkMkDm4Vfb8PZehb5c29XFCm9JZyJx0AjEZP7s.png", "plan": "fresh", "country": "US", "country_nicename": "United States", "currency": "USD", "total_sales": 1, "total_revenue": 999, "thirty_day_sales": 0, "thirty_day_revenue": 0, "created_at": "2024-05-24T14:15:06.000000Z", "updated_at": "2024-06-15T10:03:14.000000Z" } } ``` -------------------------------- ### Including Related Resources Source: https://docs.lemonsqueezy.com/api/getting-started/requests Demonstrates how to use the `include` query parameter to fetch related resources, such as Variants for a Product, in a single API call. ```APIDOC ## GET /v1/products/{id} ### Description Retrieves a specific product and optionally includes related resources like variants. ### Method GET ### Endpoint `/v1/products/{id}` ### Query Parameters - **include** (string) - Optional - Comma-separated list of related resources to include (e.g., `variants`). ### Request Example ``` GET /v1/products/100?include=variants ``` ### Response #### Success Response (200) - **data** (array) - The primary resource data. - **included** (array) - An array containing related resources. #### Response Example ```json { "meta": {}, "jsonapi": {}, "links": {}, "data": [ {...} ], "included": [ { "type": "variants", "id": "1", "attributes": { "product_id": 1, "name": "Default", "slug": "537b22ba-fcc9-452a-9021-c3cabe3985cf", "description": "

This is the variant description.

", "price": 999, "is_subscription": true, "interval": "month", "interval_count": 1, "has_free_trial": false, "trial_interval": "day", "trial_interval_count": 30, "pay_what_you_want": false, "min_price": 0, "suggested_price": 0, "has_license_keys": false, "license_activation_limit": 5, "is_license_limit_unlimited": false, "license_length_value": 1, "license_length_unit": "years", "is_license_length_unlimited": false, "sort": 0, "status": "pending", "status_formatted": "Pending", "created_at": "2021-05-27T12:54:47.000000Z", "updated_at": "2021-07-14T11:25:24.000000Z", "test_mode": false }, "relationships": { "product": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/1/product", "self": "https://api.lemonsqueezy.com/v1/variants/1/relationships/product" } }, "files": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/1/files", "self": "https://api.lemonsqueezy.com/v1/variants/1/relationships/files" } }, "price-model": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/1/price-model", "self": "https://api.lemonsqueezy.com/v1/variants/1/relationships/price-model" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/variants/1" } }, {...}, {...} ] } ``` ```