---
title: "Record affiliate transaction"
method: POST
path: "/campaign/{id}/participant/{participantIdOrEmail}/transaction"
tags: ["Affiliate Programs"]
---

# Record affiliate transaction

`POST /campaign/{id}/participant/{participantIdOrEmail}/transaction`

## Request

- Base URL: `https://api.growsurf.com/v2`
- URL: `https://api.growsurf.com/v2/campaign/{id}/participant/{participantIdOrEmail}/transaction`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/growsurf/apis/growsurf-rest-api/docs/campaign/:id/participant/:participantIdOrEmail/transaction/post.ts> (a function with typed inputs; its response is checked against the schema)

Records a sale made by a referred customer and generates affiliate commissions for their referrer when applicable.

## Path parameters

- `id` string, required
- `participantIdOrEmail` string, required

## Request body

- RecordTransactionRequest
  - `currency` string, required
  - `grossAmount` integer, required
  - `netAmount` integer
  - `taxAmount` integer
  - `amountCashNet` integer
  - `amountPaid` integer
  - `paidAt` integer
  - `externalId` string
  - `transactionId` string
  - `customerId` string
  - `orderId` string
  - `paymentId` string
  - `invoiceId` string
  - `subscriptionId` string
  - `paymentIntentId` string
  - `chargeId` string
  - `description` string
  - `invoiceTotal` integer
  - `invoiceTotalExcludingTax` integer
  - `invoiceSubtotalExcludingTax` integer
  - `totalTaxAmount` integer
  - `totalTaxAmounts` object[]
  - `totalTaxes` object[]

## Response `200`

Transaction result returned.

- union
  - object
    - `success` true, required
    - `firstSale` boolean, required
    - `duplicate` false, required
    - `message` string, required
  - object
    - `success` false, required
    - `duplicate` true, required
    - `commissionsCreated` integer, required
    - `duplicateFields` string[], required
    - `matchingCommissionIds` string[], required
    - `message` string, required

## Other responses

- `400`: Invalid request.
- `401`: Authorization is missing or invalid.
- `403`: The API key is not allowed to perform this action.
- `404`: Resource not found.
- `422`: Request is not valid for the current program or participant state.
- `429`: Too many requests.

---

[API](https://skmtc.dev/growsurf/apis/growsurf-rest-api.md) - [All operations](https://skmtc.dev/growsurf/apis/growsurf-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/growsurf/apis/growsurf-rest-api/revisions/26f06e273394?raw)
