Payclave

Payclave API Documentation

Use the Payclave API to create checkout sessions, issue invoices, verify payment records, and deliver signed webhook events while funds move directly from the customer wallet to the merchant wallet.

Getting started

Create your merchant profile, generate API keys from the dashboard, and send customers to Payclave hosted checkout. Test mode is simulated end to end. No wallet setup is required; you add your live settlement wallet when you activate the account. Payclave handles checkout orchestration and marks invoices paid only after independent onchain verification.

Guides

Authentication

Learn how public and secret API keys authenticate requests.

Read more

Checkout sessions

Create Payclave-hosted checkout links for customer payment.

Read more

Webhooks

Receive signed invoice and payment lifecycle events.

Read more

Errors

Handle Payclave error envelopes and request ids.

Read more

Playground

Run live test-mode requests and inspect the responses.

Read more

Resources

Checkout sessions

Create hosted checkout pages for customer payment.

Invoices

Create and inspect durable invoice records.

Payment links

Publish reusable or single-use customer payment pages.

Payments

Read detected and verified payment records.

Webhooks

Register endpoints and inspect delivery attempts.

Quickstart

The recommended production integration starts on your server. Create a checkout session with a secret key, then redirect the customer to the returned hosted checkout URL.

Use a stable Idempotency-Key when creating checkout sessions so a network retry does not create duplicate merchant-side effects. Reuse it only with the same request payload.
The server examples use merchant-owned requireUser and loadPayableOrderForUser helpers. Implement those to authenticate the request, authorize access to the order, reject already-fulfilled orders and load the trusted price from your own order records. Browser input should identify the order, not set its amount.

Create a checkout session

POST/v1/checkout-sessions
ShellRuns on server
curl https://api.payclave.com/v1/checkout-sessions \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_8431" \
  -d '{
    "amount": "25.00",
    "customerEmail": "customer@example.com",
    "externalReference": "order_8431",
    "successUrl": "https://merchant.example/orders/8431/success",
    "cancelUrl": "https://merchant.example/cart",
    "metadata": { "cartId": "cart_8431" }
  }'

Payclave SDKs

The recommended way to integrate Payclave checkout is by using one of our official SDKs. Browser libraries cover public-key checkout flows, while the TypeScript server SDK supports backend checkout-session and invoice creation with secret keys.

Install packages

Shell
npm install @payclave/sdk-server@0.1.1
npm install @payclave/sdk-js@0.1.1
npm install @payclave/sdk-react@0.1.1

Official libraries

JavaScript

@payclave/sdk-js v0.1.1

Runs in browser

Browser SDK for checkout sessions, redirects, and mounted payment buttons.

Read more

React

@payclave/sdk-react v0.1.1

Runs in browser

React SDK with checkout button and hook for client-side payment UI.

Read more

TypeScript server

@payclave/sdk-server v0.1.1

Runs on server

TypeScript server SDK for checkout sessions, amount-only invoices, payment reads, and basic webhook operations.

Read more

Browser checkout

TypeScriptv0.1.1Runs in browser
import { createPayclaveClient } from "@payclave/sdk-js"

const payclave = createPayclaveClient({
  publicKey: "pk_test_...",
})

await payclave.redirectToCheckout({
  amount: "25.00",
  reference: "order_8431",
  idempotencyKey: "order_8431",
})
Browser examples use a publishable key and can send only the amount and external reference. Create production checkout sessions on your server when the merchant must control the order amount or protected fields.

SDK behavior and options

  • Name
    Server client
    Description
    createPayclaveServerClient requires secretKey. Optional apiBaseUrl defaults to https://api.payclave.com. fetcher injects a fetch implementation; timeoutMs sets a positive request timeout. Per-call signal supports cancellation. Methods unwrap data and throw PayclaveError for API or validation failures. Use HTTP for binary downloads. No automatic retries are performed.
  • Name
    Browser client
    Description
    createPayclaveClient requires publicKey and supports apiBaseUrl, fetcher, timeoutMs and redirect. createCheckoutSession returns the session; redirectToCheckout also navigates to checkoutUrl. amount and reference are required; reference maps to externalReference. idempotencyKey and signal are optional.
  • Name
    Vanilla button
    Description
    Import mountPayclaveButton from @payclave/sdk-js and pass a DOM target, publicKey, amount and reference. Optional label, className and onError customize it. Call the returned destroy() when removing the integration. Use the published package with your bundler; a CDN script URL is not part of this documented integration.
  • Name
    React
    Description
    PayclaveCheckoutButton accepts the browser options, amount, reference, label, pendingLabel, onPending, onSuccess and onError, plus button attributes. onSuccess means a checkout session was created and redirected, not that payment was confirmed. usePayclaveCheckout returns a function that creates and redirects to checkout.

Server SDK methods

The methods below are verified against the published @payclave/sdk-server@0.1.1 package. Reads take an id; create methods take their input object. Send idempotencyKey as an SDK option. listWebhookDeliveries supports only limit in this release. Use HTTP for itemized invoices and their actions, PDFs, payment links, endpoint management, delivery filtering and replay, reconciliation and diagnostics. The published types also omit newer cumulative money fields; read the full HTTP response when you need those fields.

The 0.1.1 SDK event-type constant includes only the five original payment events. Use HTTP to subscribe to the newer invoice and payment-link events listed in the webhook guide. Signature verification accepts event types beyond that constant. Do not cast an unsupported SDK method into existence; use the HTTP contract.
  • Name
    Checkout
    Description
    createCheckoutSession, getCheckoutSession, getPayment
  • Name
    Invoices
    Description
    createInvoice, getInvoice
  • Name
    Webhooks
    Description
    createWebhookEndpoint, createTestWebhook, listWebhookDeliveries

Authentication

Send API keys as a bearer token in theAuthorizationheader or throughX-API-Key. Dashboard sign-up and email verification are separate from API-key authentication. Publishable keys can create and read checkout sessions only. A publishable-key create request may contain onlyamount andexternalReference. Secret keys can set the complete checkout-session request and are required for invoices, payment reads, and webhook endpoints.

Authenticate a request

Shell
curl https://api.payclave.com/v1/invoices/INV-PCLV-17791920002731 \
  -H "Authorization: Bearer sk_test_..."

curl https://api.payclave.com/v1/checkout-sessions/chk_pclv_example \
  -H "X-API-Key: pk_test_..."
  • Name
    pk_test_*
    Description
    Public test key for browser checkout creation.
  • Name
    sk_test_*
    Description
    Secret test key for server-side API calls.
  • Name
    pk_live_*
    Description
    Public live key for live checkout creation.
  • Name
    sk_live_*
    Description
    Secret live key. Keep this on your backend only.

API basics

  • Name
    Base URL and format
    Description
    Use https://api.payclave.com with /v1 paths. Send Content-Type: application/json on JSON requests. Successful responses contain success:true, data and meta.requestId; errors contain success:false, error.code, error.message, optional error.details and meta.requestId. Preserve X-Request-Id for support. File downloads are exceptions to the envelope.
  • Name
    Keys and mode
    Description
    The API key determines the merchant and test/live mode. IDs from another merchant or mode cannot be used interchangeably. Create keys in the dashboard and store secret keys in server environment variables. Never put them in NEXT_PUBLIC variables, client bundles, logs or URLs. Use only the minimum public-key flow when the browser may choose the amount.
  • Name
    Amounts and settlement
    Description
    Send amounts as decimal strings with at most 6 fractional digits, not JSON numbers or atomic token units. Polygon chain ID is 137. Settlement uses the active mode's configured USDC or USDT token. Direct checkout creation does not accept a currency or destination override. Store amounts as decimal strings or exact decimal values; do not sum them with floating-point arithmetic.
  • Name
    Totals versus received payments
    Description
    total is the commercial invoice total. customerAmountPaid and customerAmountRemaining describe cumulative credited customer payments. amountDue on a checkout can represent only the remaining payment. expectedMerchantSettlement and netAmount describe expected net receipts; merchantAmountSettled describes actual verified merchant receipts. platformFee is the merchant-absorbed fee. For fulfillment compare the invoice and your order; for reconciliation compare actual receipts with expected net settlement. Do not interpret a source-chain amount or transaction hash as proof of settlement.
  • Name
    Identifiers and timestamps
    Description
    Treat IDs as opaque. Persist the id, invoiceId, checkoutId, checkoutUrl and hostedInvoiceUrl returned for each operation instead of constructing IDs or URLs. Dates are RFC 3339 timestamps; examples show UTC. A due date is a collection deadline; checkout expiry limits one payment session.

Idempotency and safe retries

Supply an Idempotency-Key when retrying supported create or mutation operations. Use a unique key per business operation and reuse it only for the same method, resource and payload. Keys contain visible ASCII with no spaces and at most 255 characters. Webhook replay requires at least 8 characters. Public invoice and payment-link checkout submissions require a key. Most authenticated mutations accept one optionally. Use HTTP for mutation methods that are not in the published SDK.

Creating webhook endpoints and synthetic test webhooks does not support idempotent replay. Sending a header does not make those operations safe to retry blindly. List existing endpoints or deliveries first if a request outcome is uncertain.

The shared mutation replay window is 24 hours. An eligible replay includesIdempotency-Replayed: true. Checkout and invoice creation use resource-specific duplicate detection; do not assume a universal retention period. Changed input returns IDEMPOTENCY_KEY_CONFLICT. If a matching operation is still in progress, wait and retry the same request. Retry transient network failures, 429 responses and 5xx errors with backoff and jitter only when the operation is retry-safe. Respect Retry-After when present. The SDK does not automatically retry requests. Do not retry validation or permission errors unchanged.

Pagination and limits

Invoice, payment-link and export lists return items, hasMore and nextCursor inside data. Send nextCursor as startingAfter and keep the same filters. Use limit between 1 and 100; the default is 25. Other list routes can return arrays without cursors; consult the endpoint reference instead of assuming every list supports pagination. Request bodies have a 1 MiB global ceiling and many mutation routes have smaller limits; 413 indicates an oversized body.

  • Name
    Publishable-key checkout creation
    Description
    20 requests per minute per key and client address.
  • Name
    Public invoice and payment-link reads
    Description
    120 requests per minute per client address for each resource family.
  • Name
    Public checkout submissions
    Description
    10 requests per minute per client address and public invoice token or payment-link id.
A 429 can use RATE_LIMIT_EXCEEDED or RATE_LIMITED depending on the route. Respect the returned Retry-After header rather than treating these limits as a guaranteed throughput allowance.

Test the complete integration

  1. Create a merchant account and test credentials in the dashboard. Test mode uses simulated payments and needs no real tokens or funded wallet.
  2. Create a checkout from your backend using a stored, authorized order and a stable idempotency key. Save the returned invoice and checkout IDs.
  3. Open checkoutUrl and test paid, underpaid, overpaid, failed and expired outcomes in the playground. Retry the same creation request to check duplicate handling.
  4. Create a test-mode webhook endpoint. Save signingSecret immediately. Verify delivery using /v1/webhooks/test, but reject data.test events from order fulfillment.
  5. Complete a simulated checkout to test actual invoice lifecycle events. Verify raw-body signatures and mode, persist event acceptance, and fulfill each order only once.
  6. Test duplicate delivery, temporary endpoint failure, replay and secret rotation. Verify that failed acceptance returns a non-2xx response and that retries do not repeat fulfillment.
  7. Read the invoice from your server after a redirect. Confirm it matches the order amount, currency and mode. A success-page visit alone must never mark an order paid.
Test and live records, keys, endpoints and secrets are separate. Synthetic test deliveries are distinct from simulated checkout lifecycle events. Test results do not prove that live onchain payment works; complete activation and a small live payment before launch.

Go-live checklist

Complete the test flow before creating live credentials. Treat test and live modes as separate integrations.

  1. Create a test merchant profile and keep the test public and secret keys in separate client and server configuration.
  2. Create a test checkout session from your server and open the returned Payclave checkout URL from your customer flow.
  3. Verify the raw webhook request body with the endpoint secret before parsing or trusting the event.
  4. Accept each webhook event and queue fulfillment in one durable transaction; deduplicate event IDs and order fulfillment.
  5. Register a test webhook endpoint, send a test event, and confirm delivery status, retry behavior, and replay handling.
  6. Request live activation and configure the live USDC or USDT settlement wallet on Polygon.
  7. Create separate live API keys and webhook secrets. Never copy test credentials into live configuration.
  8. Use HTTPS success and cancel URLs that you control, and confirm each live redirect destination before launch.
  9. Run a small live payment and compare the invoice total, customer credit, platform fee, expected net settlement and actual merchant receipt.
  10. Fulfill only after checking a non-synthetic invoice.paid event or authoritative invoice read against your stored order, amount, currency and live mode. Retain meta.requestId for support.

Errors

All API responses include asuccessboolean and a request id inmeta.requestId. Error responses use 400 for invalid input, 401 for missing or invalid credentials, 403 for forbidden key capabilities, 409 for mode or state conflicts, 422 when a valid request cannot be processed, and 429 for rate limits. The same request ID is returned inX-Request-Id.

Error response

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

Handling errors

Branch on the stableerror.codevalue, logmeta.requestIdfor support, and keeperror.detailsfor field-level context. Retry only timeout, network, 429, and 5xx failures, and reuse the sameIdempotency-Keyfor retrying a checkout-session or invoice creation request.

ARATE_LIMIT_EXCEEDEDresponse can include aRetry-Afterheader. Treat validation, authentication, forbidden, not-found, and state-conflict errors as terminal until the request input or merchant configuration changes.

Handle SDK errors

TypeScriptv0.1.1Runs on server
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
}

API error codes

  • Name
    ACCOUNT_SUSPENDED
    Description
    The merchant account cannot perform this operation. Resolve the account status before retrying.
  • Name
    ACTIVE_MERCHANT_REQUIRED
    Description
    Complete merchant activation before using this live capability.
  • Name
    CURRENCY_MISMATCH
    Description
    Use the active mode's configured settlement token.
  • Name
    CUSTOMER_EMAIL_REQUIRED
    Description
    Add a valid customer email before sending the invoice or reminder.
  • Name
    INVOICE_ALREADY_ISSUED
    Description
    The draft is already issued. Retrieve the existing invoice.
  • Name
    INVOICE_NOT_EDITABLE
    Description
    The invoice's commercial fields are locked. Create or duplicate a draft instead.
  • Name
    INVOICE_NOT_PAYABLE
    Description
    The invoice has no eligible collectible remainder or is closed.
  • Name
    INVOICE_PDF_UNAVAILABLE
    Description
    The invoice PDF cannot currently be generated. Retain the request ID and retry only if transient.
  • Name
    INVOICE_VERSION_CONFLICT
    Description
    Read the latest invoice version and reconcile your edits before retrying.
  • Name
    INVALID_TOTAL
    Description
    Correct the invoice line, discount or tax values so the commercial total is valid.
  • Name
    FEATURE_UNAVAILABLE
    Description
    This capability is not enabled for this merchant or is temporarily unavailable.
  • Name
    PERMISSION_DENIED
    Description
    The authenticated caller lacks permission for the requested operation.
  • Name
    REQUEST_TOO_LARGE
    Description
    Reduce the request body to the endpoint's supported size; the HTTP status is 413.
  • Name
    EXPORT_CANCELLED
    Description
    The export was cancelled and cannot be downloaded. Create a new export if needed.
  • Name
    EXPORT_EXPIRED
    Description
    The export file is no longer available. Create a new export.
  • Name
    EXPORT_NOT_READY
    Description
    Poll the export status until ready before downloading.
  • Name
    EXPORT_RANGE_TOO_LARGE
    Description
    Split the time range into intervals of at most 366 days.
  • Name
    EXPORT_SCHEMA_UNSUPPORTED
    Description
    Use the supported reconciliation schema version returned by the schema endpoint.
  • Name
    EXPORT_TOO_LARGE_FOR_SYNC
    Description
    Use an asynchronous export or narrow the summary query.
  • Name
    SECRET_OVERLAP_ACTIVE
    Description
    Resolve the current signing-secret overlap before rotating again.
  • Name
    SECRET_OVERLAP_EXPIRED
    Description
    The previous signing-secret overlap has already ended or expired.
  • Name
    WEBHOOK_ENDPOINT_DISABLED
    Description
    Enable the endpoint before attempting delivery or replay.
  • Name
    WEBHOOK_INCIDENT_NOT_FOUND
    Description
    The incident does not exist in the merchant and mode scope.
  • Name
    API_KEY_REQUIRED
    Description
    No API key was sent with a protected merchant API request.
  • Name
    INVALID_API_KEY
    Description
    The API key is malformed, revoked, expired, or not found.
  • Name
    API_KEY_FORBIDDEN
    Description
    The key is valid but cannot access the requested endpoint.
  • Name
    PUBLIC_KEY_FIELD_NOT_ALLOWED
    Description
    A publishable key tried to set a field reserved for secret-key requests.
  • Name
    MODE_MISMATCH
    Description
    A test key requested a live resource, or a live key requested a test resource.
  • Name
    AUTH_REQUIRED
    Description
    A dashboard session is required for this web app request.
  • Name
    INVALID_CREDENTIALS
    Description
    An email/password sign-in attempt did not match a verified Payclave user.
  • Name
    AUTH_FORBIDDEN
    Description
    The signed-in user cannot access the selected merchant.
  • Name
    VALIDATION_ERROR
    Description
    The request body or query parameters failed validation.
  • Name
    INVALID_AMOUNT
    Description
    Amount is not a valid positive decimal.
  • Name
    INVALID_EXPIRY
    Description
    Checkout or invoice expiry is outside the accepted range.
  • Name
    INVALID_IDEMPOTENCY_KEY
    Description
    Idempotency-Key is empty, too long, or contains invalid characters.
  • Name
    IDEMPOTENCY_KEY_CONFLICT
    Description
    The same Idempotency-Key was used with a different request.
  • Name
    DEFAULT_WALLET_REQUIRED
    Description
    The merchant must configure an active settlement wallet.
  • Name
    UNSUPPORTED_DEFAULT_WALLET
    Description
    The configured settlement wallet is not supported for this flow.
  • Name
    WALLET_PAYMENTS_UNAVAILABLE
    Description
    Payment orchestration is unavailable in this environment.
  • Name
    CHECKOUT_SESSION_NOT_PAYABLE
    Description
    The checkout is expired, terminal, or not ready for payment.
  • Name
    NOT_FOUND
    Description
    The requested checkout session, invoice, payment, or resource was not found.
  • Name
    INVOICE_NOT_FOUND
    Description
    The invoice record could not be found.
  • Name
    INVOICE_STATE_MISMATCH
    Description
    The invoice changed state before the requested operation completed.
  • Name
    INVOICE_TRANSITION_GUARD_FAILED
    Description
    The requested invoice status transition is not allowed.
  • Name
    PAYMENT_LINK_NOT_FOUND
    Description
    The mode-scoped payment link could not be found.
  • Name
    PAYMENT_LINK_VERSION_CONFLICT
    Description
    The payment link was edited after the supplied optimistic version was read.
  • Name
    LINK_INACTIVE
    Description
    The payment link is not currently available for checkout.
  • Name
    LINK_EXPIRED
    Description
    The payment link has passed its configured expiry.
  • Name
    LINK_ALREADY_USED
    Description
    A single-use payment link already completed a payment.
  • Name
    LINK_RESERVED
    Description
    A single-use payment link is already reserved by another invoice.
  • Name
    AMOUNT_OUT_OF_RANGE
    Description
    The customer-entered amount is outside the link's allowed range.
  • Name
    FIELD_REQUIRED
    Description
    A customer field required by the payment link is missing.
  • Name
    MODE_UNAVAILABLE
    Description
    The public payment-link mode is unavailable.
  • Name
    CONFIG_CHANGED
    Description
    The public page version is stale because the merchant edited the link.
  • Name
    RATE_LIMITED
    Description
    The public payment-link view or submission limit was reached.
  • Name
    INVALID_WALLET_ADDRESS
    Description
    A wallet or token address is not a valid EVM address.
  • Name
    INVALID_TX_HASH
    Description
    The transaction hash is not a valid EVM transaction hash.
  • Name
    INVALID_WALLET_PAYMENT_ATTEMPT
    Description
    Wallet payment intent, signature, source token, or source chain input is invalid.
  • Name
    INVALID_DEPOSIT_NETWORK
    Description
    The requested scan-or-copy deposit network is not supported.
  • Name
    SCAN_OR_COPY_UNAVAILABLE
    Description
    Scan-or-copy payment instructions are temporarily unavailable for the selected route.
  • Name
    REQUEST_ERROR
    Description
    An upstream provider request failed or returned an unusable response.
  • Name
    WEBHOOK_ENDPOINT_NOT_FOUND
    Description
    The webhook endpoint could not be found.
  • Name
    WEBHOOK_DELIVERY_NOT_FOUND
    Description
    The webhook delivery could not be found.
  • Name
    WEBHOOK_EVENT_UNSUPPORTED
    Description
    The webhook event type is unsupported or not enabled for the endpoint.
  • Name
    WEBHOOK_SIGNATURE_INVALID
    Description
    A received provider webhook signature is missing or invalid.
  • Name
    RATE_LIMIT_EXCEEDED
    Description
    The request exceeded the current endpoint or key rate limit.
  • Name
    INTERNAL_SERVER_ERROR
    Description
    Payclave could not complete the request because of an internal failure.
  • Name
    INTERNAL_JOB_UNAUTHORIZED
    Description
    The internal job runner endpoint was called without valid authorization.

SDK error codes

  • Name
    INVALID_PUBLIC_KEY
    Description
    Browser SDK received an invalid pk_test or pk_live key.
  • Name
    INVALID_SECRET_KEY
    Description
    Server SDK received an invalid sk_test or sk_live key.
  • Name
    INVALID_API_BASE_URL
    Description
    Server SDK apiBaseUrl must be a valid http or https URL without query or hash parts.
  • Name
    INVALID_TIMEOUT
    Description
    Server SDK timeoutMs must be a positive integer number of milliseconds.
  • Name
    INVALID_ID
    Description
    Server SDK lookup helpers require a non-blank resource identifier.
  • Name
    INVALID_REFERENCE
    Description
    Browser checkout input is missing a merchant reference.
  • Name
    INVALID_AMOUNT
    Description
    SDK input amount failed client-side validation.
  • Name
    INVALID_EXPIRY
    Description
    Server SDK expiry input is outside the 5 minute to 24 hour range.
  • Name
    INVALID_IDEMPOTENCY_KEY
    Description
    Server SDK idempotency key failed client-side validation.
  • Name
    INVALID_METADATA
    Description
    Server SDK metadata must be a JSON object.
  • Name
    INVALID_LIMIT
    Description
    Server SDK list limit must be an integer from 1 to 100.
  • Name
    INVALID_WEBHOOK_URL
    Description
    Server SDK webhook endpoint URLs must be valid http or https URLs.
  • Name
    INVALID_REQUEST_BODY
    Description
    Server SDK request payload could not be serialized as JSON.
  • Name
    INVALID_RESPONSE
    Description
    The SDK could not parse Payclave's response shape.
  • Name
    NETWORK_ERROR
    Description
    The SDK request failed before receiving a usable HTTP response.
  • Name
    TIMEOUT
    Description
    The SDK request exceeded its configured timeout.
  • Name
    ABORTED
    Description
    The SDK request was cancelled with an AbortSignal.
  • Name
    REDIRECT_UNAVAILABLE
    Description
    Browser SDK redirectToCheckout was called without a redirect handler outside the browser.

Webhook verification errors

  • Name
    WEBHOOK_SIGNATURE_INVALID
    Description
    Signature header or webhook secret is missing, malformed, or does not match the payload.
  • Name
    WEBHOOK_TIMESTAMP_INVALID
    Description
    The webhook signature timestamp is missing or not a safe integer.
  • Name
    WEBHOOK_TOLERANCE_INVALID
    Description
    The server SDK webhook tolerance option is not a non-negative number.
  • Name
    WEBHOOK_TIMESTAMP_OUTSIDE_TOLERANCE
    Description
    The webhook timestamp is outside the configured replay-protection window.
  • Name
    WEBHOOK_PAYLOAD_INVALID
    Description
    The webhook body is not valid JSON or does not match the Payclave event envelope.

Webhooks

Register webhook endpoints to receive signed events such asinvoice.paid. The delivery API returns delivery status, attempt count, the latest response code or error, and retry state.

Fulfill only after verifying aninvoice.paid event and claiming its event.id in a persistent deduplication store. The eventdata reports the commercialtotal, cumulativecustomerAmountPaid,customerAmountRemaining,merchantAmountSettled, platform fee, all credited payment IDs, and the latest payment facts. Treatinvoice.overpaid and payment on a closed invoice as operational alerts; Payclave does not initiate a refund or reopen a voided invoice.

Create a webhook endpoint

POST/v1/webhook-endpoints
Shell
curl https://api.payclave.com/v1/webhook-endpoints \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://merchant.example/webhooks/payclave",
    "eventTypes": ["invoice.paid", "payment.failed"]
  }'

Supported event types

  • Name
    invoice.issued
    Description
    An itemized draft was issued and made collectible.
  • Name
    invoice.paid
    Description
    The invoice has been fully paid. Validate its mode and order facts before fulfillment.
  • Name
    invoice.partially_paid
    Description
    A verified payment reduced the collectible remainder.
  • Name
    invoice.past_due
    Description
    An issued collectible invoice passed its due date.
  • Name
    invoice.overpaid
    Description
    Credited payment exceeds the commercial total. Review the excess separately.
  • Name
    invoice.voided
    Description
    Invoice collection was voided; prior payment records remain intact.
  • Name
    invoice.uncollectible
    Description
    The merchant marked the remaining collection uncollectible.
  • Name
    invoice.refund_recorded
    Description
    An external refund reference was recorded. This is not a Payclave-executed refund.
  • Name
    invoice.payment_received_after_void
    Description
    A payment arrived for a voided invoice. Review it without reopening or automatically fulfilling the invoice.
  • Name
    invoice.payment_received_after_uncollectible
    Description
    A payment arrived for an uncollectible invoice. Review the collection record.
  • Name
    invoice.expired
    Description
    The invoice expired before payment completion.
  • Name
    payment_link.completed
    Description
    A single-use payment link completed. Use the underlying invoice for fulfillment checks.
  • Name
    payment_link.expired
    Description
    A payment link expired.
  • Name
    payment.failed
    Description
    A payment attempt failed verification or processing.
  • Name
    payment.underpaid
    Description
    An attempt paid less than expected. Inspect the invoice remainder.
  • Name
    payment.overpaid
    Description
    An attempt paid more than expected. Inspect the invoice and received amount.
The event envelope contains id, object (event), type, mode, createdAt and data. Test deliveries contain data.test: true and must never trigger order fulfillment, even if their type is invoice.paid. Deliveries may arrive more than once or out of order; retrieve the current invoice when resolving conflicting events.

Security

Each webhook includesX-Payclave-Signature,X-Payclave-Timestamp,X-Payclave-Delivery, andX-Payclave-Event.

Compute HMAC SHA-256 using the endpoint signing secret over the UTF-8 timestamp, a literal period, and the exact raw request bytes. Compare the hex digest in constant time with a v1 value from t=timestamp,v1=digest. The server SDK validates this format and rejects timestamps more than 300 seconds in the past or future by default. Keep your server clock synchronized and retain replay protection. Headers alone do not authenticate a request.

A delivery times out after 10 seconds. Return a 2xx only after durably accepting the event, then process fulfillment asynchronously. After the first four failed attempts, Payclave retries after 1 minute, 5 minutes, 30 minutes, and 2 hours. A fifth failed attempt ends automatic retries.

Payclave never follows redirects. Attempt details include duration, a stable failure category, signature-free request-header evidence, and a sanitized response excerpt capped at 4 KB. Repeated failures open one endpoint incident and a later successful delivery resolves it.

Signing-secret rotation keeps the previous secret valid for at most 24 hours. During the overlap,X-Payclave-Signatureis exactlyt=<timestamp>,v1=<new>,v1=<old>. Verify every v1 value and accept the delivery when any value matches the endpoint secret. After a successful test, end the overlap; otherwise it expires automatically.

Verify with the server SDK

TypeScriptv0.1.1Runs on server
import { constructPayclaveWebhookEvent } from "@payclave/sdk-server"

type EventStore = {
  processOnce(eventId: string, handler: () => Promise<void>): Promise<void>
}

declare const eventStore: EventStore
declare function queueFulfillment(data: unknown): Promise<void>

export async function verifyPayclaveWebhook(request: Request) {
  const rawBody = await request.text()
  const signature = request.headers.get("X-Payclave-Signature") ?? ""

  const event = constructPayclaveWebhookEvent({
    payload: rawBody,
    signature,
    secret: process.env.PAYCLAVE_WEBHOOK_SECRET!,
  })

  const expectedMode = process.env.PAYCLAVE_MODE
  if (expectedMode !== "test" && expectedMode !== "live") {
    throw new Error("Set PAYCLAVE_MODE to test or live")
  }
  if (event.mode !== expectedMode) {
    return new Response(null, { status: 204 })
  }

  await eventStore.processOnce(event.id, async () => {
    if (event.type === "invoice.paid" && event.data.test !== true) {
      // Validate the invoice against your stored order before fulfillment.
      await queueFulfillment(event.data)
    }
  })

  return new Response(null, { status: 204 })
}
Set PAYCLAVE_MODE to test or live for this handler and use the matching endpoint secret. The sample eventStore is a merchant-provided adapter. ItsprocessOnce method must claim the event ID and enqueue fulfillment in one durable transaction. A crash between a standalone claim and enqueue could otherwise lose the order. Check the expected mode, invoice or order reference, amount, and currency before fulfillment; also make fulfillment idempotent by order, since multiple endpoints can receive distinct event IDs for the same invoice.
Read the request body as text or bytes before any JSON parser runs. A parsed and reserialized body changes the signed bytes. Seewebhook verification errorsfor the raw-body remediation path.
POST/v1/checkout-sessions

Create a checkout session

Creates a hosted checkout session and a linked invoice. The customer should open the returnedcheckoutUrlto pay through the Payclave-branded checkout.

  • Name
    amount
    Description
    Required positive value with up to 6 decimal places.
  • Name
    customerEmail
    Description
    Optional customer email for records. Secret keys only.
  • Name
    externalReference
    Description
    Your order or invoice reference.
  • Name
    successUrl
    Description
    Optional absolute http or https URL for successful checkout return. Secret keys only.
  • Name
    cancelUrl
    Description
    Optional absolute http or https URL for cancelled checkout return. Secret keys only.
  • Name
    metadata
    Description
    Flexible JSON metadata copied to the invoice. Secret keys only.
  • Name
    expiresInMinutes
    Description
    Optional integer from 5 to 1440 minutes; defaults to 30. Secret keys only.
Publishable keys can send onlyamount andexternalReference. Use a secret key on your server when the merchant must control customer details, return URLs, metadata, or expiry.
Publishable-key checkout creation is rate limited per key and client address. A limited request returnsRATE_LIMIT_EXCEEDED with aRetry-After header. Read the Payclave RateLimit and RateLimit-Policy header guide.
Reads with a secret key also returnnetAmount andplatformFee. Payclave reports expected net receipts innetAmount and actual receipts inmerchantAmountSettled. Compare cumulative customer credit against the commercial invoice total for fulfillment. Reconcile actual merchant receipts separately from the platform fee; a remainder checkout's amountDue is not the full invoice total.

Example response (selected fields)

JSON
{
  "success": true,
  "data": {
    "id": "chk_pclv_01HY7W9QK3P9M8Z6A4N2B7C1D9",
    "checkoutId": "chk_pclv_01HY7W9QK3P9M8Z6A4N2B7C1D9",
    "object": "checkout_session",
    "mode": "test",
    "status": "pending",
    "invoiceId": "INV-PCLV-17791920002731",
    "invoiceNumber": "INV-PCLV-17791920002731",
    "amountDue": "25.00",
    "currencyCode": "USDT",
    "chainId": 137,
    "tokenSymbol": "USDT",
    "tokenContract": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
    "settlementWalletAddress": "0x1111111111111111111111111111111111111111",
    "externalReference": "order_8431",
    "checkoutUrl": "https://www.payclave.com/checkout/chk_pclv_01HY7W9QK3P9M8Z6A4N2B7C1D9",
    "expiresAt": "2026-05-19T12:30:00Z",
    "createdAt": "2026-05-19T12:00:00Z"
  },
  "meta": {
    "requestId": "req_..."
  }
}
POST/v1/invoices

Create an invoice

Create an itemized draft from trusted server code. Payclave calculates canonical totals at the settlement token's 6-decimal scale, rounding line multiplication and percentage discounts half-up. Issue the draft to lock its commercial fields, assign an invoice number, and create its hosted invoice and first checkout session.

Create an invoice

POST/v1/invoices
Shell
curl https://api.payclave.com/v1/invoices \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: invoice_8431" \
  -d '{
    "customer": { "name": "Ada Lovelace", "email": "ada@example.com" },
    "lines": [{
      "description": "Implementation",
      "quantity": "2.5",
      "unitAmount": "10.00"
    }],
    "externalReference": "invoice_8431",
    "metadata": { "plan": "pro" }
  }'

Invoice request fields

  • Name
    lines
    Description
    Required array of 1-100 items. Each item has description (1-500 UTF-8 bytes), quantity (positive decimal string), unitAmount (non-negative decimal string), and optional id and sku (up to 100 UTF-8 bytes). Numeric strings accept at most 6 fractional digits.
  • Name
    customer
    Description
    Object with optional name, email, company and billingAddress (string). A valid email is required to send or remind by email. Name and company are at most 200 UTF-8 bytes, email 320, billingAddress 1000 UTF-8 bytes.
  • Name
    discount
    Description
    Optional { type: 'fixed', amount } or { type: 'percentage', percentage }. Percentage is a decimal string between 0 and 100; discount cannot exceed subtotal. Use null to clear on draft replacement.
  • Name
    taxes
    Description
    Optional array of up to 100 lines with label, amount (non-negative decimal string), and optional id, jurisdiction, registrationReference. label is required and limited to 120 UTF-8 bytes; jurisdiction and registrationReference have the same limit. Supply calculated tax amounts; Payclave does not calculate jurisdictional tax rates.
  • Name
    currencyCode
    Description
    Optional USDC or USDT, defaulting to the mode's settlement token. A different configured token returns CURRENCY_MISMATCH.
  • Name
    dueAt
    Description
    Optional RFC 3339 timestamp or null. The invoice due date is separate from each checkout session's expiry.
  • Name
    checkoutExpiresInMinutes
    Description
    Optional integer from 5 to 1440, default 30. This is named differently from expiresInMinutes on direct checkout creation.
  • Name
    paymentTerms, memo, footer, purchaseOrderNumber
    Description
    Optional strings limited to 4000, 2000, 2000 and 100 UTF-8 bytes respectively.
  • Name
    externalReference, metadata
    Description
    Optional externalReference up to 255 UTF-8 bytes. metadata is a JSON object up to 16 KiB. Do not store secrets in metadata.
  • Name
    successUrl, cancelUrl
    Description
    Optional absolute HTTP or HTTPS return URLs without credentials, at most 2048 UTF-8 bytes each. Use HTTPS URLs you control. A return to successUrl is not proof of payment.
  • Name
    reminderSchedule
    Description
    Optional object: enabled, daysBeforeDue, onDue, daysAfterDue. daysBeforeDue and daysAfterDue are arrays of integer offsets from 1 to 30, with at most six entries combined. Enabled schedules require dueAt. With no timings specified, defaults are 3 days before, on the due date and 7 days after.
  • Name
    issue, send
    Description
    HTTP creation only: issue:true immediately issues the draft; send:true sends when issuing. The published server SDK 0.1.1 has no itemized draft/issue wrappers; use HTTP for this workflow.

Issue the draft

ShellRuns on server
# Replace the id and version with the values in your draft response.
curl https://api.payclave.com/v1/invoices/inv_example/issue \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: issue_invoice_8431" \
  -d '{ "version": 1, "send": true }'
Use the id and current version from the draft response when issuing. The returned hostedInvoiceUrl is the customer-facing invoice link. The published server SDK 0.1.1 supports only the amount-only createInvoice form, so use HTTP for itemized drafts and issuing. The playground's basic invoice preset also uses the amount-only form.
Retrieve the complete invoice atGET /v1/invoices/:id. A partial invoice can create an exact-remainder checkout atPOST /v1/invoices/:id/checkout-sessions. Verified payments are aggregated; failed or duplicate transfers do not count toward customerAmountPaid. Void, void-remaining, uncollectible, duplicate, and refund-reference actions change collection records only and never move funds.
GET /v1/invoices/:id/pdfreturns an authenticated, no-store PDF rendered from Payclave's server-side invoice snapshot. Stream the HTTP response from your backend; the published server SDK 0.1.1 does not include a PDF download method.
  • Name
    pending
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    processing
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    paid
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    underpaid
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    overpaid
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    expired
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    failed
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    cancelled
    Description
    Invoice lifecycle status returned by the API and dashboard.
  • Name
    collectionState
    Description
    Commercial state: draft, open, past_due, partially_paid, paid, void, or uncollectible. It remains separate from payment verification status.
POST/v1/payment-links

Create a Payclave-hosted public payment page from trusted server code. A customer submission creates a new invoice and checkout session; the invoice and independently verified payment remain the payment source of truth.

Create a payment link

POST/v1/payment-links
ShellRuns on server
curl https://api.payclave.com/v1/payment-links \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: consulting_deposit_123" \
  -d '{
    "title": "Consulting deposit",
    "amountType": "fixed",
    "amount": "250.00",
    "usageType": "single_use",
    "collect": { "email": true, "reference": true },
    "successUrl": "https://merchant.example/orders/paid"
  }'
  • Name
    amountType
    Description
    Use fixed with amount, or customer_entered with a required minimumAmount and optional maximumAmount.
  • Name
    currencyCode
    Description
    Must match the active mode's Polygon USDC or USDT settlement wallet. Amount strings accept at most 6 fractional digits.
  • Name
    usageType
    Description
    Use single_use or reusable.
  • Name
    collect
    Description
    Choose whether email, full name, and customer reference are required on the public page.
  • Name
    version
    Description
    Supply the latest version when updating a link. A stale version returns PAYMENT_LINK_VERSION_CONFLICT.
  • Name
    GET /v1/payment-links
    Description
    List mode-scoped links with cursor pagination and status, amount, usage, token, text, and creation-time filters.
  • Name
    PATCH /v1/payment-links/:id
    Description
    Replace editable configuration using optimistic version control.
  • Name
    pause · resume · archive · duplicate
    Description
    Change lifecycle state or create a new link without mutating past invoice snapshots.
  • Name
    GET /v1/payment-links/:id/payments
    Description
    Return the invoices created from the link. Payment state belongs to those invoices and their verified payment records.
Every authenticated payment-link mutation accepts an optional Idempotency-Key. Retry the exact request with the same key; reusing a key for different input returns IDEMPOTENCY_KEY_CONFLICT.
  • Name
    title, description
    Description
    title is required (1-120 UTF-8 bytes). description is optional customer-facing text up to 1000 UTF-8 bytes.
  • Name
    amountType, amount, minimumAmount, maximumAmount
    Description
    amountType is fixed or customer_entered. Fixed links require amount. Customer-entered links require minimumAmount and may set maximumAmount. All amounts are positive decimal strings with at most 6 fractional digits. minimumAmount must not exceed maximumAmount; the customer-entered maximum is also bounded by the service limit.
  • Name
    currencyCode, mode
    Description
    Optional currencyCode must match the mode's USDC or USDT settlement wallet. Optional mode must match the API key; it cannot switch modes.
  • Name
    usageType
    Description
    single_use or reusable; defaults to reusable. A single-use reservation prevents another checkout until it completes, expires or is explicitly released under the lifecycle rules.
  • Name
    activeAt, expiresAt
    Description
    Optional RFC 3339 timestamps or null. These control when customers can start new checkouts. expiresAt must be later than activeAt when both are set.
  • Name
    collect
    Description
    Optional { email, name, reference } booleans. Public submission uses email, name and customerReference as field names.
  • Name
    referencePrefix
    Description
    Optional prefix for generated invoice references, at most 50 letters, numbers, underscores or hyphens.
  • Name
    successUrl, cancelUrl, successMessage
    Description
    Optional return URLs (at most 2048 UTF-8 bytes) and message (at most 500 UTF-8 bytes). Live return URLs must use HTTPS and match the merchant's reviewed website origin.
  • Name
    metadata
    Description
    Optional JSON object up to 16 KiB attached to merchant records; not included in the customer-safe public configuration.
  • Name
    version
    Description
    Required on PATCH with the complete editable configuration. Use the value from the latest GET response.

GET /v1/public/payment-links/:publicId returns only customer-safe display configuration. It excludes the settlement wallet, token contract, merchant metadata, internal IDs, and counters. POST /v1/public/payment-links/:publicId/checkout accepts the displayed version, an amount only for customer-entered links, and configured customer fields. It requires an Idempotency-Key and returns invoiceId, checkoutSessionId, checkoutUrl, and expiresAt.

Public views and submissions are rate limited. A single-use link is atomically reserved for one invoice, so concurrent submissions cannot create multiple checkouts. Live success and cancel URLs must be HTTPS and match the merchant's reviewed website origin.
GET/v1/payments/:id

Retrieve a payment

Payment records track detected and verified onchain attempts. Payclave still marks invoices paid only after checking the transaction hash, recipient wallet, token contract, chain ID, amount received, expiry, and duplicate usage.

  • Name
    duplicate
    Description
    The transaction has already been used. It is not credited again.
  • Name
    detected
    Description
    A payment attempt has been captured.
  • Name
    validating
    Description
    Payclave is verifying settlement onchain.
  • Name
    confirmed
    Description
    The payment was confirmed for the invoice.
  • Name
    failed
    Description
    The payment could not be confirmed.
  • Name
    underpaid
    Description
    Received amount is below the invoice amount.
  • Name
    overpaid
    Description
    Received amount is above the invoice amount.
POST/v1/webhook-endpoints

Webhook endpoints

  • Name
    url
    Description
    Publicly reachable HTTP or HTTPS endpoint in your application. Use HTTPS in production. Local and private network destinations are blocked on the hosted service.
  • Name
    eventTypes
    Description
    Optional list of events. Defaults to all supported events.

List and retrieve endpoints with GET, change URL, state, subscriptions, or alert preferences with PATCH, and archive with DELETE. Rotate withPOST /v1/webhook-endpoints/:id/rotate-secretand finish migration withPOST /v1/webhook-endpoints/:id/end-secret-overlap. Updates, archival, and rotation accept an optional Idempotency-Key in the HTTP API. These methods are not in the published server SDK 0.1.1. Endpoint creation does not support idempotent replay. A newly generated signing secret is returned once.

GET/v1/webhook-deliveries

Webhook deliveries

  • Name
    pending
    Description
    Delivery has been created and scheduled.
  • Name
    delivering
    Description
    A delivery attempt is currently in progress.
  • Name
    delivered
    Description
    The endpoint returned a 2xx response.
  • Name
    retry_scheduled
    Description
    Payclave will retry after a failed attempt.
  • Name
    failed
    Description
    Retries were exhausted or the endpoint is disabled.
  • Name
    errorCategory
    Description
    One of dns, connection, tls, timeout, blocked_destination, http_4xx, http_5xx, redirect, response_too_large, signing_secret, endpoint_disabled, or internal.

HTTP API reference

All paths below are relative to https://api.payclave.com. Replace path placeholders with API-returned identifiers. Success codes describe the HTTP response; JSON results are wrapped in data. PDF and export downloads return file bytes.

Availability can depend on merchant activation and enabled features. A route listed here does not grant access to every merchant. Use the returned error code and request ID to resolve access issues. Hosted wallet orchestration and checkout telemetry routes are managed by Payclave checkout; merchants should integrate through the checkout URL.

Checkout sessions and payments

Checkout creation and retrieval accept publishable or secret keys. Payment retrieval requires a secret key. Read amounts and payment status from the API before fulfillment.

POST

/v1/checkout-sessions

  • Name
    Request
    Description
    Required: amount as a positive decimal string. Optional: externalReference. Secret keys may also send customerEmail, successUrl, cancelUrl, metadata, expiresInMinutes. Optional Idempotency-Key. Currency and settlement wallet come from the key's mode, not the request.
  • Name
    Response
    Description
    201: checkout_session with id, checkoutId, invoiceId, invoiceNumber, checkoutUrl, mode, status, collectionState, amountDue, total, customerAmountPaid, customerAmountRemaining, currencyCode, chainId, tokenContract, settlementWalletAddress, expiresAt, createdAt. Persist these identifiers.
GET

/v1/checkout-sessions/:id

  • Name
    Request
    Description
    Path: the returned checkout id. No body. There is no checkout-session list endpoint.
  • Name
    Response
    Description
    200: current checkout_session, completedAt and latest paymentId/paymentStatus/transaction hashes when available. Secret-key reads add platformFee, netAmount, expectedMerchantSettlement, merchantAmountSettled, overpaymentAmount.
GET

/v1/payments/:id

  • Name
    Request
    Description
    Secret key; path: paymentId from the invoice or checkout response. No body.
  • Name
    Response
    Description
    200: payment record, including status, invoiceId, amountExpected, amountReceived, customerAmountCredited, merchantAmountSettled, transactionId, chainId, settlementWalletAddress, payer evidence, failureReason and confirmedAt. There is no general payment-list endpoint; use invoices or reconciliation for reporting.

Invoices

Secret key required. Itemized invoices use draft versioning. Collection actions do not transfer crypto or initiate refunds. Invoice creation and collection mutations may be unavailable until enabled for the merchant.

POST

/v1/invoices

  • Name
    Request
    Description
    Itemized form: lines plus optional customer and invoice fields listed below. issue defaults to false; issue:true issues immediately. send:true requires issue:true and a customer email. Optional Idempotency-Key. The legacy amount-only form creates a payable invoice directly, not an itemized draft.
  • Name
    Response
    Description
    201: invoice. An itemized draft has collectionState=draft and version; issuance returns invoiceNumber, hostedInvoiceUrl and checkout information. Use the returned id for subsequent operations.
GET

/v1/invoices

  • Name
    Request
    Description
    Query: limit (default 25, use 1-100), startingAfter, collectionState.
  • Name
    Response
    Description
    200: data.items, data.hasMore, data.nextCursor. Pass nextCursor as startingAfter while hasMore is true.
GET

/v1/invoices/:id

  • Name
    Request
    Description
    Path: invoice id or issued invoice number.
  • Name
    Response
    Description
    200: invoice with line items, totals, collectionState, version, customer, checkoutSessions, payments and activity. Commercial fields and payment status have separate meanings.
GET

/v1/invoices/:id/pdf

  • Name
    Request
    Description
    No body. Keep the secret key on your server and stream the download to an authorized user.
  • Name
    Response
    Description
    200: application/pdf bytes with Content-Disposition and no-store caching, not a JSON envelope.
PATCH

/v1/invoices/:id

  • Name
    Request
    Description
    Required: current version and the complete replacement of editable draft fields, including lines. Omitted fields can be cleared or reset. Optional Idempotency-Key.
  • Name
    Response
    Description
    200: updated draft and new version. Re-read after INVOICE_VERSION_CONFLICT; issued commercial fields cannot be edited.
POST

/v1/invoices/:id/issue

  • Name
    Request
    Description
    JSON: { version, send? }. Optional Idempotency-Key. Supply a customer email when send is true.
  • Name
    Response
    Description
    200: issued invoice, invoice number, hosted URL, and checkout session. Locks commercial fields.
POST

/v1/invoices/:id/send

  • Name
    Request
    Description
    No body required. Requires a deliverable invoice and customer email. Optional Idempotency-Key.
  • Name
    Response
    Description
    202: queued invoice email delivery. Accepted does not mean the email has arrived.
POST

/v1/invoices/:id/remind

  • Name
    Request
    Description
    No body required. Requires a collectible issued invoice and customer email. Optional Idempotency-Key.
  • Name
    Response
    Description
    202: queued reminder delivery. Reminder availability and cooldown rules apply.
POST

/v1/invoices/:id/checkout-sessions

  • Name
    Request
    Description
    No body required; the server determines the collectible remainder. Optional Idempotency-Key.
  • Name
    Response
    Description
    201: invoiceId, checkoutSessionId, checkoutUrl, amount and expiry for a recovery checkout; may reuse an active session.
POST

/v1/invoices/:id/void

  • Name
    Request
    Description
    JSON: { reason }. Optional Idempotency-Key.
  • Name
    Response
    Description
    200: closed invoice. Use void-remaining for a partially paid invoice; prior transfers remain recorded.
POST

/v1/invoices/:id/void-remaining

  • Name
    Request
    Description
    JSON: { reason }. Optional Idempotency-Key.
  • Name
    Response
    Description
    200: invoice with its remaining collection closed; received payments remain recorded.
POST

/v1/invoices/:id/mark-uncollectible

  • Name
    Request
    Description
    JSON: { reason }. Optional Idempotency-Key.
  • Name
    Response
    Description
    200: invoice marked uncollectible. This does not alter onchain payments.
POST

/v1/invoices/:id/refund-references

  • Name
    Request
    Description
    JSON: paymentId, amount (positive decimal string), reason, externalTransactionHash, chainId, tokenContract. Optional Idempotency-Key.
  • Name
    Response
    Description
    201: invoice and adjustment recording an externally performed refund. Payclave does not execute or independently verify this refund transfer.
POST

/v1/invoices/:id/duplicate

  • Name
    Request
    Description
    No body required. Optional Idempotency-Key.
  • Name
    Response
    Description
    201: a new draft copied from the invoice. Issue it separately.

Secret key required. Configuration fields and public submission contracts are described below. All authenticated mutations in this group support an optional Idempotency-Key.

POST

/v1/payment-links

  • Name
    Request
    Description
    Required: title, amountType, amount for fixed links or minimumAmount for customer_entered links. Optional payment-link fields below.
  • Name
    Response
    Description
    201: payment link, including id, publicId, url, version, status and configured collection fields.
GET
  • Name
    Request
    Description
    Query: limit (default 25, use 1-100), startingAfter, status, amountType, usageType, currencyCode, search, createdFrom, createdTo. Dates are RFC 3339 timestamps.
  • Name
    Response
    Description
    200: data.items, data.hasMore, data.nextCursor.
GET
  • Name
    Request
    Description
    Path: authenticated payment-link id.
  • Name
    Response
    Description
    200: payment-link configuration, lifecycle state, version, counters and reservation facts.
PATCH
  • Name
    Request
    Description
    Required: current version and complete editable configuration, including title and amountType. This replaces configuration, not just changed fields.
  • Name
    Response
    Description
    200: updated link and new version. Stale writes return PAYMENT_LINK_VERSION_CONFLICT.
POST

/v1/payment-links/:id/pause

  • Name
    Request
    Description
    No body required.
  • Name
    Response
    Description
    200: paused link; existing invoice snapshots remain unchanged.
POST

/v1/payment-links/:id/resume

  • Name
    Request
    Description
    No body required.
  • Name
    Response
    Description
    200: resumed link, subject to expiry and lifecycle eligibility.
POST

/v1/payment-links/:id/archive

  • Name
    Request
    Description
    No body required.
  • Name
    Response
    Description
    200: archived link. Historical invoices and payments remain available.
POST

/v1/payment-links/:id/duplicate

  • Name
    Request
    Description
    No body required.
  • Name
    Response
    Description
    200: newly copied link with its own identifiers and URL.
POST

/v1/payment-links/:id/release-reservation

  • Name
    Request
    Description
    JSON: { acknowledgeLatePaymentRisk: true }. Review the reserved invoice before releasing.
  • Name
    Response
    Description
    200: updated link. A late payment to the earlier checkout can still arrive; releasing does not reverse it.
GET
  • Name
    Request
    Description
    Query: limit (default 25, use 1-100).
  • Name
    Response
    Description
    200: data.items containing invoices created from the link. This endpoint does not expose cursor pagination.

Webhook endpoints and deliveries

Secret key required. Endpoints, deliveries and signing secrets are mode-specific. The published server SDK 0.1.1 supports endpoint creation, synthetic tests and delivery listing only. Use HTTP for other webhook operations.

POST

/v1/webhook-endpoints

  • Name
    Request
    Description
    JSON: url (required), eventTypes (optional array; omitted or empty subscribes to all supported types). This endpoint does not implement Idempotency-Key replay.
  • Name
    Response
    Description
    201: endpoint, signingSecret and copyRequired. Store the secret securely; normal reads omit it. Avoid blindly retrying an uncertain creation; first list endpoints.
GET

/v1/webhook-endpoints

  • Name
    Request
    Description
    No query or body required.
  • Name
    Response
    Description
    200: data is an array of non-archived endpoints, with no signing secrets or pagination cursor.
GET

/v1/webhook-endpoints/:id

  • Name
    Request
    Description
    No body.
  • Name
    Response
    Description
    200: endpoint configuration, health and secret-version metadata; no signing secret.
PATCH

/v1/webhook-endpoints/:id

  • Name
    Request
    Description
    JSON: any of url, enabled, eventTypes, alertsEnabled, alertThreshold, recoveryAlertsEnabled. Optional HTTP Idempotency-Key.
  • Name
    Response
    Description
    200: updated endpoint. Unlike invoice and payment-link updates, this is a partial update.
DELETE

/v1/webhook-endpoints/:id

  • Name
    Request
    Description
    No body. Optional HTTP Idempotency-Key.
  • Name
    Response
    Description
    200: archived endpoint result. Delivery history is retained.
POST

/v1/webhook-endpoints/:id/rotate-secret

  • Name
    Request
    Description
    No body. Optional HTTP Idempotency-Key.
  • Name
    Response
    Description
    201: new signingSecret and version metadata. The previous secret overlaps for at most 24 hours. Save the new secret, test it, then end overlap.
POST

/v1/webhook-endpoints/:id/end-secret-overlap

  • Name
    Request
    Description
    No body. Optional HTTP Idempotency-Key.
  • Name
    Response
    Description
    200: endpoint secret metadata after ending overlap. Test the new secret before ending overlap; the API does not enforce that precaution.
POST

/v1/webhooks/test

  • Name
    Request
    Description
    JSON: endpointId (required), eventType (optional; defaults to invoice.paid and must be subscribed). No idempotent replay.
  • Name
    Response
    Description
    201: synthetic delivery whose event data contains test:true. This exercises delivery and signature handling, not onchain verification. Never fulfill an order from it.
GET

/v1/webhook-deliveries

  • Name
    Request
    Description
    Query: limit (default 25, maximum 100), endpointId, eventType, status, createdFrom, createdTo, replayStatus (original or replay), responseFamily (2xx, 3xx, 4xx, 5xx, network).
  • Name
    Response
    Description
    200: data is an array of matching deliveries, newest first. No startingAfter cursor is supported.
GET

/v1/webhook-deliveries/:id

  • Name
    Request
    Description
    No body.
  • Name
    Response
    Description
    200: delivery with payload, retry/attempt summary and replay linkage.
GET

/v1/webhook-deliveries/:id/attempts

  • Name
    Request
    Description
    No body.
  • Name
    Response
    Description
    200: data is an array of attempt records with timing, response status, sanitized response excerpt and error category.
POST

/v1/webhook-deliveries/:id/replay

  • Name
    Request
    Description
    No body. Required Idempotency-Key of 8-255 visible ASCII characters.
  • Name
    Response
    Description
    202: replay delivery. The logical event.id is preserved, while delivery identity changes. Deduplicate fulfillment using event.id and your order id.
GET

/v1/webhook-incidents

  • Name
    Request
    Description
    Optional query: status=open or resolved.
  • Name
    Response
    Description
    200: data is an array of up to 100 incidents, newest first. Availability depends on merchant access.
GET

/v1/webhook-incidents/:id

  • Name
    Request
    Description
    No body.
  • Name
    Response
    Description
    200: incident and related failure evidence. Availability depends on merchant access.

Reconciliation

Secret key required. Use this API to compare customer payments with merchant receipts and export records. It does not create balances or transfer funds.

GET

/v1/reconciliation/schema/:version

  • Name
    Request
    Description
    Use version 2026-08-29.v1.
  • Name
    Response
    Description
    200: supported datasets, column definitions, date bases and money semantics for the schema.
GET

/v1/reconciliation/summary

  • Name
    Request
    Description
    Required query: from, to as RFC 3339 timestamps. Optional dateBasis (invoice_created, invoice_issued, invoice_paid, payment_confirmed or transaction_observed; default invoice_created), timezone, invoiceStatus, paymentStatus, settlementToken, exceptionOnly. Repeated or comma-separated status/token filters are accepted.
  • Name
    Response
    Description
    200: summary grouped by settlement token, status counts and exceptions. from is inclusive, to exclusive; maximum range is 366 days. Preview is bounded to 10,000 rows.
POST

/v1/reconciliation-exports

  • Name
    Request
    Description
    JSON: from, to, format (csv or json), dateBasis; optional schemaVersion, timezone, invoiceStatuses, paymentStatuses, settlementTokens, exceptionOnly, includePII (must be false or omitted), mode. mode must match the key. Optional Idempotency-Key.
  • Name
    Response
    Description
    202: export job with id, status and statusUrl. Poll the returned statusUrl; a queued export is not ready to download.
GET

/v1/reconciliation-exports

  • Name
    Request
    Description
    Query: limit (default 25, use 1-100), startingAfter.
  • Name
    Response
    Description
    200: data.items, data.hasMore, data.nextCursor.
GET

/v1/reconciliation-exports/:id

  • Name
    Request
    Description
    No body.
  • Name
    Response
    Description
    200: export state, files, expiry and failure information. States include queued, running, ready, failed, cancelled, expired.
POST

/v1/reconciliation-exports/:id/cancel

  • Name
    Request
    Description
    No body. Optional Idempotency-Key.
  • Name
    Response
    Description
    200: export cancellation state. Read the returned state to confirm cancellation.
GET

/v1/reconciliation-exports/:id/download

  • Name
    Request
    Description
    No body. Export must be ready and not expired.
  • Name
    Response
    Description
    200: ZIP attachment containing the selected CSV or JSON datasets, not a JSON envelope, with Content-Disposition and X-Payclave-Content-SHA256. Retain expiresAt and verify the checksum; use HTTP for this operation with the published server SDK 0.1.1.

Checkout diagnostics

Secret key and merchant access required. Optional query filters: from, to (RFC 3339), sourceType, paymentLinkId, network (positive chain ID), token, walletFamily, outcome, stage, reasonCode, reasonGroup. Defaults to the last 7 days; the maximum range is 90 days. Diagnostics explain checkout behavior; payment records remain the payment authority.

GET

/v1/checkout-diagnostics/summary

  • Name
    Request
    Description
    Optional diagnostics filters.
  • Name
    Response
    Description
    200: aggregate checkout metrics for the selected scope.
GET

/v1/checkout-diagnostics/funnel

  • Name
    Request
    Description
    Optional diagnostics filters.
  • Name
    Response
    Description
    200: checkout stage/funnel metrics.
GET

/v1/checkout-diagnostics/reasons

  • Name
    Request
    Description
    Optional diagnostics filters.
  • Name
    Response
    Description
    200: grouped outcome and failure reasons.
GET

/v1/checkout-diagnostics/sessions

  • Name
    Request
    Description
    Optional diagnostics filters.
  • Name
    Response
    Description
    200: data.items (up to 100 sessions), total, lowVolume and observationCutoff. This API does not accept limit or startingAfter.
GET

/v1/checkout-diagnostics/sessions/:checkoutSessionId

  • Name
    Request
    Description
    Path: checkout session identifier; optional diagnostics filters.
  • Name
    Response
    Description
    200: session diagnostics and timeline.
GET

/v1/checkout-diagnostics/taxonomy

  • Name
    Request
    Description
    No body.
  • Name
    Response
    Description
    200: supported stages, reasons and classification metadata. Use this to interpret diagnostic codes.

Public invoice and payment-link checkout

These endpoints use the unguessable public token or publicId from the hosted URL and do not require an API key. Prefer sending customers to the hosted URL. Public responses exclude merchant-only configuration.

GET

/v1/public/invoices/:publicToken

  • Name
    Request
    Description
    Path: public invoice token, not an internal invoice id.
  • Name
    Response
    Description
    200: customer-safe invoice display and payment state.
POST

/v1/public/invoices/:publicToken/checkout-sessions

  • Name
    Request
    Description
    No body required. Required Idempotency-Key (1-255 visible ASCII characters). The server chooses the remaining collectible amount.
  • Name
    Response
    Description
    201: recovery checkout for the invoice, or a reusable active checkout. Closed invoices cannot be made payable by the customer.
GET
  • Name
    Request
    Description
    Path: publicId, not the authenticated link id.
  • Name
    Response
    Description
    200: public configuration and current version. Use that version when submitting.
POST

/v1/public/payment-links/:publicId/checkout

  • Name
    Request
    Description
    Required: Idempotency-Key and JSON version. Supply amount only for customer_entered links. Supply email, name and customerReference when the corresponding collect fields require them. Unknown fields are rejected.
  • Name
    Response
    Description
    201: invoiceId, checkoutSessionId, checkoutUrl, expiresAt. Stale configuration, reservation, expiration and mode eligibility can reject the request.