PayclaveDocs

Payclave developers

Refunds

Check eligibility, approve destinations, send from your wallet, and verify refund references.

The merchant sends the refund

Payclave checks eligibility and records and verifies a refund the merchant sends from their own wallet. Payclave never initiates a wallet transfer, signs a refund transaction, or holds a refund balance. Recording a reference is not proof that a transfer reached the customer.

Use refund-checks before sending. The check identifies the available amount, destination risks, and whether approval is required. Refund verification depends on feature and network availability; FEATURE_UNAVAILABLE must be resolved before you promise automatic verification. Test mode simulates the refund flow.

Check the payment and destination

Read the invoice and its payment records. Select the paymentId, a positive decimal amount, and the customer's destination address. Inspect allowed, blockedReason, requiresApproval, refundableAmount, overpaidAmount, destinationSource, and warnings. The check itself records no refund and sends nothing.

Confirm who controls the destination independently. Overpaid funds can only be returned to the wallet the customer proved they paid from; refunds to other destinations cannot exceed the invoice's commercial total across the invoice. Recording a different destination requires destinationReason. An exchange-reported payer address may not be a safe return address.

bash
curl https://api.payclave.com/v1/invoices/YOUR_INVOICE_ID/refund-checks \  -H "Authorization: Bearer sk_test_..." \  -H "Content-Type: application/json" \  -d '{ "paymentId": "YOUR_PAYMENT_ID", "amount": "5.00", "destinationAddress": "CUSTOMER_WALLET_ADDRESS" }'

Send and record the transfer

After any required approval, the merchant reviews and signs the transfer in their own wallet. Use the settlement token, destination, chain, and exact amount agreed with the customer. Keep the transaction hash; do not send a second transfer because recording the first timed out.

Record the refund with paymentId, amount, reason, destinationAddress, chainId, tokenContract, and the externalTransactionHash. Supply destinationReason where required. Omit the transaction hash in test mode, where Payclave simulates it. Reuse the same idempotency key and body if the reference request needs to be retried.

Follow verification and reconcile failures

A pending adjustment waits for verification. Use invoice.refund_verified to learn that Payclave verified the transfer, or invoice.refund_failed and verificationFailureReason to investigate failure. Unverified evidence requires your own review; invoice.refund_recorded alone does not prove delivery.

A failed verification retains failedTransactionHash and releases the recorded amount for another reference. Inspect the actual chain transaction and destination before deciding whether any further transfer is needed. A transfer from another wallet can still verify; senderAddress and the sent_from_other_wallet flag preserve that risk context.

On this page