Linking Lemon Squeezy as a source
This source is currently in alpha. The interface and available tables may change.
The Lemon Squeezy connector syncs your merchant-of-record data – stores, orders, subscriptions, customers, license keys, discounts, and more – into PostHog, so you can analyze revenue alongside your product data.
Prerequisites
You need a Lemon Squeezy account and an API key. Note that Lemon Squeezy API keys expire after one year, and test-mode keys only return test-mode data.
Adding a data source
- In PostHog, go to the Sources tab of the data pipeline section.
- Click + New source and click Link next to this source.
- Enter your credentials (see Configuration below) and click Next.
- Select the tables you want to sync, choose a sync method and frequency, then click Import.
Once the syncs are complete, you can start querying this data in PostHog.
When linking Lemon Squeezy, you'll need:
- API key – in your Lemon Squeezy dashboard, go to Settings > API and click + to create a new API key. Use a live-mode key to sync your production data.
Sync modes
Each table can be synced in one of several modes, depending on what the source supports:
- Webhook (when available) – the source pushes changes to PostHog in real time. Fastest freshness, lowest ongoing cost, and the only mode that reliably captures updates and deletes.
- Incremental – only new or updated rows are synced on each run, using a cursor field (such as an
updated_attimestamp). Cheaper than a full refresh, but deletes aren't captured. - Append only – new rows are appended using a cursor field; existing rows are never updated. Ideal for immutable, append-only tables like event logs.
- Full refresh – the whole table is reloaded on every sync. Use it when a table has no reliable cursor or when you need deletions reflected.
See sync methods for a full explanation of how each mode works and how to choose between them.
Lemon Squeezy's API doesn't expose an "updated since" filter, so full refresh is the default for mutable tables (subscriptions, customers, license keys). Append-mostly tables (orders, order items, subscription invoices, discount redemptions, usage records) support incremental sync on created_at. For real-time updates to orders, subscriptions, subscription invoices, and license keys, enable webhook syncing.
Setting up webhooks for real-time syncing
Orders, subscriptions, subscription invoices, and license keys can also sync via webhooks: Lemon Squeezy pushes each event to PostHog the moment it happens, which is the only mode that captures updates to existing rows (like a subscription changing status) without a full refresh.
To enable it, open your source and go to the Webhook tab, then click Create webhook. PostHog registers a webhook on each of your Lemon Squeezy stores using your API key, with a generated signing secret used to verify every delivery.
If automatic creation fails, you can create the webhook manually in Settings > Webhooks: paste the webhook URL PostHog shows you, set a signing secret (6-40 characters), select the order, subscription, subscription payment, and license key events, and save. Then paste the same signing secret into PostHog.
Configuration
| Option | Description |
|---|---|
API keyType: password Required: True | Create an API key under Settings > API. Keys expire after one year — you'll need to reconnect with a fresh key when it does. |
Supported tables
| Table | Description | Sync method | Incremental field | Primary key |
|---|---|---|---|---|
stores | A store you sell products from, including its plan, currency, and lifetime sales totals. | Full refresh | — | — |
customers | A customer of your store, with their contact details, marketing status, and revenue metrics. | Full refresh | — | — |
products | A sellable product in a store; each product has one or more variants. | Full refresh | — | — |
variants | A purchasable variant of a product, carrying subscription, trial, and license key settings. | Full refresh | — | — |
prices | A price attached to a variant, including historical prices kept after a variant's price changes. | Full refresh | — | — |
files | A downloadable file attached to a variant, delivered to customers after purchase. | Full refresh | — | — |
orders | A completed order, created every time a customer purchases from your store. | Webhook, Incremental, Full refresh | created_at | — |
order_items | A line item of an order, recording the product and variant purchased and the price paid. | Incremental, Full refresh | created_at | — |
subscriptions | A recurring subscription created when a customer purchases a subscription variant. | Webhook, Full refresh | — | — |
subscription_invoices | An invoice generated each time a subscription payment is attempted, successful or not. | Webhook, Incremental, Full refresh | created_at | — |
subscription_items | The link between a subscription and the price it is billed at, with the quantity purchased. | Full refresh | — | — |
usage_records | A unit-usage report against a usage-based subscription item, used to calculate the next bill. | Incremental, Full refresh | created_at | — |
discounts | A discount code that customers can apply at checkout. | Full refresh | — | — |
discount_redemptions | A single redemption of a discount code against an order. | Incremental, Full refresh | created_at | — |
license_keys | A software license key generated when a customer purchases a license-enabled variant. | Webhook, Full refresh | — | — |
license_key_instances | A device/instance activation of a license key, created via the License API activate endpoint. | Full refresh | — | — |
checkouts | A custom checkout created via the API, with its product options and prefilled customer data. | Full refresh | — | — |
Troubleshooting
If syncs start failing with an authorization error, your API key has likely expired – Lemon Squeezy keys are valid for one year. Create a new key under Settings > API and update the source.
If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.