> ## Documentation Index
> Fetch the complete documentation index at: https://docs.partnero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Referral transactions

> Track transactions from referred customers in refer-a-friend programs

Track purchases made by referred customers to calculate rewards for referring customers.

<Note>
  In refer-a-friend programs, response fields use `customer` (referring customer) and `referred_customer` instead of `partner` and `customer` used in affiliate programs.
</Note>

## Create transaction

```
POST https://api.partnero.com/v1/transactions
```

### Request body

| Parameter        | Type   | Required | Description                                             |
| ---------------- | ------ | -------- | ------------------------------------------------------- |
| `key`            | string | No       | Unique transaction ID (recommended for refund handling) |
| `amount`         | number | Yes      | Transaction amount                                      |
| `amount_units`   | string | No       | Currency code (e.g., `USD`, `EUR`)                      |
| `action`         | string | No       | Transaction type (e.g., `sale`)                         |
| `customer.id`    | string | Yes\*    | Referred customer's ID                                  |
| `customer.email` | string | Yes\*    | Referred customer's email (alternative to ID)           |
| `customer.key`   | string | Yes\*    | Referred customer's key (alternative to ID)             |

\*Provide at least one customer identifier.

### Request

```bash cURL theme={null}
curl --location 'https://api.partnero.com/v1/transactions' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "customer": {
      "id": "customer_456"
    },
    "key": "transaction_123",
    "amount": 99.99,
    "action": "sale"
  }'
```

### Response

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "data": {
      "key": "transaction_123",
      "action": "sale",
      "amount": 99.99,
      "customer": "customer_123",
      "referred_customer": "customer_456",
      "credit": false,
      "is_currency": true,
      "amount_units": "USD",
      "created_at": "2025-05-12T15:43:55.000000Z",
      "rewards": []
    },
    "status": 1
  }
  ```
</ResponseExample>

### Response fields

| Field               | Type    | Description                          |
| ------------------- | ------- | ------------------------------------ |
| `key`               | string  | Transaction identifier               |
| `action`            | string  | Transaction type                     |
| `amount`            | number  | Transaction amount                   |
| `amount_units`      | string  | Currency code                        |
| `customer`          | string  | Referring customer's identifier      |
| `referred_customer` | string  | Referred customer's identifier       |
| `credit`            | boolean | Whether this is a credit transaction |
| `is_currency`       | boolean | Whether the amount is monetary       |
| `rewards`           | array   | Associated rewards                   |
| `created_at`        | string  | ISO 8601 timestamp                   |

## List transactions

```
GET https://api.partnero.com/v1/transactions
```

| Parameter | Type    | Default | Description              |
| --------- | ------- | ------- | ------------------------ |
| `limit`   | integer | 15      | Results per page (1–250) |
| `page`    | integer | 1       | Page number              |

```bash cURL theme={null}
curl --location 'https://api.partnero.com/v1/transactions' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Get transaction

```
GET https://api.partnero.com/v1/transactions/{key}
```

```bash cURL theme={null}
curl --location 'https://api.partnero.com/v1/transactions/transaction_123' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Delete transaction

```
DELETE https://api.partnero.com/v1/transactions/{key}
```

<Warning>
  Deleting a transaction is permanent and will also remove any rewards earned by the referring customer.
</Warning>

```bash cURL theme={null}
curl --location --request DELETE 'https://api.partnero.com/v1/transactions/transaction_123' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```
