Ask for an invitation
Menu

Endpoint

Assign an unmatched payment to an order

POST/v1/payments/{id}/assign

Credits the payment to the order at the value it had when it settled. The order's state is recomputed (it may become paid, underpaid or overpaid). In live mode a key cannot assign: it answers passkey_approval_required with reason assign_dashboard_only, and the dashboard assigns with a passkey. Test mode is unchanged.

Scope a restricted key needs
payments:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Recommended. It makes a retry safe.

Parameters

Parameters of Assign an unmatched payment to an order
ParameterType and placeMeaning
idrequiredstringpathThe id of the payment.
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.
Idempotency-KeystringheaderMakes a retry safe. Kept 24 hours. 1 to 255 characters.

Request body

A JSON object. The body is required. A field the call does not list is refused with parameter_unknown.

Request body of Assign an unmatched payment to an order
FieldTypeMeaning
orderrequiredstringThe order to credit.

Example request

curl

curl https://api.orrerie.com/v1/payments/pay_2pe50hae6w2jk4sp1rcq5pae/assign \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "order": "ord_0zymngngvf12b8b2cra7tb8e"
}'

JavaScript

const response = await fetch("https://api.orrerie.com/v1/payments/pay_2pe50hae6w2jk4sp1rcq5pae/assign", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "order": "ord_0zymngngvf12b8b2cra7tb8e"
  }),
});
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.post(
    "https://api.orrerie.com/v1/payments/pay_2pe50hae6w2jk4sp1rcq5pae/assign",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}"},
    json={
        "order": "ord_0zymngngvf12b8b2cra7tb8e",
    },
    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/payments/pay_2pe50hae6w2jk4sp1rcq5pae/assign');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'order' => 'ord_0zymngngvf12b8b2cra7tb8e',
    ]),
]);
$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 payment object. Headers: Orrerie-Request-Id.

Example response, 200

{
  "id": "pay_2pe50hae6w2jk4sp1rcq5pae",
  "object": "payment",
  "livemode": true,
  "created": "2026-10-11T14:06:41.117Z",
  "order": "ord_0zymngngvf12b8b2cra7tb8e",
  "instruction": null,
  "status": "settled",
  "rail": "direct",
  "asset": "ethereum:usdc",
  "network": "ethereum",
  "amount": "22.410000",
  "value": {
    "amount": "22.41",
    "currency": "USD"
  },
  "transaction_hash": "0x709b55bd3da0f5a838125bd0ee20c5bfdd7caba173912d4281cae816b79a201b",
  "from_address": "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB",
  "to_address": "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359",
  "confirmations": 14,
  "confirmations_required": 12,
  "unmatched": false,
  "unmatched_reason": null,
  "late": false,
  "ignored": false,
  "finalized": true,
  "screening": {
    "id": "scr_268aypc7xxt8g1bkbweajv0m",
    "status": "clear",
    "checked_at": "2026-10-11T14:06:41.117Z"
  },
  "settlement": {
    "id": "stl_wrv1q8enp9g0fr2jqt1gwqrr",
    "asset": "base:usdc",
    "network": "base",
    "amount": "21.990000",
    "wallet": "wal_bsfw07hymawmda7gg8jsyy3g",
    "to_address": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed",
    "transaction_hash": "0x27ca64c092a959c7edc525ed45e845b1de6a7590d173fd2fad9133c8a779a1e3",
    "proved_by": "wallet_chain_read",
    "settled_at": "2026-10-11T14:09:55.764Z"
  },
  "seen_at": "2026-10-11T14:06:41.117Z",
  "confirmed_at": "2026-10-11T14:09:12.300Z",
  "settled_at": "2026-10-11T14:09:55.764Z",
  "reverted_at": null
}

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

Beside the errors every call can answer with (a bad key, a missing scope, the rate limit), this call answers with:

Errors of Assign an unmatched payment to an order
CodeHTTPMeaning
payment_not_unmatched409The payment already belongs to an order.
order_not_payable409The order is cancelled, or already paid/overpaid.
passkey_approval_required403The action can only be done by a signed-in member in the dashboard (settlement asset, key-holding roles, approvals). No API key can do it.
payment_reverted409The payment is no longer on its network.
payment_being_refunded409The payment is being sent back.