Ask for an invitation
Menu

Endpoint

Update an order

PATCH/v1/orders/{id}

Only description, reference, customer and metadata can change, and only these. The amount, currency, settlement and rails of an order never change after creation; cancel it and create a new one.

Scope a restricted key needs
orders:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Not used. A PATCH is already safe to repeat.

Parameters

Parameters of Update an order
ParameterType and placeMeaning
idrequiredstringpathThe id of the order.
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.

Request body

A JSON object. The body may be left out. A field the call does not list is refused with parameter_unknown.

Request body of Update an order
FieldTypeMeaning
descriptionstringShown to the payer above the amount. Up to 500 characters; null clears it.
referencestringYour order number. Up to 200 characters; null clears it.
customerstringA cus_ id; null clears it.
metadataobjectYour own key-value data (rules in Metadata).

Example request

curl

curl -X PATCH https://api.orrerie.com/v1/orders/ord_0zymngngvf12b8b2cra7tb8e \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "metadata": {
    "cart_id": "c_7781",
    "shipped": "true"
  }
}'

JavaScript

const response = await fetch("https://api.orrerie.com/v1/orders/ord_0zymngngvf12b8b2cra7tb8e", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "metadata": {
      "cart_id": "c_7781",
      "shipped": "true"
    }
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${result.error.code}: ${result.error.message}`);
console.log(result);

Python

import os
import requests

response = requests.patch(
    "https://api.orrerie.com/v1/orders/ord_0zymngngvf12b8b2cra7tb8e",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}"},
    json={
        "metadata": {
            "cart_id": "c_7781",
            "shipped": "true",
        },
    },
    timeout=30,
)
result = response.json()
if not response.ok:
    raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
print(result)

PHP

<?php
$request = curl_init('https://api.orrerie.com/v1/orders/ord_0zymngngvf12b8b2cra7tb8e');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'metadata' => [
            'cart_id' => 'c_7781',
            'shipped' => 'true',
        ],
    ]),
]);
$body = curl_exec($request);
if ($body === false) {
    throw new RuntimeException(curl_error($request));
}
$result = json_decode($body, true);
if (curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) {
    throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
print_r($result);

Responses

200 OK

The answer is the order object. Headers: Orrerie-Request-Id.

Example response, 200

{
  "id": "ord_0zymngngvf12b8b2cra7tb8e",
  "object": "order",
  "livemode": true,
  "created": "2026-10-11T14:03:22.418Z",
  "updated": "2026-10-11T14:09:55.764Z",
  "status": "paid",
  "source": "checkout",
  "amount": "21.99",
  "currency": "USD",
  "value": {
    "amount": "21.99",
    "currency": "USD"
  },
  "fx": null,
  "description": "Order #1042",
  "reference": "1042",
  "customer": "cus_8ea07c40qsvv19f7rgmeb8ha",
  "customer_email": "jane@example.com",
  "line_items": [
    {
      "name": "Ethiopia Yirgacheffe, 1 kg",
      "quantity": 1,
      "unit_amount": "21.99",
      "amount": "21.99",
      "price": "price_mbk5s5r45kwheaq89dbmk2gz"
    }
  ],
  "settlement": {
    "mode": "convert",
    "asset": "base:usdc",
    "amount_expected": "21.990000",
    "amount_received": "21.990000",
    "wallet": "wal_bsfw07hymawmda7gg8jsyy3g"
  },
  "fee_bearer": "payer",
  "amount_paid": "21.99",
  "amount_due": "0.00",
  "amount_refunded": "0.00",
  "paid_late": false,
  "accepted_short": false,
  "refunded": false,
  "partially_refunded": false,
  "finalized": true,
  "has_unconfirmed": false,
  "screening_hold": false,
  "screening": {
    "status": "clear"
  },
  "provider_refund_received": false,
  "overpayment": null,
  "rails_allowed": [
    "orrerie_app",
    "relay",
    "direct"
  ],
  "accept": [],
  "app_pay_allowed": true,
  "active_instruction": null,
  "instructions": [
    "pin_h73hkjr8dyp4zymaet5e2gbv"
  ],
  "payments": [
    "pay_2pe50hae6w2jk4sp1rcq5pae"
  ],
  "checkout_session": "cs_z7ek5wj68fyz80j7bz1eq4e0",
  "payment_link": null,
  "invoice": null,
  "subscription": null,
  "pos_device": null,
  "receipt": "rcpt_ppaxx20nbqv0kqgkwcxcc5xh",
  "expires_at": "2026-10-11T15:03:22.418Z",
  "paid_at": "2026-10-11T14:09:55.764Z",
  "cancelled_at": null,
  "metadata": {
    "cart_id": "c_7781",
    "shipped": "true"
  }
}

Any other status: an error

A status of 400 or above answers with the error object. Branch on its code, never on its message.

Errors

This call has no error of its own. It answers with the errors every call can answer with: a bad key, a missing scope, an object that does not exist, the rate limit. Every error code has its own entry.