> ## 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.

## 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={"system"}
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

```json 200 OK theme={"system"}
{
  "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
}
```

### 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 | 10 | Results per page (10-100) |
| `page` | integer | 1 | Page number |

```bash cURL theme={"system"}
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={"system"}
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.

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.