PayclaveDocs

Payclave developers

Getting started

Create checkout, save its identifiers, and fulfill an order safely.

Create a merchant account, configure your test settlement wallet, and create a test secret key in the dashboard. The default live settlement target is USDT on Polygon; USDC on Base and Arc are selectable settlement networks. Arc checkout supports wallet payment and x402, without scan-or-copy deposits.

Prepare your server

Store your test secret key as PAYCLAVE_SECRET_KEY in your backend environment. The examples use placeholder credentials and order IDs; replace them with your own. Do not copy a secret key into a public environment variable, frontend bundle, or mobile app.

Your checkout endpoint should accept an order ID, authenticate the customer, and load that order from your records. Save the returned checkout and invoice IDs against the order so you can find them after a timeout, a page refresh, or a webhook delivery.

Create checkout

Calculate prices on your server
Authenticate the customer, authorize the order, and load its amount from your own records. Never accept a browser-supplied price for a production order.
bash
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" }  }'

Redirect the customer to data.checkoutUrl. Hosted checkout stays on Payclave, using URLs such as https://www.payclave.com/checkout/cs_123.

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": "USDC",    "chainId": 84532,    "tokenSymbol": "USDC",    "tokenContract": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",    "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_..."  }}

Read the checkout response

amountDue records the checkout amount in the settlement currency, such as "25.00". externalReference connects the checkout to your order. metadata holds additional order context; keep secrets and unnecessary customer data out of it. The success and cancel URLs send the customer back to your site.

Read the checkout from data. Store its id and invoiceId, then open the returned checkoutUrl exactly as provided. Use expiresAt to explain when that checkout stops accepting new payment attempts. If you lose the creation response, retry with the same idempotency key and payload.

Handle confirmation

The return URL is a navigation aid. It does not prove payment. Verify signed invoice.paid webhooks, match the invoice to the stored order and expected amount, and fulfill each order once. See webhook verification.

Use the same idempotency key and payload when retrying creation. A new order needs a new key. Retain the response request ID when contacting support.

Explain payment progress to the customer

StateWhat your app should do
PendingLet the customer open the checkout and choose a supported payment route.
ProcessingShow that confirmation is in progress. A submitted transaction still needs verification.
PaidMatch the verified invoice to the order, amount, and mode before fulfilling it once.
UnderpaidRead the remaining amount from the API and offer the available recovery checkout. Do not ask the customer to pay the original total again.
OverpaidReview the verified credit and excess amount under your order and refund policy. Any refund must come from the merchant-controlled wallet.
Expired, failed, or cancelledRead the latest invoice and payment records before starting another attempt. A closed checkout does not prove that no payment is still confirming.

On this page