Track Payment
track_paymentRecord payments, refunds, and renewals, attributing revenue to visitors using identifiers. Use for accurate revenue tracking and goal completion.
Instructions
Record a payment so revenue appears in get_overview, get_timeseries, and the visitor profile. Skip it when the site's provider (Stripe, LemonSqueezy, Polar, and other connected providers) is tracked automatically; use track_goal for conversions without revenue. transactionId must be unique: a repeated id is rejected, not deduplicated. A new payment also records a payment goal completion (free_trial when amount is 0); isRenewal skips that. isRefund with an existing transactionId marks that payment refunded by amount instead of adding a row. Attribution looks up a known visitor by visitorUid, customerId, or email; with no match the revenue is kept but its source shows as Unknown. Requires websiteId or domain with a workspace token.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Customer name | |
| No | Customer email | ||
| amount | Yes | Payment amount in major currency units (e.g. 29.99). With isRefund, the amount refunded. 0 records a free_trial goal instead of a payment goal. | |
| domain | No | Website domain from list_websites (e.g. "example.com"). Alternative to websiteId with a workspace token. | |
| currency | Yes | Currency code (e.g. "USD", "EUR") | |
| isRefund | No | True to record a refund. With an existing transactionId, marks that payment refunded by amount instead of creating a new record. | |
| isRenewal | No | True for recurring/renewal charges. Renewals are counted in revenue but do not record the automatic payment goal. | |
| websiteId | No | Website ID from list_websites. Required with a workspace token unless domain is given; ignored with a website key. | |
| customerId | No | Customer ID from the payment provider. Also used to find the visitor when visitorUid is absent. | |
| sessionUid | No | Session ID for the current visitor session | |
| visitorUid | No | Visitor UID from the _fs_vid cookie. Strongly recommended: without it (or customerId/email matching a known visitor) the payment is attributed to Unknown | |
| transactionId | Yes | Unique transaction ID from your payment provider. Must not repeat across payments; reuse it only with isRefund to mark that payment refunded. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | No | Object with status and data: a confirmation message once the payment is stored. |