---
title: "Records an order paid outside the store, granting what it bought."
---

> 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 › transaction

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

## Authentication

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

## Path parameters

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

## Request body

_Required._

- `customer` (`recordOrder.customer`; any of, required) — By id, or by email: whoever the address reaches, else its invited customer.
  - any of: `object`, `object`
- `currency` (`recordOrder.currency`; string, required)
  - minLength 3; maxLength 3; pattern `^[A-Za-z]{3}$`
- `items` (`recordOrder.items`; array<object>, required)
  - `product` (`recordOrder.items.product`; any of, required)
    - any of: `object`, `object`
  - `amount` (`recordOrder.items.amount`; integer, required)
    - min 0
  - `tier` (`recordOrder.items.tier`; any of, optional) — The tier sold; the price's own when a price is named.
    - any of: `object`, `null`
  - `price` (`recordOrder.items.price`; any of, optional)
    - any of: `object`, `null`
  - `quantity` (`recordOrder.items.quantity`; integer, optional)
    - min 1; max 1000
  - `discount` (`recordOrder.items.discount`; integer, optional) — At most the line's amount.
    - min 0
  - `code` (`recordOrder.items.code`; any of, optional) — The discount code the line sold with, so a rule bound to it fires.
    - any of: `object`, `null`
- `source_key` (`recordOrder.source_key`; any of, optional) — The writer's own id for the sale, so a retried record is not a second order.
  - any of: `string`, `null`
- `note` (`recordOrder.note`; any of, optional) — Shown to the customer with their order.
  - any of: `string`, `null`
- `occurred_at` (`recordOrder.occurred_at`; any of, optional)
  - any of: `string`, `null`
- `grants` (`recordOrder.grants`; boolean, optional) — Whether each line grants its product from when the sale occurred; on unless said otherwise.

## Example request

```json
{
  "customer": {
    "id": "string"
  },
  "currency": "str",
  "items": [
    {
      "product": {
        "id": "string"
      },
      "tier": {
        "id": "string"
      },
      "price": {
        "id": "string"
      },
      "quantity": 1,
      "amount": 0,
      "discount": 0,
      "code": {
        "id": "string"
      }
    }
  ],
  "source_key": "string",
  "note": "string",
  "occurred_at": "string",
  "grants": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/orders' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer": {
    "id": "string"
  },
  "currency": "str",
  "items": [
    {
      "product": {
        "id": "string"
      },
      "tier": {
        "id": "string"
      },
      "price": {
        "id": "string"
      },
      "quantity": 1,
      "amount": 0,
      "discount": 0,
      "code": {
        "id": "string"
      }
    }
  ],
  "source_key": "string",
  "note": "string",
  "occurred_at": "string",
  "grants": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/orders';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    customer: {id: 'string'},
    currency: 'str',
    items: [
      {
        product: {id: 'string'},
        tier: {id: 'string'},
        price: {id: 'string'},
        quantity: 1,
        amount: 0,
        discount: 0,
        code: {id: 'string'}
      }
    ],
    source_key: 'string',
    note: 'string',
    occurred_at: 'string',
    grants: true
  })
};

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>/orders"

payload = {
    "customer": { "id": "string" },
    "currency": "str",
    "items": [
        {
            "product": { "id": "string" },
            "tier": { "id": "string" },
            "price": { "id": "string" },
            "quantity": 1,
            "amount": 0,
            "discount": 0,
            "code": { "id": "string" }
        }
    ],
    "source_key": "string",
    "note": "string",
    "occurred_at": "string",
    "grants": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Records an order paid outside the store, granting what it bought.

#### Example

```json
{
  "refunds_refused": [
    {
      "processor_ref": "string",
      "amount": 0,
      "pending": 0,
      "refused_at": "string"
    }
  ],
  "customer": {
    "id": "string",
    "name": "string",
    "email": "string",
    "phone": "string",
    "erased": true
  },
  "settled": 0,
  "refunded": 0,
  "revocable": true,
  "revocation": {
    "id": "string",
    "customer_id": "string",
    "order_id": "string",
    "grant_id": "string",
    "product_ids": [
      "string"
    ],
    "cause": "string",
    "note": "string",
    "message": "string",
    "refund": {
      "via": "string",
      "amount": 0,
      "currency": "string",
      "exponent": 0,
      "settlement_id": "string",
      "refund_id": "string",
      "status": "string"
    },
    "revoked_by": "string",
    "token_id": "string",
    "created_at": "string"
  },
  "failed_revocations": {
    "items": [
      {
        "id": "string",
        "customer_id": "string",
        "order_id": "string",
        "grant_id": "string",
        "product_ids": [
          "string"
        ],
        "cause": "string",
        "note": "string",
        "message": "string",
        "refund": {
          "via": "string",
          "amount": 0,
          "currency": "string",
          "exponent": 0,
          "settlement_id": "string",
          "refund_id": "string",
          "status": "string"
        },
        "revoked_by": "string",
        "token_id": "string",
        "created_at": "string"
      }
    ],
    "total": 0
  },
  "refund_status": "string",
  "lines": {
    "items": [
      {
        "product": {
          "id": "string",
          "slug": "string",
          "path": "string",
          "url": "string",
          "title": "string",
          "category": "string",
          "deleted": true
        },
        "guests": [
          {
            "id": "string",
            "status": "string",
            "customer_id": "string",
            "customer": {
              "id": "string",
              "name": "string",
              "email": "string",
              "phone": "string",
              "erased": true
            }
          }
        ],
        "revocable": true,
        "platform_fee": 0,
        "processor_fee": 0,
        "affiliate_fee": 0,
        "refunded": 0,
        "id": "string",
        "order_id": "string",
        "product_id": "string",
        "tier_id": "string",
        "price_id": "string",
        "position": 0,
        "quantity": 0,
        "currency": "string",
        "exponent": 0,
        "amount": 0,
        "discount": 0,
        "total": 0,
        "descriptor": {
          "product": "string",
          "price": "string",
          "tier": "string",
          "coupon": "string",
          "display_name": "string",
          "message": "string",
          "property1": true,
          "property2": true
        }
      }
    ],
    "total": 0
  },
  "settlements": {
    "items": [
      {
        "id": "string",
        "order_id": "string",
        "processor": "string",
        "processor_ref": "string",
        "account_ref": "string",
        "custodian": "string",
        "currency": "string",
        "exponent": 0,
        "amount": 0,
        "platform_fee": 0,
        "processor_fee": 0,
        "occurred_at": "string",
        "recorded_at": "string"
      }
    ],
    "total": 0
  },
  "refunds": {
    "items": [
      {
        "id": "string",
        "settlement_id": "string",
        "order_id": "string",
        "processor_ref": "string",
        "amount": 0,
        "currency": "string",
        "exponent": 0,
        "reason": "string",
        "occurred_at": "string",
        "recorded_at": "string"
      }
    ],
    "total": 0
  },
  "affiliates": {
    "items": [
      {
        "settlement_id": "string",
        "order_item_id": "string",
        "order_id": "string",
        "user_id": "string",
        "discount_id": "string",
        "currency": "string",
        "exponent": 0,
        "fee": 0,
        "resolution_id": "string"
      }
    ],
    "total": 0
  },
  "id": "string",
  "number": 0,
  "customer_id": "string",
  "currency": "string",
  "exponent": 0,
  "amount": 0,
  "discount": 0,
  "total": 0,
  "free": true,
  "fees": 0,
  "source": "string",
  "source_key": "string",
  "statements": {
    "coupon": "string",
    "customer_status": "string",
    "method": "string",
    "method_details": {
      "brand": "string",
      "last4": "string"
    },
    "refund_waiver": {
      "policy": "string",
      "accepted_at": "string"
    },
    "under_minimum": {
      "processor": "stripe",
      "minimum": 0,
      "amount": 0
    },
    "property1": true,
    "property2": true
  },
  "note": "string",
  "occurred_at": "string",
  "recorded_at": "string"
}
```

- `refunds_refused` (`recordOrder.response.201.refunds_refused`; array<object>, required)
  - `processor_ref` (`recordOrder.response.201.refunds_refused.processor_ref`; string, required)
  - `amount` (`recordOrder.response.201.refunds_refused.amount`; any of, required)
    - any of: `number`, `null`
  - `pending` (`recordOrder.response.201.refunds_refused.pending`; any of, required)
    - any of: `number`, `null`
  - `refused_at` (`recordOrder.response.201.refunds_refused.refused_at`; string, required)
- `customer` (`recordOrder.response.201.customer`; any of, required)
  - any of: `object`, `null`
- `settled` (`recordOrder.response.201.settled`; any of, required)
  - any of: `number`, `null`
- `refunded` (`recordOrder.response.201.refunded`; any of, required)
  - any of: `number`, `null`
- `revocable` (`recordOrder.response.201.revocable`; boolean, required) — Whether a revocation of the order would end anything: its customer's grants or running subscriptions on its products, or its guests' tickets.
- `revocation` (`recordOrder.response.201.revocation`; any of, required) — The latest revocation of its access for cause; null while none.
  - any of: `object`, `null`
- `failed_revocations` (`recordOrder.response.201.failed_revocations`; object, required)
  - `items` (`recordOrder.response.201.failed_revocations.items`; array<object>, required)
    - `id` (`recordOrder.response.201.failed_revocations.items.id`; string, required)
    - `customer_id` (`recordOrder.response.201.failed_revocations.items.customer_id`; string, required)
    - `order_id` (`recordOrder.response.201.failed_revocations.items.order_id`; any of, required)
      - any of: `string`, `null`
    - `grant_id` (`recordOrder.response.201.failed_revocations.items.grant_id`; any of, required)
      - any of: `string`, `null`
    - `product_ids` (`recordOrder.response.201.failed_revocations.items.product_ids`; array<string>, required)
    - `cause` (`recordOrder.response.201.failed_revocations.items.cause`; string, required)
    - `note` (`recordOrder.response.201.failed_revocations.items.note`; any of, required)
      - any of: `string`, `null`
    - `message` (`recordOrder.response.201.failed_revocations.items.message`; any of, required)
      - any of: `string`, `null`
    - `refund` (`recordOrder.response.201.failed_revocations.items.refund`; any of, required)
      - any of: `object`, `null`
    - `revoked_by` (`recordOrder.response.201.failed_revocations.items.revoked_by`; any of, required)
      - any of: `string`, `null`
    - `token_id` (`recordOrder.response.201.failed_revocations.items.token_id`; any of, required)
      - any of: `string`, `null`
    - `created_at` (`recordOrder.response.201.failed_revocations.items.created_at`; any of, required)
      - any of: `string`, `null`
  - `total` (`recordOrder.response.201.failed_revocations.total`; number, required)
- `refund_status` (`recordOrder.response.201.refund_status`; any of, required) — How much of what it settled came back: none, part or all of it; null while it settled and refunded nothing, or withheld.
  - any of: `string`, `null`
- `lines` (`recordOrder.response.201.lines`; object, required)
  - `items` (`recordOrder.response.201.lines.items`; array<object>, required)
    - `product` (`recordOrder.response.201.lines.items.product`; any of, required)
      - any of: `object`, `null`
    - `guests` (`recordOrder.response.201.lines.items.guests`; array<object>, required)
      - `id` (`recordOrder.response.201.lines.items.guests.id`; string, required)
      - `status` (`recordOrder.response.201.lines.items.guests.status`; string, required)
      - `customer_id` (`recordOrder.response.201.lines.items.guests.customer_id`; string, required)
      - `customer` (`recordOrder.response.201.lines.items.guests.customer`; any of, required)
        - any of: `object`, `null`
    - `revocable` (`recordOrder.response.201.lines.items.revocable`; boolean, required) — Whether a revocation of the order would end anything on the line: its customer's grant or running subscription of the product, or a guest's ticket to it.
    - `platform_fee` (`recordOrder.response.201.lines.items.platform_fee`; any of, required)
      - any of: `number`, `null`
    - `processor_fee` (`recordOrder.response.201.lines.items.processor_fee`; any of, required)
      - any of: `number`, `null`
    - `affiliate_fee` (`recordOrder.response.201.lines.items.affiliate_fee`; any of, required)
      - any of: `number`, `null`
    - `refunded` (`recordOrder.response.201.lines.items.refunded`; any of, required)
      - any of: `number`, `null`
    - `id` (`recordOrder.response.201.lines.items.id`; string, required)
    - `order_id` (`recordOrder.response.201.lines.items.order_id`; string, required)
    - `product_id` (`recordOrder.response.201.lines.items.product_id`; any of, required)
      - any of: `string`, `null`
    - `tier_id` (`recordOrder.response.201.lines.items.tier_id`; any of, required)
      - any of: `string`, `null`
    - `price_id` (`recordOrder.response.201.lines.items.price_id`; any of, required)
      - any of: `string`, `null`
    - `position` (`recordOrder.response.201.lines.items.position`; number, required)
    - `quantity` (`recordOrder.response.201.lines.items.quantity`; number, required)
    - `currency` (`recordOrder.response.201.lines.items.currency`; string, required)
    - `exponent` (`recordOrder.response.201.lines.items.exponent`; any of, required)
      - any of: `number`, `null`
    - `amount` (`recordOrder.response.201.lines.items.amount`; any of, required)
      - any of: `number`, `null`
    - `discount` (`recordOrder.response.201.lines.items.discount`; any of, required)
      - any of: `number`, `null`
    - `total` (`recordOrder.response.201.lines.items.total`; any of, required)
      - any of: `number`, `null`
    - `descriptor` (`recordOrder.response.201.lines.items.descriptor`; object, required)
      - `product` (`recordOrder.response.201.lines.items.descriptor.product`; any of, optional)
        - any of: `string`, `null`
      - `price` (`recordOrder.response.201.lines.items.descriptor.price`; any of, optional)
        - any of: `string`, `null`
      - `tier` (`recordOrder.response.201.lines.items.descriptor.tier`; any of, optional)
        - any of: `string`, `null`
      - `coupon` (`recordOrder.response.201.lines.items.descriptor.coupon`; string, optional)
      - `display_name` (`recordOrder.response.201.lines.items.descriptor.display_name`; string, optional) — The name and message the buyer left with a tip or a donation.
      - `message` (`recordOrder.response.201.lines.items.descriptor.message`; string, optional)
  - `total` (`recordOrder.response.201.lines.total`; number, required)
- `settlements` (`recordOrder.response.201.settlements`; object, required)
  - `items` (`recordOrder.response.201.settlements.items`; array<object>, required)
    - `id` (`recordOrder.response.201.settlements.items.id`; string, required)
    - `order_id` (`recordOrder.response.201.settlements.items.order_id`; string, required)
    - `processor` (`recordOrder.response.201.settlements.items.processor`; any of, required)
      - any of: `string`, `null`
    - `processor_ref` (`recordOrder.response.201.settlements.items.processor_ref`; any of, required)
      - any of: `string`, `null`
    - `account_ref` (`recordOrder.response.201.settlements.items.account_ref`; any of, required)
      - any of: `string`, `null`
    - `custodian` (`recordOrder.response.201.settlements.items.custodian`; string, required)
    - `currency` (`recordOrder.response.201.settlements.items.currency`; string, required)
    - `exponent` (`recordOrder.response.201.settlements.items.exponent`; any of, required)
      - any of: `number`, `null`
    - `amount` (`recordOrder.response.201.settlements.items.amount`; any of, required)
      - any of: `number`, `null`
    - `platform_fee` (`recordOrder.response.201.settlements.items.platform_fee`; any of, required)
      - any of: `number`, `null`
    - `processor_fee` (`recordOrder.response.201.settlements.items.processor_fee`; any of, required)
      - any of: `number`, `null`
    - `occurred_at` (`recordOrder.response.201.settlements.items.occurred_at`; any of, required)
      - any of: `string`, `null`
    - `recorded_at` (`recordOrder.response.201.settlements.items.recorded_at`; any of, required)
      - any of: `string`, `null`
  - `total` (`recordOrder.response.201.settlements.total`; number, required)
- `refunds` (`recordOrder.response.201.refunds`; object, required)
  - `items` (`recordOrder.response.201.refunds.items`; array<object>, required)
    - `id` (`recordOrder.response.201.refunds.items.id`; string, required)
    - `settlement_id` (`recordOrder.response.201.refunds.items.settlement_id`; string, required)
    - `order_id` (`recordOrder.response.201.refunds.items.order_id`; string, required)
    - `processor_ref` (`recordOrder.response.201.refunds.items.processor_ref`; any of, required)
      - any of: `string`, `null`
    - `amount` (`recordOrder.response.201.refunds.items.amount`; any of, required)
      - any of: `number`, `null`
    - `currency` (`recordOrder.response.201.refunds.items.currency`; string, required)
    - `exponent` (`recordOrder.response.201.refunds.items.exponent`; any of, required)
      - any of: `number`, `null`
    - `reason` (`recordOrder.response.201.refunds.items.reason`; any of, required)
      - any of: `string`, `null`
    - `occurred_at` (`recordOrder.response.201.refunds.items.occurred_at`; any of, required)
      - any of: `string`, `null`
    - `recorded_at` (`recordOrder.response.201.refunds.items.recorded_at`; any of, required)
      - any of: `string`, `null`
  - `total` (`recordOrder.response.201.refunds.total`; number, required)
- `affiliates` (`recordOrder.response.201.affiliates`; object, required)
  - `items` (`recordOrder.response.201.affiliates.items`; array<object>, required)
    - `settlement_id` (`recordOrder.response.201.affiliates.items.settlement_id`; string, required)
    - `order_item_id` (`recordOrder.response.201.affiliates.items.order_item_id`; string, required)
    - `order_id` (`recordOrder.response.201.affiliates.items.order_id`; string, required)
    - `user_id` (`recordOrder.response.201.affiliates.items.user_id`; string, required)
    - `discount_id` (`recordOrder.response.201.affiliates.items.discount_id`; any of, required)
      - any of: `string`, `null`
    - `currency` (`recordOrder.response.201.affiliates.items.currency`; string, required)
    - `exponent` (`recordOrder.response.201.affiliates.items.exponent`; any of, required)
      - any of: `number`, `null`
    - `fee` (`recordOrder.response.201.affiliates.items.fee`; any of, required)
      - any of: `number`, `null`
    - `resolution_id` (`recordOrder.response.201.affiliates.items.resolution_id`; any of, required)
      - any of: `string`, `null`
  - `total` (`recordOrder.response.201.affiliates.total`; number, required)
- `id` (`recordOrder.response.201.id`; string, required)
- `number` (`recordOrder.response.201.number`; number, required)
- `customer_id` (`recordOrder.response.201.customer_id`; any of, required)
  - any of: `string`, `null`
- `currency` (`recordOrder.response.201.currency`; string, required)
- `exponent` (`recordOrder.response.201.exponent`; any of, required)
  - any of: `number`, `null`
- `amount` (`recordOrder.response.201.amount`; any of, required)
  - any of: `number`, `null`
- `discount` (`recordOrder.response.201.discount`; any of, required)
  - any of: `number`, `null`
- `total` (`recordOrder.response.201.total`; any of, required)
  - any of: `number`, `null`
- `free` (`recordOrder.response.201.free`; boolean, required)
- `fees` (`recordOrder.response.201.fees`; any of, required)
  - any of: `number`, `null`
- `source` (`recordOrder.response.201.source`; string, required)
- `source_key` (`recordOrder.response.201.source_key`; any of, required)
  - any of: `string`, `null`
- `statements` (`recordOrder.response.201.statements`; object, required)
  - `coupon` (`recordOrder.response.201.statements.coupon`; string, optional)
  - `customer_status` (`recordOrder.response.201.statements.customer_status`; string, optional) — How well the buyer was known; `fake` is a seeded order.
  - `method` (`recordOrder.response.201.statements.method`; string, optional) — The payment method the processor reported.
  - `method_details` (`recordOrder.response.201.statements.method_details`; object, optional) — What the method shows, as a saved instrument's display: its brand and last 4 digits.
    - `brand` (`recordOrder.response.201.statements.method_details.brand`; any of, required)
      - any of: `string`, `null`
    - `last4` (`recordOrder.response.201.statements.method_details.last4`; any of, required)
      - any of: `string`, `null`
  - `refund_waiver` (`recordOrder.response.201.statements.refund_waiver`; object, optional) — Carried from the checkout.
    - `policy` (`recordOrder.response.201.statements.refund_waiver.policy`; string, required) — The strictest policy among the lines, the one consented to.
    - `accepted_at` (`recordOrder.response.201.statements.refund_waiver.accepted_at`; string, required)
  - `under_minimum` (`recordOrder.response.201.statements.under_minimum`; object, optional)
    - `processor` (`recordOrder.response.201.statements.under_minimum.processor`; string, required)
    - `minimum` (`recordOrder.response.201.statements.under_minimum.minimum`; any of, required) — Null when the processor refused the payment as too small rather than core reading its minimum.
      - any of: `number`, `null`
    - `amount` (`recordOrder.response.201.statements.under_minimum.amount`; any of, required)
      - any of: `number`, `null`
- `note` (`recordOrder.response.201.note`; any of, required)
  - any of: `string`, `null`
- `occurred_at` (`recordOrder.response.201.occurred_at`; any of, required)
  - any of: `string`, `null`
- `recorded_at` (`recordOrder.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` (`recordOrder.response.default.type`; string, required)
  - format `uri`
- `title` (`recordOrder.response.default.title`; string, required)
- `status` (`recordOrder.response.default.status`; integer, required)
- `detail` (`recordOrder.response.default.detail`; string, required)
- `code` (`recordOrder.response.default.code`; string, optional)
- `context` (`recordOrder.response.default.context`; object, optional)
- `reached_core` (`recordOrder.response.default.reached_core`; boolean, optional)
- `core_answer` (`recordOrder.response.default.core_answer`; string, optional)


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