`POST /v1/invoices/{id}/payment-link`
const url = 'https://api.asap.cool/v1/invoices/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/payment-link';const options = {method: 'POST', headers: {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 https://api.asap.cool/v1/invoices/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/payment-link \ --header 'Authorization: Bearer <token>'Generate (or confirm) the shareable online payment link for a finalized,
link-eligible invoice/deposit. Double-gated: Stripe must be configured
(503 stripe_disabled) and the org must have a connected Stripe account
(409 stripe_account_required). A non-link-eligible document (draft / quote
/ cancelled) yields 409 not_payable.
Authorizations
Section intitulée « Authorizations »Parameters
Section intitulée « Parameters »Path Parameters
Section intitulée « Path Parameters »Document identifier.
Responses
Section intitulée « Responses »Payment link ready (freshly minted or already existing).
Response of POST /v1/invoices/{id}/payment-link.
The link token is generate-once for the lookup key (SHA-256 hash), plus a
sealed copy of the clear token for owner recovery. On the first call the
freshly minted url is returned (already_exists: false). A later idempotent
call finds the existing link and returns already_exists: true, carrying the
same url when the sealed token could be decrypted (owner re-copy), or
url: None when it is unrecoverable (a pre-migration token, a missing key, or
a decrypt failure — graceful fallback).
object
true when the document already had a payment link (idempotent replay).
Optional link expiry (None = durable in V1).
Shareable public payment URL ({FRONTEND}/pay/{token}). Present when the
link was freshly minted or successfully recovered for re-copy.
Example generated
{ "already_exists": true, "expires_at": "example", "url": "example"}No active org.
Generic error body returned by API handlers when they fail. code is a
stable machine-readable token; message is human-friendly and meant for
surfacing to end users.
object
Stable machine token (e.g. invalid_credentials).
Offending request field for validation errors, when known.
Human-readable message.
Example generated
{ "code": "example", "field": "example", "message": "example"}Missing invoice:write scope.
Generic error body returned by API handlers when they fail. code is a
stable machine-readable token; message is human-friendly and meant for
surfacing to end users.
object
Stable machine token (e.g. invalid_credentials).
Offending request field for validation errors, when known.
Human-readable message.
Example generated
{ "code": "example", "field": "example", "message": "example"}Not found or cross-org.
Generic error body returned by API handlers when they fail. code is a
stable machine-readable token; message is human-friendly and meant for
surfacing to end users.
object
Stable machine token (e.g. invalid_credentials).
Offending request field for validation errors, when known.
Human-readable message.
Example generated
{ "code": "example", "field": "example", "message": "example"}Org has no connected Stripe account, or the document is not link-eligible.
Generic error body returned by API handlers when they fail. code is a
stable machine-readable token; message is human-friendly and meant for
surfacing to end users.
object
Stable machine token (e.g. invalid_credentials).
Offending request field for validation errors, when known.
Human-readable message.
Example generated
{ "code": "example", "field": "example", "message": "example"}Stripe is not configured on this instance.
Generic error body returned by API handlers when they fail. code is a
stable machine-readable token; message is human-friendly and meant for
surfacing to end users.
object
Stable machine token (e.g. invalid_credentials).
Offending request field for validation errors, when known.
Human-readable message.
Example generated
{ "code": "example", "field": "example", "message": "example"}