Record Sale
growsurf_record_saleRecord an affiliate sale or transaction and de-duplicate repeat calls using a transaction ID. Reuse the same ID for refunds; listen to webhooks for commission updates.
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. 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 | ||
| 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. |