growsurf_record_sale
Log a sale for an affiliate program using a unique transaction ID to de-duplicate and avoid double-paying referrers, then capture commissions via webhooks.
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 | ||
| 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 | ||
| 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. |