Record Sale
growsurf_record_saleRecord an affiliate-program sale with a unique transaction identifier to deduplicate repeat submissions and prevent double-paying the referrer; optionally target a campaign.
Instructions
Record a sale/transaction for an affiliate program. Use webhooks to know when commissions are added. Requires at least one transaction identifier (externalId, transactionId, orderId, paymentId, invoiceId, paymentIntentId, or chargeId) so repeated calls are de-duplicated instead of double-paying the referrer; reuse the same one when refunding. Targets campaignId if you pass it, otherwise GROWSURF_CAMPAIGN_ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paidAt | No | When the payment was captured or settled, as a Unix timestamp in milliseconds. | |
| orderId | No | ||
| chargeId | No | ||
| currency | Yes | 3-letter ISO 4217 currency code for the sale. A sale in another currency is converted to the program currency. | |
| testMode | No | Required with `paymentProvider`: `true` for test or `false` for live. Otherwise omit. | |
| invoiceId | No | ||
| netAmount | No | ||
| paymentId | No | ||
| taxAmount | No | ||
| amountPaid | No | ||
| campaignId | Yes | Target program id for this call: the `id` returned by `growsurf_list_campaigns`, not the program name or a share URL. Defaults to GROWSURF_CAMPAIGN_ID when omitted. Program IDs also identify newly created programs without restarting the server. | |
| customerId | No | ||
| externalId | No | ||
| totalTaxes | No | ||
| description | No | ||
| grossAmount | Yes | ||
| invoiceTotal | No | ||
| amountCashNet | No | ||
| participantId | No | ||
| transactionId | No | Transaction identifier to store for this sale. Used to detect duplicate submissions. | |
| subscriptionId | No | ||
| totalTaxAmount | No | ||
| paymentIntentId | No | ||
| paymentProvider | No | Connected provider for this payment. Requires `transactionId` and `testMode`. Supply matching `grossAmount` and `currency`; other payment IDs and tax or net-amount overrides are not accepted. GrowSurf reads payment details from the provider and detects duplicate webhook/API/manual submissions. | |
| totalTaxAmounts | No | ||
| participantEmail | No | ||
| invoiceTotalExcludingTax | No | ||
| invoiceSubtotalExcludingTax | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | Human-readable result message. | |
| success | No | `true` when the sale was recorded; `false` when it matched an existing transaction. | |
| duplicate | No | `true` when the sale matched an existing transaction. | |
| firstSale | No | Whether this was the referred customer's first recorded sale. | |
| duplicateFields | No | Identifier fields that matched an existing transaction. | |
| commissionsCreated | No | Commissions created by this duplicate request. | |
| matchingCommissionIds | No | Commission ids that matched the submitted identifiers. |