Create a payment
const url = 'https://api.timbro.dev/v1/payments';const options = { method: 'POST', headers: { 'idempotency-key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"saleReference":"example","amount":{"currency":"DOP","minorUnits":125000},"returnUrl":"https://example.com","serviceLabel":"example","description":"example","fiscalDocument":{"issuanceMode":"required","kind":"consumer","merchantInvoiceNumber":"example","merchantOrderNumber":"example","lines":[{"sourceLineId":"example","description":"example","quantity":"example","measurementUnit":"unit","unitPriceMinorUnits":1,"itemKind":"good","taxTreatment":"itbis_18","isLegalTipApplicable":true,"group":"example"}],"deliveryEmail":"hello@example.com","buyer":{"identityKind":"domestic","taxId":"example"},"governmentEligibility":{"entityKind":"central_government","authorityReference":"example"},"allowedKinds":["consumer"],"isKindLocked":true,"isBuyerLocked":true},"checkoutDisplay":{"mode":"itemized"},"metadata":{"additionalProperty":"example"}}'};
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.timbro.dev/v1/payments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'idempotency-key: example' \ --data '{ "saleReference": "example", "amount": { "currency": "DOP", "minorUnits": 125000 }, "returnUrl": "https://example.com", "serviceLabel": "example", "description": "example", "fiscalDocument": { "issuanceMode": "required", "kind": "consumer", "merchantInvoiceNumber": "example", "merchantOrderNumber": "example", "lines": [ { "sourceLineId": "example", "description": "example", "quantity": "example", "measurementUnit": "unit", "unitPriceMinorUnits": 1, "itemKind": "good", "taxTreatment": "itbis_18", "isLegalTipApplicable": true, "group": "example" } ], "deliveryEmail": "hello@example.com", "buyer": { "identityKind": "domestic", "taxId": "example" }, "governmentEligibility": { "entityKind": "central_government", "authorityReference": "example" }, "allowedKinds": [ "consumer" ], "isKindLocked": true, "isBuyerLocked": true }, "checkoutDisplay": { "mode": "itemized" }, "metadata": { "additionalProperty": "example" } }'Creates the durable money object for one sale and returns the customer-facing next action.
A decline is a successful call: the response is 201 with status: "declined".
An ambiguous provider result is 201 with status: "verifying".
Idempotency-Key is required. Retrying with the same key replays the original
response verbatim for 72 hours; reusing it with a different body returns 409.
saleReference is the merchant's searchable business reference and may be reused by independent commands.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Identity of this create command and its retries. It is distinct from saleReference. Printable ASCII. Required.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Merchant-owned searchable business reference. It may equal Idempotency-Key, but it need not be unique and does not identify command retries.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Example
DOPAmount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
Example
125000Optional merchant web destination offered after Checkout. Omit for QR or POS checkout.
Merchant-authored context label such as Mesa 12.
Concise product or service description. Required when Checkout displays only an amount.
object
required keeps organizer Checkout open until issuance; deferred shows the paid receipt while issuance and retries continue.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
Responses
Section titled “Responses”The one durable money object for one sale.
The one durable money object for one sale.
object
Payment identifier. Opaque; do not parse beyond the prefix.
partially_authorized means some shares have reserved funds, authorized means every share is reserved and awaits the organizer's capture command, capturing means capture is running, and releasing means reserved funds are being released. verifying is a real, non-terminal status; it is not an error or decline.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
Merchant-owned searchable business reference. It is immutable after create, need not be unique, and does not identify command retries.
Merchant web destination offered after Checkout. Payment status must be retrieved from the API.
Merchant-authored context label such as Mesa 12.
Concise description of the product or service being purchased.
Server-computed money composition. The only totals a checkout page renders.
object
object
object
object
Read-only checkout presentation assembled from merchant configuration.
object
object
object
object
object
object
Card brands certified for this Payment's Merchant Account snapshot.
3-D Secure programs selected for this immutable Payment journey. An empty list means card submission does not use 3DS.
Unpredictable bearer handle for the full receipt projection after terminal payment. Possession reveals buyer identity and itemization; keep it private.
Send the customer to the hosted checkout page.
object
Open in a top-level browsing context.
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Fiscal document identifier.
Payment that requested the fiscal document.
Whether fiscal issuance is required before Checkout presents the purchase as complete or may finish after the paid receipt is shown.
object
Whether this line belongs to the merchant's mandatory legal-tip base. Non-billable lines cannot be eligible.
object
object
object
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
object
Stable merchant-safe classification of a fiscal-document problem.
object
Stable merchant-safe classification of a fiscal-document problem.
object
Reconciliation progress while status is verifying.
object
object
object
object
object
Aggregate split state. captured is settled money; authorized is reserved money; releasing and released describe authorization release.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
object
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
A monetary amount. Never a floating-point number.
object
ISO 4217 alphabetic code.
Amount in base-10 minor units of currency. DOP and USD use two decimal places, so 125000 is 1,250.00.
Authorization and capture state for one share. authorized means funds are reserved; succeeded means the reservation was captured.
object
object
object
object
Example
{ "object": "payment", "status": "requires_customer_action", "amount": { "currency": "DOP", "minorUnits": 125000 }, "voluntaryTip": { "currency": "DOP", "minorUnits": 125000 }, "totalAmount": { "currency": "DOP", "minorUnits": 125000 }, "breakdown": { "taxableBases": [ { "taxTreatment": "itbis_18" } ], "serviceCharges": [ { "kind": "propina_legal" } ] }, "checkoutDisplay": { "mode": "itemized", "merchant": { "deliveryPolicy": { "kind": "not_offered" } }, "fiscal": { "availableKinds": [ { "kind": "consumer", "buyerRequirement": "none" } ] }, "wallets": [ "apple_pay" ], "acceptedCardBrands": [ "visa" ], "threeDsPrograms": [ "visa_secure" ] }, "nextAction": { "kind": "redirect_to_url" }, "decline": { "code": "insufficient_funds" }, "fiscalDocument": { "object": "fiscal_document", "kind": "consumer", "issuanceMode": "required", "buyer": { "identityKind": "domestic" }, "governmentEligibility": { "entityKind": "central_government" }, "lines": [ { "measurementUnit": "unit", "itemKind": "good", "taxTreatment": "itbis_18" } ], "delivery": { "status": "waiting_for_document" }, "status": "requested" }, "paymentMethodSummary": { "kind": "card" }, "split": { "status": "open", "captured": { "currency": "DOP", "minorUnits": 125000 }, "authorized": { "currency": "DOP", "minorUnits": 125000 }, "remainingToAuthorize": { "currency": "DOP", "minorUnits": 125000 }, "remainingToCapture": { "currency": "DOP", "minorUnits": 125000 }, "parts": [ { "amount": { "currency": "DOP", "minorUnits": 125000 }, "allocatedItbis": { "currency": "DOP", "minorUnits": 125000 }, "status": "unpaid", "paymentMethodSummary": { "kind": "card" } } ] }}The request could not be understood or is not valid for this merchant account.
The request could not be understood or is not valid for this merchant account.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "invalid_request", "code": "parameter_missing" }}The credential is missing, malformed, or no longer valid.
The credential is missing, malformed, or no longer valid.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "authentication_error", "code": "api_key_missing" }}The credential is valid but not permitted to perform this operation on this resource.
The credential is valid but not permitted to perform this operation on this resource.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "permission_error", "code": "merchant_account_not_owned" }}No endpoint serves this method and path, or no resource with this identifier exists within the caller's tenant.
No endpoint serves this method and path, or no resource with this identifier exists within the caller's tenant.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "invalid_request", "code": "endpoint_not_found" }}The request conflicts with the current state of the resource or with a previous request using the same Idempotency-Key.
The request conflicts with the current state of the resource or with a previous request using the same Idempotency-Key.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "conflict_error", "code": "idempotency_key_reused" }}Default Response
The request is well-formed but cannot be carried out for this payment or this merchant account.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
The taxpayer cannot be used for this fiscal operation.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "invalid_request", "code": "merchant_account_not_ready" }}Too many requests. Retry after the interval in the Retry-After header.
Too many requests. Retry after the interval in the Retry-After header.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "rate_limit_error", "code": "rate_limit_exceeded" }}The gateway failed before reaching a payment outcome. Retry with the same Idempotency-Key.
The gateway failed before reaching a payment outcome. Retry with the same Idempotency-Key.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "api_error", "code": "internal_error" }}The payment provider rejected the request or could not be reached before anything was submitted. Safe to retry with the same Idempotency-Key.
The payment provider rejected the request or could not be reached before anything was submitted. Safe to retry with the same Idempotency-Key.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "provider_error", "code": "provider_unavailable" }}A required Gateway dependency is temporarily unavailable. The request is safe to retry.
A required Gateway dependency is temporarily unavailable. The request is safe to retry.
object
object
Stable machine-readable code. Branch on this, never on message.
Human-readable. Wording may change; not a stable contract.
Dotted path to the offending request field.
Correlation id, also returned as the Request-Id header.
Example
{ "error": { "type": "api_error", "code": "taxpayer_directory_unavailable" }}