Mark a failed refund as returned another way
const url = 'http://localhost:8080/v1/credit-notes/hc_cn_dbkrtc2q3gpgqfoq5c5g/mark-returned-another-way';const options = { method: 'POST', headers: { 'Idempotency-Key': '5f0c8a2e-7b1d-4c3e-9a6f-2d8b4e1c7a90', Authorization: 'Bearer <token>' }};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/v1/credit-notes/hc_cn_dbkrtc2q3gpgqfoq5c5g/mark-returned-another-way \ --header 'Authorization: Bearer <token>' \ --header 'Idempotency-Key: 5f0c8a2e-7b1d-4c3e-9a6f-2d8b4e1c7a90'Records that the customer has the money of a failed card refund by
another way than Stripe: the refund part of an issued credit note
whose refund_ is failed moves to out_,
the refund is no longer failed, and nothing retries it. An issued
credit note cannot be voided, so this is how a failed refund ends.
The note keeps stripe_, the refund that failed. The action
is recorded in the audit log. The route takes no body.
Use it once you have paid the customer back outside Stripe, or once
the customer’s bank returned the money in a dispute you lost: then
mark it without paying. While a dispute is open, do neither: it is
refused with payment_. If you win, retry the refund
(POST /). A refund you make later
in the Stripe dashboard is recorded as a refund made in Stripe, apart
from this note.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The issued credit note’s id (hc_cn_…).
Example
hc_cn_dbkrtc2q3gpgqfoq5c5gHeader Parameters
Section titled “Header Parameters”Makes the call safe to retry. Send a random UUID, and the same value
on every retry. Keys are kept per account and mode, and every API key
and dashboard user of the account shares them, so make a key
unpredictable. A key over 255 characters is refused with 422
validation_, param: Idempotency-Key. A request sent with a
key runs to its end even if the client disconnects: retry with the
same key for its answer.
For 24 hours, a repeat from the same caller (the same API key or the
same dashboard user) with the same key, method, path, query string
and body gets the first response again, byte for byte, with an
Idempotent-Replayed: true header, instead of running again. A
first answer of 401, 403, 409, 422 or 503, or a 400 invalid JSON body, is not kept, so a retry with the same key runs again. A
request to a path or method no route serves holds no key.
A repeat sent while the first request is still running gets 409
with code conflict_ at once: retry it in a moment with
the same key. The same key from another caller,
or with a different method, path, query string or body, is a 422
with code idempotency_ at once, even while the first request
runs. The query string must match byte for byte. After
24 hours the key is free, and a request with it runs as new. The
other error cases are in
Idempotency. The usage routes do
not take it: each usage event carries its own idempotency_.
The requests whose answer carries a secret shown only once
(creating or rotating an API key, creating a webhook endpoint or
rotating its signing secret, rotating a customer’s cost dashboard
token, creating a card setup session) do not take it either:
Hardcount does not keep that answer.
Example
5f0c8a2e-7b1d-4c3e-9a6f-2d8b4e1c7a90Responses
Section titled “Responses”Credit note with the refund part moved to out_.
A credit note reduces what a customer owes on an invoice, or gives
money back after it was paid. On an unpaid invoice it lowers
amount_. On a paid invoice its total is split three ways:
refund to the card (refund_), credit to the customer’s
balance (credit_), and money returned another way
(outside Stripe: out_). Amounts are whole numbers in the
currency’s minor unit (cents for USD). The credit note routes and
POST / return it.
object
Unique identifier of the credit note, starting hc_cn_.
The account the credit note belongs to. Absent when empty.
The invoice the note credits.
The invoice’s customer.
The number printed on the note: the account’s credit note prefix
(default CN), a hyphen and a sequence padded to six digits, for
example CN-000003. Test mode and live mode count separately.
Set when the note is created, drafts included.
draft: created but not applied; it can be issued or voided.
issued: applied to the invoice and final. voided: cancelled
before it was issued.
Why the note was made, as given when it was created. A refund
made with POST / carries its refund
reason (duplicate, fraudulent, requested_ or
other).
The credited amount without its tax, in the currency’s minor unit (cents for USD).
The tax part of the credited amount, in the currency’s minor unit (cents for USD). It is the invoice’s own tax share of the note, so crediting half of an invoice reverses half of its tax.
The credited amount with tax, in the currency’s minor unit (cents for USD): the sum of the note’s lines.
Part of the total refunded to the card that paid the invoice, in the currency’s minor unit (cents for USD). 0 on a note against an unpaid invoice.
Part of the total added to the customer’s credit balance, in the currency’s minor unit (cents for USD). 0 on a note against an unpaid invoice.
Part of the total returned another way (outside Stripe: a bank transfer, cash, or the customer’s bank reversing the payment in a lost dispute), recorded for the books, in the currency’s minor unit (cents for USD). 0 on a note against an unpaid invoice.
When the note’s failed card refund was marked as returned another
way (POST /), which
moved it to out_. Absent on every other note.
Prepaid commit credits this note retired, in the currency’s minor unit (cents for USD). Absent on other notes.
The invoice’s currency, uppercase.
When the note was issued. Absent until it is issued.
When the note was voided. Absent unless it is voided.
The refund part’s state at Stripe. none: no refund was sent
(no refund part, or the note is not issued yet); an issued note
with a refund part stays none only when its refund’s result
was not recorded. pending: Stripe has not finished it.
succeeded and failed: Stripe’s answer. unknown: Stripe gave
no clear answer (a timeout, a network error, a Stripe 5xx, a 409
or a 429), so the customer may already be refunded. Don’t refund it
again in the Stripe Dashboard. Retry it with
POST /, which looks for the
refund at Stripe first and then resends the same request with
the same idempotency key.
The Stripe refund (re_…) of the refund part. Absent until Stripe made one.
True when the card refund is a refund made in Stripe outside
Hardcount: recorded from Stripe’s refund webhook, linked with
stripe_ at create, or attached with
POST /. Hardcount made
no refund call for it; stripe_ names the refund.
What an issued invoice or credit note prints about its buyer. It is
copied from the customer and the billing profile when the document
is issued, so a later edit to either does not change it. The printed
name is legal_ when set, otherwise display_.
object
The customer’s display name when the document was issued.
The billing profile’s legal name. Absent when none was set.
The customer’s email address. Absent when none was set.
First address line of the billing profile. Absent when none was set.
Second address line of the billing profile. Absent when none was set.
City of the billing profile. Absent when none was set.
State or region of the billing profile. Absent when none was set.
Postal code of the billing profile. Absent when none was set.
Country of the billing profile, as a two-letter ISO 3166 code. Absent when none was set.
On an invoice, the tax ID its tax was calculated with when set, otherwise the billing profile’s tax ID at issue. Absent when there is none.
The kind of tax ID, as the billing profile stores it. Absent when none was set.
What an issued invoice or credit note prints about its seller: your company details from the account settings, copied when the document was issued. A later change to the settings does not change it. Every field is absent when the setting was empty.
object
Your company name.
Your company’s contact email.
Your company’s phone number.
First line of your company address.
Second line of your company address.
City of your company address.
State or region of your company address.
Postal code of your company address.
Country of your company address.
Your company’s tax ID.
The tax provider’s reversal transaction, set when the note is issued against an invoice whose tax the provider recorded. Absent otherwise.
True while the credit note’s tax reversal at Stripe Tax is still owed. Set when a note with an amount is issued on an invoice Stripe Tax taxed, and cleared when the reversal is recorded, normally within the same request. It stays true while a failed reversal is retried, and while the invoice’s own tax is not yet recorded at Stripe. If the invoice’s tax is never recorded at Stripe, the flag stays true and no reversal is made.
Extra key-value data stored with the note. No API request sets it; it is absent when empty.
object
When the note was created.
The real-world time the note was created. Absent on notes created before releases recorded it.
When the note last changed.
Example
{ "id": "hc_cn_dbkrtc2q3gpgqfoq5c5g", "tenant_id": "hc_ten_dajqj02q3gpgqfoq5c00", "invoice_id": "hc_inv_dbj84b2q3gpgqfoq5c40", "customer_id": "hc_cus_dakhnk2q3gpgqfoq5c0g", "credit_note_number": "CN-000003", "status": "issued", "reason": "Unused prepaid credit refunded", "subtotal_cents": 5400, "tax_amount_cents": 0, "total_cents": 5400, "refund_amount_cents": 0, "credit_amount_cents": 0, "out_of_band_amount_cents": 5400, "commit_retired_cents": 6000, "currency": "USD", "issued_at": "2026-11-03T10:15:00Z", "refund_status": "none", "stripe_refund_id": "re_3QHk7bLkdIwHu7ix2c3d4e5f", "recorded_from_stripe": false, "tax_reversal_pending": false, "created_at": "2026-11-03T10:15:00Z", "recorded_at": "2026-11-03T10:15:00Z", "updated_at": "2026-11-04T09:00:00Z"}The body is not one valid JSON value, it is not a JSON object, it
is empty where the operation needs one, or a field has the wrong
JSON type (such as a string where a number belongs). This answer
is not kept for an Idempotency-Key: send the corrected request
with the same key.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_request", "message": "invalid JSON body", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}No valid credential: the API key or session is missing, wrong,
expired or revoked. With no API key and no valid session cookie, the
message starts with missing credentials. A wrong, expired and
revoked key all get the same message, invalid or expired API key.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "authentication_error", "code": "unauthorized", "message": "invalid or expired API key", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}The credential is valid but may not call this route. A usage-only
key (hc_) can only send usage, read a customer’s live
credit balance and call GET /; use a secret key. The message names the permission the key
lacks. A browser request that would change data (POST, PUT, PATCH
or DELETE) from a page on another site gets this 403 too, with the
message cross-site request blocked.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "authentication_error", "code": "forbidden", "message": "insufficient permissions: this key type does not have customer:read access", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}No credit note with this id in this account and mode.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "invalid_request_error", "code": "not_found", "message": "credit note not found", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}Code invalid_: the note is not issued; its refund did not
fail (it is pending, a retry of it is running, it succeeded, its
result is unknown, or there is none); it is already recorded as
returned another way; or its refund changed since it was read.
Code payment_: the customer’s bank holds a chargeback
on the payment; wait for its outcome. Code
stripe_: the invoice has a refund made in
Stripe that is not recorded yet; record it, attach it to this
note, or dismiss it first.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_state", "message": "Only a card refund that failed can be marked as returned another way.", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}The body is over the 1 MB limit. Send a smaller body. The answer is
the same with or without an Idempotency-Key, and it is not kept
for the key: the same key works for the smaller request.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "invalid_request_error", "code": "payload_too_large", "message": "The request body is larger than the 1 MB limit. Send a smaller body.", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}The request has a body with a field. This route takes no body (param names the field).
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "invalid_request_error", "code": "validation_error", "message": "unknown field \"amount_cents\"", "request_id": "req_dbjg652q3gpgqfoq5cd0", "param": "amount_cents" }}Too many requests. Wait for the number of seconds in Retry-After,
then retry. The answers that pass the limit carry the
X-RateLimit-* headers too.
Each API key has its own limit, by default 1,000 requests a minute
(HARDCOUNT_), and 1,000 a second on the
usage routes (HARDCOUNT_). The dashboard
sessions of one account share one limit per mode. The routes under
/ and / (sign-in, password reset, invite
accept, setup) count per client address, by default 100 a minute
(HARDCOUNT_). The public invoice,
payment-update and cost-dashboard pages allow 60 a minute per client
address.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
The id of the request that produced this answer
(req_…). It is normally the same value as the
Hardcount-Request-Id response header. On an answer
replayed for a repeated Idempotency-Key, the body is the
first request’s, so this is the first request’s id, while
the Hardcount-Request-Id header holds the new request’s
id.
The request field or query parameter the error is about. Sent only when the error names one.
A request body may hold only the fields its operation
lists, spelled and cased as listed. Any other field, or one
the server sets (such as id), is refused with 422 and
param naming it. An operation with no request body lists
no fields: send no body, {} or null. The Stripe and
Postmark webhooks and the LiteLLM callback take their
sender’s body as it comes.
Example
{ "error": { "type": "rate_limit_error", "code": "rate_limited", "message": "too many requests — please retry after the rate limit resets", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}Headers
Section titled “Headers”Example
12Seconds to wait before the next request can pass, rounded up to a whole second and at least 1.
Example
1000How many requests the limit allows in its period (a minute, or a second on the usage routes).
Example
0How many requests are left in the current period.
Example
1793870460When the whole limit is available again, as Unix seconds. One
request may pass sooner; Retry-After says when.
Stuck, or found a bug? Ask in Discussions · Open an issue