HYBRID-CHAINDEVELOPERS
DOCUMENTATIONv2
POST

Merchant commerce

Create invoice

/api/v2/commerce/invoices
AUTHENTICATIONBearer token · commerce:writeAUTHORITATIVE OWNERcommerce-serviceCONTRACT AUTHORITYGenerated Rust OpenAPISTATUSSource ready · production listed

PURPOSE + BUSINESS CONTEXT

Create a checkout-backed merchant invoice with customer, line items, settlement, and expiry terms.

WHEN THIS CALL IS USEFUL

Create one structured invoice after re-reading the ACTIVE merchant and every ACTIVE product, minimizing customer data, and selecting exact quantities, settlement currency, and optional expiry.

OUTCOME · Create or advance

What changes

Atomically creates an OPEN invoice with server-computed totals and a shareable Payments V2 request. It does not assert payment, reserve customer funds, settle a wallet, fulfill an order, deliver an asset, calculate legal tax, or create a refund.

WHY IT MATTERS

  • Gives people and agents a contract-backed way to advance invoice.
  • Connects catalog and invoice operations to payment collection and treasury reconciliation without making presentation state or a reserved address proof of payment.

ISOLATION + AUTHORITY

Tenant, workspace, merchant, product, customer, invoice, checkout, collection wallet, payment, custody, treasury settlement, tax or compliance policy, and finality remain distinct. Merchant configuration or invoice state cannot authorize wallet signing, move funds, prove settlement, or grant publisher, matching, or trading authority.

BEFORE YOU CALL

  • Authenticate at the documented boundary: bearer+scope.
  • Supply the required merchant_uuid (body), customer (body), line_items (body), settlement_currency (body), step_up_token (body) exactly as defined by the live contract.
  • Use one Idempotency-Key only for retries of the same byte-equivalent logical mutation.

WHAT TO DO NEXT

  • Re-read invoice using the canonical identifier returned by this operation.
  • Reconcile an ambiguous response with the same idempotency key before attempting another mutation.
  • Open the canonical merchant, invoice, payment, or rotational-wallet record for the next stage and verify settlement independently before marking the commercial obligation complete.

AGENT GUIDANCE

  • Use invoice only for the purpose and lifecycle stage described by this operation; do not treat it as authority for an adjacent action.
  • Supply the required merchant_uuid (body), customer (body), line_items (body), settlement_currency (body), step_up_token (body) exactly as defined by the live contract.
  • Distinguish merchant readiness, product availability, invoice issuance, checkout presentation, payment observation, wallet synchronization, treasury settlement, cancellation, and reconciliation.
  • After a timeout or conflict, read authoritative state before deciding whether an equivalent retry is safe.
MACHINE CONTRACT

The exact deployed parameters, schemas, responses, security requirements, and Hybrid-Chain agent metadata are authoritative at this operation's production OpenAPI JSON Pointer. The readable tables below add integration guidance; the deployed OpenAPI controls if guidance and the machine contract ever differ.

Open the authoritative production contract

EXTENDED INTEGRATION GUIDANCE

Readable request and response reference

Examples illustrate integration intent; the referenced OpenAPI operation and component schemas define the executable shape.

PARAMETERS

Headers, path, query, and body

NAMELOCATIONPRESENCETYPE / RULES / PURPOSE
AuthorizationheaderRequired

Bearer tokenCredential containing commerce:write authority.EXAMPLEBearer hc_live_…

Idempotency-KeyheaderRequired

ASCII string · 1–128Caller-generated stable key reused for retries of the same logical mutation.EXAMPLEpost-api-v2-commerce-invoices-request-001

X-Request-IDheaderOptional

stringOptional caller correlation identifier. The gateway emits the effective value on the response.

Content-DigestheaderRequired

stringRFC 9530 sha-256 digest of the exact transmitted request-body bytes.

Signature-InputheaderRequired

stringRFC 9421 sig1 input covering @method, @path, content-digest, content-type, and idempotency-key, with created, expires, nonce, keyid, and alg=ed25519.

SignatureheaderRequired

stringRFC 9421 sig1 Ed25519 signature made by an active key registered to the bearer client.

customerbodyRequired

data-minimized customer objectCustomer reference plus only the contact fields required by merchant policy. Government identifiers, payment credentials, and regulated evidence are forbidden.EXAMPLE[object Object]

customer_notebodyOptional

string · max 500 · nullableOptional presentation note without secrets, payment instructions, or regulated evidence.Explicit null acceptedEXAMPLEThank you for your order.

expires_atbodyOptional

future RFC 3339 timestamp · nullableOptional checkout expiry within merchant policy. Omission uses the merchant default.Explicit null acceptedEXAMPLE2026-09-02T18:00:00Z

external_order_referencebodyOptional

merchant-unique string · max 128 · nullableOptional merchant order reference used for reconciliation; it grants no payment or fulfillment authority.Explicit null acceptedEXAMPLEORDER-2026-0042

line_itemsbodyRequired

invoice line[] · 1–100Product reference, positive exact-decimal quantity, and optional description for each line. Commerce resolves current product price and computes every total.EXAMPLE[object Object]

merchant_uuidbodyRequired

workspace merchant identifierMerchant issuing the invoice and owning its checkout and settlement policy.EXAMPLEmerchant-01

metadatabodyOptional

bounded string map · max 20 entries · nullableOptional non-secret merchant reconciliation metadata.Explicit null acceptedEXAMPLE[object Object]

settlement_currencybodyRequired

uppercase asset or ISO currency codeSettlement denomination selected from the merchant and product policies; it does not assert a conversion rate or payment.EXAMPLEUSD

step_up_tokenbodyRequired

purpose-bound tokenFresh COMMERCE_INVOICE_CREATION authorization bound to merchant, customer reference, computed terms, currency, and expiry.EXAMPLEhcsu_…

REQUEST

JSON body example

{
  "customer": "example-customer",
  "customer_note": "example-customer-note",
  "expires_at": "2026-09-02T18:30:00Z",
  "external_order_reference": "example-external-order-reference",
  "line_items": [
    "example-line-item"
  ],
  "merchant_uuid": "01K4A7M4N8Y2Q6R9T3V5W7X1ZB",
  "metadata": "example-metadata",
  "settlement_currency": "USD",
  "step_up_token": "example-step-up-token"
}

RESPONSES

Status and payload examples

201An OPEN invoice with server-computed exact totals, a linked Payments V2 request, expiry, and immutable terms commitment is returned; it is not paid or fulfilled.Mutation completed · JSON RESPONSE+
{}
INTEGRATION DECISION
CALLER ACTION
Accept the returned representation or receipt, then re-read invoice using the canonical identifier returned by this operation.
RETRY SAFETY
Do not repeat a successful mutation merely to confirm it. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Persist returned identifiers, versions, commitments, and receipts. Re-read the merchant or product version, invoice and linked payment-request state, and the exact network-scoped wallet projection before retrying with the same idempotency key and byte-equivalent request. Invoice state alone is not payment, settlement, or fulfillment finality.
400The merchant, order reference, customer, line items, currency, expiry, note, metadata, step-up token, signature, or idempotency key is malformed.Request must change · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "the supplied Hybrid credential is invalid"
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Rebuild the request from the live OpenAPI operation and correct the rejected method, media type, header, parameter, or body field.
RETRY SAFETY
Do not retry the same invalid request. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Compare the submitted values with the documented constraints before another call. Re-read the merchant or product version, invoice and linked payment-request state, and the exact network-scoped wallet projection before retrying with the same idempotency key and byte-equivalent request. Invoice state alone is not payment, settlement, or fulfillment finality.
ESCALATE WHEN
Escalate when a protected transition remains ambiguous after authoritative Commerce, Payments, and operational-wallet reconciliation. Commerce settlement execution remains frozen; never manufacture value movement by combining invoice, payment, or wallet calls.
401The bearer credential is missing, expired, or invalid.Authentication required · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "the supplied Hybrid credential is invalid"
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Discard the rejected credential, complete the documented authentication or reassertion flow, and rebuild any request signature with fresh timestamps and nonces.
RETRY SAFETY
Retry only with a newly valid credential and fresh replay-protection values. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Assume the outcome is unknown only when the connection failed after transmission; otherwise authentication failed before domain work. Re-read the merchant or product version, invoice and linked payment-request state, and the exact network-scoped wallet projection before retrying with the same idempotency key and byte-equivalent request. Invoice state alone is not payment, settlement, or fulfillment finality.
ESCALATE WHEN
Escalate when a protected transition remains ambiguous after authoritative Commerce, Payments, and operational-wallet reconciliation. Commerce settlement execution remains frozen; never manufacture value movement by combining invoice, payment, or wallet calls.
403The principal lacks commerce:write, merchant invoice authority, customer-data authority, or fresh COMMERCE_INVOICE_CREATION authorization.Authority or policy denied · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "the supplied Hybrid credential is invalid"
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Verify the exact scope, tenant or workspace membership, owner boundary, step-up purpose, feature policy, and resource eligibility. Never broaden authority automatically.
RETRY SAFETY
Do not retry until the missing authority or policy condition has been deliberately resolved with least privilege.
STATE RECONCILIATION
Confirm the caller and resource resolve to the same authority boundary for workspace-isolated merchant profiles, catalog publication, invoices, linked payment requests, and verify-only rotational-wallet observations.
ESCALATE WHEN
Escalate when a protected transition remains ambiguous after authoritative Commerce, Payments, and operational-wallet reconciliation. Commerce settlement execution remains frozen; never manufacture value movement by combining invoice, payment, or wallet calls.
409Merchant, product, price, currency, external-order, checkout-capacity, or Idempotency-Key state conflicts.State reconciliation required · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "the supplied Hybrid credential is invalid"
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Stop the mutation sequence and fetch the latest authoritative resource, lifecycle state, version, ETag, reservation, or existing idempotency result.
RETRY SAFETY
Retry only after reconciling the conflict. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Re-read the merchant or product version, invoice and linked payment-request state, and the exact network-scoped wallet projection before retrying with the same idempotency key and byte-equivalent request. Invoice state alone is not payment, settlement, or fulfillment finality.
ESCALATE WHEN
Escalate when a protected transition remains ambiguous after authoritative Commerce, Payments, and operational-wallet reconciliation. Commerce settlement execution remains frozen; never manufacture value movement by combining invoice, payment, or wallet calls.
503Commerce, catalog, checkout, rotational-wallet, Payments, or evidence ownership is unavailable; no invoice is created.Dependency unavailable or outcome uncertain · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "the supplied Hybrid credential is invalid"
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Preserve the exact request and treat the outcome as uncertain until authoritative state proves whether it committed.
RETRY SAFETY
Reconcile before retrying. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions. Use bounded backoff with jitter.
STATE RECONCILIATION
Re-read the merchant or product version, invoice and linked payment-request state, and the exact network-scoped wallet projection before retrying with the same idempotency key and byte-equivalent request. Invoice state alone is not payment, settlement, or fulfillment finality.
ESCALATE WHEN
Escalate when a protected transition remains ambiguous after authoritative Commerce, Payments, and operational-wallet reconciliation. Commerce settlement execution remains frozen; never manufacture value movement by combining invoice, payment, or wallet calls.

OPERATIONAL NOTES

Security and lifecycle guarantees

  • Create a checkout-backed merchant invoice with customer, line items, settlement, and expiry terms. Authoritative owner: commerce-service.
  • The Rust gateway validates the public contract and routes only to the authoritative owner; clients never address internal services directly.
  • Mutations are retry-safe only when the same Idempotency-Key and canonical request body are reused.
  • The tables and examples are derived from the current gateway source OpenAPI. Re-fetch the deployed OpenAPI before execution; deployment status is shown separately on this page.
  • Only parameters present in the OpenAPI operation are accepted; undocumented query keys fail closed with HTTP 422.
DOCUMENTATION STATUS

This route is implemented in canonical gateway source and appears in the production OpenAPI snapshot observed 2026-09-11T06:35:11.572Z. Authentication, tenant, feature, venue, and market policy still apply.

Verify the exact production OpenAPI operation Return to the V2 directory