Payclave developers
Webhooks
Verify raw-body signatures, deduplicate events, and recover failed deliveries.
Register an endpoint
Webhooks let your backend react when payment state changes, even after the customer leaves checkout. Use invoice.paid for order fulfillment. Subscribe to other events only when your application has a handler for them; payment and delivery events can support customer updates and operational monitoring.
Register your server's HTTPS webhook URL and subscribe to the events your integration handles. Store the endpoint secret securely on your server.
Configure the endpoint in the same mode as the checkout. Use the signing secret for that endpoint when verifying its deliveries. A webhook signing secret and an API key have different jobs; using the API key to verify a webhook will fail.
Verify deliveries
Read the unmodified raw body and verify the HMAC SHA-256 signature from X-Payclave-Signature. The server SDK verifies the signature and timestamp before returning the event.
Read request.text() before parsing JSON. Reformatting or serializing the body changes the bytes that were signed. If your framework parses bodies automatically, preserve the raw body for this route. Reject a delivery if signature or timestamp validation fails, and never execute fulfillment code for that request.
The example leaves eventStore.processOnce and queueFulfillment to your application. Store processed event IDs durably and make the order update safe to retry. A process restart must not forget which orders were already fulfilled. Set PAYCLAVE_MODE explicitly so a test event cannot update a live order.
Record the accepted job or order update before marking an event complete. If fulfillment runs in another system, give that job its own stable idempotency key. A crash between accepting the event and carrying out the order must leave enough stored state to resume without sending goods or granting access twice.
Respond with a successful HTTP status after durable processing or durable enqueueing. Deliveries may retry; deduplicate by event ID. Inspect delivery status, response codes, attempt logs, and manual replay in the dashboard. A replay must remain safe.
Recover failed deliveries
Inspect the delivery's response code and attempts when an event does not reach your handler. Fix the endpoint URL, signature configuration, or application error before requesting a replay. If your handler received the event but lost its response, the replay may contain work you already completed. Return success for an event your server has already processed safely.
Keep long-running fulfillment work outside the HTTP request after recording it durably. If you have not accepted the work durably, return a failure so delivery can be retried. A successful response tells Payclave your endpoint accepted that delivery.
Retry schedule and secret rotation
Any 2xx response acknowledges a delivery. Failed deliveries retry after one minute, five minutes, thirty minutes, and two hours. A fifth failed attempt ends automatic retries. Review the attempt history, fix the handler, then request replay for recoverable failures.
Secret rotation and webhook incidents require merchant feature access. Read the endpoint's secret status, coordinate the replacement with your server verifier, and follow the returned overlap and retirement state. Keep secrets out of logs. Do not repeatedly rotate a key to resolve a raw-body parsing error; correct signature verification first.
Endpoint status, rotation, replay, and incident contracts
Events
| Event | Description |
|---|---|
marketplace.paid | Every recipient independently credited; issuer-only parent event. Separate transactions are not atomic. |
invoice.issued | An itemized draft was issued and made collectible. |
invoice.paid | The invoice has been fully paid. Validate its mode and order facts before fulfillment. |
invoice.partially_paid | A verified payment reduced the collectible remainder. |
invoice.past_due | An issued collectible invoice passed its due date. |
invoice.overpaid | Credited payment exceeds the commercial total. Review the excess separately. |
invoice.voided | Invoice collection was voided; prior payment records remain intact. |
invoice.uncollectible | The merchant marked the remaining collection uncollectible. |
invoice.refund_recorded | A merchant-sent refund was recorded. Payclave never sends refunds; check verificationStatus before treating it as sent. |
invoice.refund_verified | Payclave verified onchain that a recorded refund moved from the settlement wallet to the refund address. |
invoice.refund_failed | A recorded refund could not be verified onchain. verificationFailureReason explains why; its amount is refundable again. |
invoice.payment_received_after_void | A payment arrived for a voided invoice. Review it without reopening or automatically fulfilling the invoice. |
invoice.payment_received_after_uncollectible | A payment arrived for an uncollectible invoice. Review the collection record. |
invoice.expired | The invoice expired before payment completion. |
payment_link.completed | A single-use payment link completed. Use the underlying invoice for fulfillment checks. |
payment_link.expired | A payment link expired. |
payment.failed | A payment attempt failed verification or processing. |
payment.underpaid | An attempt paid less than expected. Inspect the invoice remainder. |
payment.overpaid | An attempt paid more than expected. Inspect the invoice and received amount. |