Skip to content

Delete and cancel

Which objects can be deleted, cancelled or revoked, and how.


The API has different actions for ending each object. This table lists the available action and its limits.

Object What you can do How
Payment Cancel while nobody has paid it: it ends as failed. Otherwise it ends by itself as paid, failed or expired Cancel a payment; follow it with Get a payment or webhooks
Payment link Cancel: no new payments, and payments already made stay Cancel a payment link
Invoice Delete a draft; void an issued one (not once it is paid or being paid). The number stays used Delete a draft invoice, Void an invoice
Webhook endpoint Delete: events are no longer sent to it Delete a webhook endpoint
API key Revoke: requests with it stop working at once and this cannot be undone The dashboard, see Get your API keys
Project Deactivate: new payments are not accepted until you reactivate it The dashboard, see Create a project
Terminal window
curl -X POST "https://api.baiyar.com/v1/payment-links/lnk_01k7q3m8x2v5t9n4b6c1d0e7fa/cancel" \
-H "Authorization: Bearer $BAIYAR_KEY" \
-H "Idempotency-Key: cancel-invoice-2041"

The answer is the link as it is now, in data, with state: "cancelled" and a cancelled_at. A payer who opens it can no longer pay. Payments already made through it are not changed. Send the same request with the same Idempotency-Key again and you get the same answer.

Terminal window
curl -X DELETE "https://api.baiyar.com/v1/webhook-endpoints/whk_01k7q3m8x2v5t9n4b6c1d0e7fa" \
-H "Authorization: Bearer $BAIYAR_KEY"
{
"data": { "id": "whk_01k7q3m8x2v5t9n4b6c1d0e7fa", "deleted": true },
"meta": { "request_id": "req_Hy3k9QzT2LmN8vXa" }
}

The answer says which endpoint went. A deleted endpoint cannot be brought back: register it again, which gives a new signing secret. To stop events without losing the endpoint, change its state with Update a webhook endpoint instead.