Create a merchant webhook endpoint
const url = 'https://api.timbro.dev/v1/webhook_endpoints';const options = { method: 'POST', headers: { 'idempotency-key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"url":"https://example.com","enabledEvents":["payment.succeeded"]}'};
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/webhook_endpoints \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'idempotency-key: example' \ --data '{ "url": "https://example.com", "enabledEvents": [ "payment.succeeded" ] }'Registers an HTTPS endpoint for signed domain events. The signing secret is returned only in this response.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
HTTPS endpoint that receives signed events.
Responses
Section titled “Responses”The endpoint and its signing secret. Store the secret securely.
The endpoint and its signing secret. Store the secret securely.
object
Webhook endpoint identifier.
Signing secret. Shown only at creation.
Example
{ "object": "webhook_endpoint", "enabledEvents": [ "payment.succeeded" ]}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" }}The request is well-formed but cannot be carried out for this payment or this merchant account.
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.
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" }}