PayclaveDocs

Payclave developers

Invoices and refunds

Create and issue invoices, manage collection, and record merchant-sent refunds.

Access and availability
Secret keys are required for invoice mutations. Restricted agent keys may list/read invoices and check refund eligibility. 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.

Create and read invoices

POST

POST /v1/invoices

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.

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" }  }'
GET

GET /v1/invoices

Query: limit (default 25, use 1-100), startingAfter, collectionState.

GET

GET /v1/invoices/:id

Path: invoice id or issued invoice number.

curl "https://api.payclave.com/v1/invoices/YOUR_INVOICE_ID" -H "Authorization: Bearer sk_test_..."
GET

GET /v1/invoices/:id/pdf

No body. Keep the secret key on your server and stream the download to an authorized user.

Invoice drafts and duplication

PATCH

PATCH /v1/invoices/:id

Required: current version and the complete replacement of editable draft fields, including lines. Omitted fields can be cleared or reset. Optional Idempotency-Key.

POST

POST /v1/invoices/:id/duplicate

No body required. Optional Idempotency-Key.

Collection

POST

POST /v1/invoices/:id/issue

JSON: { version, send? }. Optional Idempotency-Key. Supply a customer email when send is true.

# 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 }'
POST

POST /v1/invoices/:id/send

No body required. Requires a deliverable invoice and customer email. Optional Idempotency-Key.

POST

POST /v1/invoices/:id/remind

No body required. Requires a collectible issued invoice and customer email. Optional Idempotency-Key.

POST

POST /v1/invoices/:id/checkout-sessions

No body required; the server determines the collectible remainder. Optional Idempotency-Key.

POST

POST /v1/invoices/:id/void

JSON: { reason }. Optional Idempotency-Key.

POST

POST /v1/invoices/:id/void-remaining

JSON: { reason }. Optional Idempotency-Key.

POST

POST /v1/invoices/:id/mark-uncollectible

JSON: { reason }. Optional Idempotency-Key.

Refunds

POST

POST /v1/invoices/:id/refund-checks

JSON: paymentId, amount (positive decimal string), destinationAddress. Check before sending a refund; nothing is recorded.

POST

POST /v1/invoices/:id/refund-references

JSON: paymentId, amount (positive decimal string), reason, externalTransactionHash (omit in test mode; Payclave simulates one), destinationAddress, destinationReason (required when the destination is not the verified paying wallet), chainId, tokenContract. Optional Idempotency-Key.

On this page