PayclaveDocs

Payclave developers

API basics

Request formats, response envelopes, timestamps, pagination, and versioning.

Send requests

Send JSON bodies with Content-Type: application/json and authenticate with your API key. Replace path placeholders such as :id with an identifier from a previous response; do not send the colon or invent an ID from the customer's order number. Optional query parameters go in the URL, not in a GET request body.

Send monetary values as decimal strings with at most six fractional digits. For example, use "25.00" rather than calculating a value with floating-point arithmetic in the browser. Use RFC 3339 timestamps for dates and retain the timezone offset or use UTC. Each route documents its own allowed fields and limits.

Responses and errors

The API base URL is https://api.payclave.com. Success responses contain success, data, and meta.requestId. Errors contain success: false, error.code, error.message, optional details, and the request ID. File download routes return bytes.

json
{  "success": false,  "error": {    "code": "INVALID_AMOUNT",    "message": "Amount must be a positive value with up to 6 decimal places."  },  "meta": {    "requestId": "req_..."  }}

Check the HTTP status before reading data. A successful creation response means Payclave created a record; it does not mean the customer has paid. HTTP 202 means the operation was accepted for processing. Follow the returned record or status URL until the operation reaches the state your application needs.

Use error.code for application decisions and show the customer a useful recovery action. A message may change as validation improves. Keep meta.requestId or the X-Request-Id header in your server logs alongside your order ID, without recording keys or webhook secrets.

typescript
import {  createPayclaveServerClient,  PayclaveError,} from "@payclave/sdk-server"
const payclave = createPayclaveServerClient({ secretKey: process.env.PAYCLAVE_SECRET_KEY!,})
try { const session = await payclave.createCheckoutSession({ amount: "25.00", externalReference: "order_8431", idempotencyKey: "order_8431", })
return Response.json({ checkoutUrl: session.checkoutUrl })} catch (error) { if (error instanceof PayclaveError) { console.error(error.code, error.status, error.requestId, error.details)
if (error.code === "RATE_LIMIT_EXCEEDED" || error.status >= 500) { // Retry later with the same Idempotency-Key. } }
throw error}

Retries and pagination

An idempotency key identifies one intended operation. Derive it from a stable order or action ID and save it before sending the request. For example, checkout creation and invoice issuance are different operations and should have different keys. Double-clicks and network retries for the same operation should reuse its original key.

Pass an Idempotency-Key for supported mutations. Retry the same operation with the same key and unchanged payload. Treat conflicts as a request to inspect the existing record, rather than repeating irreversible work.

On HTTP 429, wait at least Retry-After seconds. Respect the advertised RateLimit and RateLimit-Policy headers; no advertised quota does not mean unlimited capacity. Retry transient server failures with backoff and the same idempotency key.

Pagination is route-specific. Follow hasMore and nextCursor where offered, and keep cursors in their original merchant and mode. See each endpoint in the complete HTTP reference.

When hasMore is true, send the returned nextCursor as startingAfter to fetch the next page. Keep the same filters and key mode. Stop when hasMore is false. Do not assume that every list accepts the same cursor fields; diagnostic session lists use a different, bounded response.

Additive API changes
Accept unknown optional response fields and future error codes. Breaking changes use a new major URL prefix. See the API versioning policy.

Additional API errors

CodeMeaning
ACCOUNT_SUSPENDEDThe merchant account cannot perform this operation. Resolve the account status before retrying.
ACTIVE_MERCHANT_REQUIREDComplete merchant activation before using this live capability.
CURRENCY_MISMATCHUse the active mode's configured settlement token.
CUSTOMER_EMAIL_REQUIREDAdd a valid customer email before sending the invoice or reminder.
INVOICE_ALREADY_ISSUEDThe draft is already issued. Retrieve the existing invoice.
INVOICE_NOT_EDITABLEThe invoice's commercial fields are locked. Create or duplicate a draft instead.
INVOICE_NOT_PAYABLEThe invoice has no eligible collectible remainder or is closed.
INVOICE_PDF_UNAVAILABLEThe invoice PDF cannot currently be generated. Retain the request ID and retry only if transient.
INVOICE_VERSION_CONFLICTRead the latest invoice version and reconcile your edits before retrying.
INVALID_TOTALCorrect the invoice line, discount or tax values so the commercial total is valid.
FEATURE_UNAVAILABLEThis capability is not enabled for this merchant or is temporarily unavailable.
PERMISSION_DENIEDThe authenticated caller lacks permission for the requested operation.
REQUEST_TOO_LARGEReduce the request body to the endpoint's supported size; the HTTP status is 413.
EXPORT_CANCELLEDThe export was cancelled and cannot be downloaded. Create a new export if needed.
EXPORT_EXPIREDThe export file is no longer available. Create a new export.
EXPORT_NOT_READYPoll the export status until ready before downloading.
EXPORT_RANGE_TOO_LARGESplit the time range into intervals of at most 366 days.
EXPORT_SCHEMA_UNSUPPORTEDUse the supported reconciliation schema version returned by the schema endpoint.
EXPORT_TOO_LARGE_FOR_SYNCUse an asynchronous export or narrow the summary query.
SECRET_OVERLAP_ACTIVEResolve the current signing-secret overlap before rotating again.
SECRET_OVERLAP_EXPIREDThe previous signing-secret overlap has already ended or expired.
WEBHOOK_ENDPOINT_DISABLEDEnable the endpoint before attempting delivery or replay.
WEBHOOK_INCIDENT_NOT_FOUNDThe incident does not exist in the merchant and mode scope.

On this page