PayclaveDocs

Payclave developers

Errors and troubleshooting

Interpret API and SDK errors and choose a recovery action.

Read the HTTP status and error code

API failures use success:false, error.code, error.message, optional details, and meta.requestId. Keep the machine code and request ID in server logs. Do not depend on exact human message wording or assume an unknown future error code is success.

json
{  "success": false,  "error": {    "code": "INVALID_AMOUNT",    "message": "Amount must be a positive value with up to 6 decimal places."  },  "meta": {    "requestId": "req_..."  }}
StatusRecovery
400 / 422Correct the request fields, amount, or validation issue before retrying.
401Check the credential and authentication header. Never log the secret.
403Check merchant access, key type, and permission. Do not bypass it with a more powerful browser credential.
404Check the returned ID, merchant ownership, and test/live mode.
409Read the current record and resolve version, reservation, or idempotency conflicts.
429Honor Retry-After and reduce request concurrency.
5xx / network timeoutTreat the outcome as uncertain. Retry only under the route's idempotency contract.

Handle errors in your SDK integration

Catch PayclaveError and retain code, status, requestId, and redacted details. A failed creation response does not prove that no record was created. Keep the same operation key while recovering its outcome.

For FEATURE_UNAVAILABLE, confirm that the feature is enabled for this merchant and mode. For wallet or destination errors, review the configured settlement wallet. For webhook signature failures, verify the raw body and endpoint secret before replaying deliveries.

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}

On this page