HYBRID-CHAINDEVELOPERS
DOCUMENTATIONv2
POST

Payments

Cancel payment intent

/api/v2/payments/{payment_uuid}/cancellations
AUTHENTICATIONBearer token · payments:writeAUTHORITATIVE OWNERpayment-serviceCONTRACT AUTHORITYGenerated Rust OpenAPISTATUSSource ready · production listed

PURPOSE + BUSINESS CONTEXT

Stop an outgoing payment intent before any value-moving authority exists and retain why it was cancelled.

WHEN THIS CALL IS USEFUL

Call this after re-reading a payer-owned intent that remains exactly AUTHORIZATION_REQUIRED and deciding not to continue toward a future authorization step.

OUTCOME · Cancel proposal

What changes

Atomically marks the intent CANCELLED and appends evidence. A linked unexpired request reopens; an expired linked request becomes EXPIRED. No reservation, rail action, refund, reversal, or balance change occurs.

WHY IT MATTERS

  • Provides a safe, auditable exit from a proposed payment before funds can be reserved or submitted.
  • Reopens a still-valid payment request so the payer can deliberately choose a new source or method later.

ISOLATION + AUTHORITY

Only the authenticated payer workspace can cancel. The payee can observe but cannot stop the payer’s intent, and this route has no authority over external rails, ledger entries, refunds, or settlement.

BEFORE YOU CALL

  • A bearer token with payments:write for the payer workspace.
  • A unique Idempotency-Key and RFC 9421 signature.
  • The exact expected_payment_version, expected_state=AUTHORIZATION_REQUIRED, and reason_code=OWNER_CANCELLED.

WHAT TO DO NEXT

  • Read the payment to confirm CANCELLED and its incremented version.
  • If linked, re-read the request collection to confirm OPEN or EXPIRED before deciding whether to create a replacement intent.

AGENT GUIDANCE

  • Cancellation is available only before authorization; do not use it as a refund or reversal mechanism.
  • After 409, re-read the payment and linked request instead of weakening the expected state or version.
  • After an ambiguous response, reconcile the detail record before retrying the equivalent request and Idempotency-Key.
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 payments:write authority.EXAMPLEBearer hc_live_…

payment_uuidpathRequired

identifierOutgoing AUTHORIZATION_REQUIRED payment returned by the latest readEXAMPLEpayment-uuid-01

Idempotency-KeyheaderRequired

ASCII string · 1–128Caller-generated stable key reused for retries of the same logical mutation.EXAMPLEpost-api-v2-payments-payment-uuid-cancellations-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.

expected_payment_versionbodyRequired

integer · ≥1Current payment version used to prevent cancellation after another transition.Schema range: 0 to unboundedEXAMPLE1

expected_statebodyRequired

AUTHORIZATION_REQUIREDMust be `AUTHORIZATION_REQUIRED`. Later rail states are irreversible here.EXAMPLEAUTHORIZATION_REQUIRED

reason_codebodyRequired

OWNER_CANCELLEDExact owner-controlled cancellation reason. Administrative and machine-failure transitions require separate governed operations.EXAMPLEOWNER_CANCELLED

REQUEST

JSON body example

{
  "expected_payment_version": 0,
  "expected_state": "example-expected-state",
  "reason_code": "example-reason-code"
}

RESPONSES

Status and payload examples

200The exact AUTHORIZATION_REQUIRED intent becomes CANCELLED, evidence is retained, and any linked unexpired request returns to OPEN; no value is reversed.Mutation completed · JSON RESPONSE+
{
  "amount": "100.00",
  "authorization_required": true,
  "balance_mutation_performed": true,
  "cancellation_reason_code": "example-cancellation-reason-code",
  "cancelled_at": "2026-09-02T18:30:00Z",
  "created_at": "2026-09-02T18:30:00Z",
  "currency": "USD",
  "external_reference": "example-external-reference",
  "memo": "example-memo",
  "payee_workspace_id": "01K4A7M4N8Y2Q6R9T3V5W7X1ZB",
  "payer_workspace_id": "01K4A7M4N8Y2Q6R9T3V5W7X1ZB",
  "payment_method": "example-payment-method",
  "payment_request_uuid": "01K4A7M4N8Y2Q6R9T3V5W7X1ZB",
  "payment_source_reference": "example-payment-source-reference",
  "payment_uuid": "01K4A7M4N8Y2Q6R9T3V5W7X1ZB",
  "purpose_code": "example-purpose-code",
  "rail_submission_created": true,
  "reconciliation_required": true,
  "request_commitment": "example-request-commitment",
  "reservation_created": true,
  "settlement_authority_granted": true,
  "state_commitment": "example-state-commitment",
  "status": "example-status",
  "updated_at": "2026-09-02T18:30:00Z",
  "version": 0
}
INTEGRATION DECISION
CALLER ACTION
Accept the returned representation or receipt, then read the payment to confirm CANCELLED and its incremented version.
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 owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
400The version, state, reason, request 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 owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.
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 owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.
403The principal lacks payments:write, payer ownership, or a valid RFC 9421 signature.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 the owner-isolated payment-request and authorization-required intent control plane; authorization, reservation, rail execution, settlement, refunds, and receipts remain separate capabilities.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.
404The payment does not exist in the authenticated owner and network boundary.Resource not visible · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "the supplied Hybrid credential is invalid"
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Verify the canonical identifier and authenticated owner boundary. A 404 may intentionally conceal a resource outside the caller's authority.
RETRY SAFETY
Do not retry the unchanged identifier repeatedly. Refresh the relevant collection or lookup before choosing another identifier.
STATE RECONCILIATION
Re-read the owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.
409The version or state is stale, the payment is not AUTHORIZATION_REQUIRED, or the Idempotency-Key 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 owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.
422Cancellation reason or lifecycle policy rejected the request.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 owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.
503The Payments control plane is unavailable; payment and linked-request state remain unchanged.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 owner-visible request or payment record and compare its status, version, exact decimal terms, commitments, and explicit safety flags before reusing the same Idempotency-Key with an equivalent mutation.
ESCALATE WHEN
Escalate when a record progressed beyond AUTHORIZATION_REQUIRED, source or rail state is ambiguous, a linked request cannot be reconciled, or a caller needs value movement, settlement, refund, or receipt authority that the implemented Payments control plane does not provide.

OPERATIONAL NOTES

Security and lifecycle guarantees

  • Cancel an exact latest AUTHORIZATION_REQUIRED intent, retain cancellation evidence, and reopen an unexpired linked request without reversing value or rail activity. Authoritative owner: payment-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