growsurf_record_sale
Record affiliate sales and transactions with a unique identifier to prevent duplicate commission payouts.
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 | ||
| orderId | No | ||
| chargeId | No | ||
| currency | Yes | ||
| 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 | No | Target program (campaign) id for this call. Defaults to GROWSURF_CAMPAIGN_ID when omitted. Pass the `id` returned by growsurf_create_campaign to configure or operate a program you just created, without restarting the server. | |
| customerId | No | ||
| externalId | No | ||
| totalTaxes | No | ||
| description | No | ||
| grossAmount | Yes | ||
| invoiceTotal | No | ||
| amountCashNet | No | ||
| participantId | No | ||
| transactionId | No | ||
| 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. |