---
title: "Records a payout made to an affiliate."
---

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

Path: Sherpo merchant API › affiliate

`POST /v1/stores/{store}/affiliate_payouts`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `affiliate:write`

## Path parameters

- `store` (`recordAffiliatePayout.path.store`; string, required) — The store's id.

## Header parameters

- `Idempotency-Key` (`recordAffiliatePayout.header.Idempotency-Key`; string, optional) — Repeats within 24 hours answer the first result; the same key with other arguments is a conflict.
  - minLength 1; maxLength 255; pattern `^[\x21-\x7E]+$`

## Request body

_Required._

Any of:

- `object`
- `object`

## Example request

```json
{
  "user": {
    "id": "string"
  },
  "currency": "str",
  "commissions": [
    {
      "settlement": {
        "id": "string"
      },
      "order_item": {
        "id": "string"
      }
    }
  ],
  "kind": "paid",
  "amount": 0,
  "processor": "stripe",
  "processor_ref": "string",
  "reason": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/affiliate_payouts' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user": {
    "id": "string"
  },
  "currency": "str",
  "commissions": [
    {
      "settlement": {
        "id": "string"
      },
      "order_item": {
        "id": "string"
      }
    }
  ],
  "kind": "paid",
  "amount": 0,
  "processor": "stripe",
  "processor_ref": "string",
  "reason": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/affiliate_payouts';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    user: {id: 'string'},
    currency: 'str',
    commissions: [{settlement: {id: 'string'}, order_item: {id: 'string'}}],
    kind: 'paid',
    amount: 0,
    processor: 'stripe',
    processor_ref: 'string',
    reason: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/affiliate_payouts"

payload = {
    "user": { "id": "string" },
    "currency": "str",
    "commissions": [
        {
            "settlement": { "id": "string" },
            "order_item": { "id": "string" }
        }
    ],
    "kind": "paid",
    "amount": 0,
    "processor": "stripe",
    "processor_ref": "string",
    "reason": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Records a payout made to an affiliate.

#### Example

```json
{
  "commissions": 0,
  "id": "string",
  "user_id": "string",
  "currency": "string",
  "exponent": 0,
  "kind": "string",
  "amount": 0,
  "processor": "string",
  "processor_ref": "string",
  "reason": "string",
  "occurred_at": "string",
  "recorded_at": "string"
}
```

- `commissions` (`recordAffiliatePayout.response.201.commissions`; number, required)
- `id` (`recordAffiliatePayout.response.201.id`; string, required)
- `user_id` (`recordAffiliatePayout.response.201.user_id`; string, required)
- `currency` (`recordAffiliatePayout.response.201.currency`; string, required)
- `exponent` (`recordAffiliatePayout.response.201.exponent`; any of, required)
  - any of: `number`, `null`
- `kind` (`recordAffiliatePayout.response.201.kind`; string, required)
- `amount` (`recordAffiliatePayout.response.201.amount`; any of, required)
  - any of: `number`, `null`
- `processor` (`recordAffiliatePayout.response.201.processor`; any of, required)
  - any of: `string`, `null`
- `processor_ref` (`recordAffiliatePayout.response.201.processor_ref`; any of, required)
  - any of: `string`, `null`
- `reason` (`recordAffiliatePayout.response.201.reason`; any of, required)
  - any of: `string`, `null`
- `occurred_at` (`recordAffiliatePayout.response.201.occurred_at`; any of, required)
  - any of: `string`, `null`
- `recorded_at` (`recordAffiliatePayout.response.201.recorded_at`; any of, required)
  - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`recordAffiliatePayout.response.default.type`; string, required)
  - format `uri`
- `title` (`recordAffiliatePayout.response.default.title`; string, required)
- `status` (`recordAffiliatePayout.response.default.status`; integer, required)
- `detail` (`recordAffiliatePayout.response.default.detail`; string, required)
- `code` (`recordAffiliatePayout.response.default.code`; string, optional)
- `context` (`recordAffiliatePayout.response.default.context`; object, optional)
- `reached_core` (`recordAffiliatePayout.response.default.reached_core`; boolean, optional)
- `core_answer` (`recordAffiliatePayout.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/record-affiliate-payout/index.md
