Refunds
Add an overview of the Refunds API here. This block is preserved across regenerations.
Endpoints
GET /api/v1/invoices/{id}/refunds
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Invoice ID
Max items to return (1–100, default 20)
20Number of items to skip (default 0)
0Paginated list of refunds
No content
No payment session in the caller's tenant references this invoice (anti-enumeration — see Task #1459)
GET /api/v1/invoices/{id}/refunds HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
Notes, examples, or caveats for GET /invoices/{id}/refunds go here.
POST /api/v1/invoices/{id}/refunds
Issue a refund against the payment for an invoice. Targets the most recent successful payment session linked to this invoice.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Invoice ID (externalInvoiceId on the payment session)
Per-refund idempotency key. A retry with the same key + same body returns the original refund; same key + different body returns 409.
falseReplayed prior refund for the same Idempotency-Key
A refund issued against a successful payment session
Refund issued
Validation error or payment not refundable
No successful payment session found for this invoice
Idempotency-Key reused with a different request body
POST /api/v1/invoices/{id}/refunds HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 51
{
"amountCents": 1,
"reason": "text",
"refundAll": false
}{
"id": "text",
"paymentId": "text",
"invoiceId": "text",
"amountCents": 1,
"currency": "text",
"status": "pending",
"isFullRefund": true,
"reason": "text",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}Notes, examples, or caveats for POST /invoices/{id}/refunds go here.
GET /api/v1/payments/{id}/refunds
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Payment session ID
Max items to return (1–100, default 20)
20Number of items to skip (default 0)
0Paginated list of refunds
No content
Payment session not found
GET /api/v1/payments/{id}/refunds HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
No content
Notes, examples, or caveats for GET /payments/{id}/refunds go here.
POST /api/v1/payments/{id}/refunds
Issue a refund against a successful payment session. Supports full refunds (default) and partial refunds via amountCents.
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Payment session ID
Per-refund idempotency key. A retry with the same key + same body returns the original refund; same key + different body returns 409.
Partial refund amount in cents. Omit to refund the full refundable balance.
Explicitly refund the full remaining balance.
falseReplayed prior refund for the same Idempotency-Key
A refund issued against a successful payment session
Refund issued
Validation error or payment not refundable
Payment session not found
Idempotency-Key reused with a different request body
POST /api/v1/payments/{id}/refunds HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 51
{
"amountCents": 1,
"reason": "text",
"refundAll": false
}{
"id": "text",
"paymentId": "text",
"invoiceId": "text",
"amountCents": 1,
"currency": "text",
"status": "pending",
"isFullRefund": true,
"reason": "text",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}Notes, examples, or caveats for POST /payments/{id}/refunds go here.
Last updated
Was this helpful?
