Webhooks
List webhook endpoints for the current mode
get/v1/webhook_endpoints
Responses
- 200Webhook endpointsobject
Show the fields
object"list"dataarray of WebhookEndpointFields of data
idstring (uuid)object"webhook_endpoint"livemodebooleanurlstring (uri)eventsarray of payment_intent.successful | payment_intent.failed | payment_intent.abandoned | payment_intent.canceled | refund.succeeded | refund.failed | payout.paid | payout.failed | payout.canceled | dispute.created | dispute.won | dispute.lost | invoice.paid | crypto_payout.paid | crypto_payout.failed | topup.succeededAlways empty. Every endpoint receives every event type.
statusenabledAlways enabled. Endpoints aren't paused; delete one to stop it, and it leaves the list.
created_atstring (date-time)has_moreboolean
curl https://sandbox.api.biftpay.com/v1/webhook_endpoints \
-H "Authorization: Bearer bp_test_..."{
"object": "list",
"data": [
{
"id": "…",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://example.com/biftpay/webhooks",
"events": [
"payment_intent.successful"
],
"status": "enabled",
"created_at": "…"
}
],
"has_more": true
}Register a webhook endpoint
post/v1/webhook_endpoints
The signing secret is returned once, here. URLs must be https with a public
hostname. Each delivery has headers Biftpay-Event-Id, Biftpay-Timestamp and
Biftpay-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<event id>.<body>">.
Recompute it with the secret, compare in constant time and reject anything older
than 5 minutes. Failed deliveries retry after 1m, 5m, 30m, 2h, 6h and 12h.
Every endpoint receives every event type.
Parameters
Idempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Body
urlstring (uri)requiredeventsarray of payment_intent.successful | payment_intent.failed | payment_intent.abandoned | payment_intent.canceled | refund.succeeded | refund.failed | payout.paid | payout.failed | payout.canceled | dispute.created | dispute.won | dispute.lost | invoice.paid | crypto_payout.paid | crypto_payout.failed | topup.succeededIgnored. Every endpoint receives every event type.
Responses
- 201Createdobject
Show the fields
idstring (uuid)object"webhook_endpoint"livemodebooleanurlstring (uri)eventsarray of payment_intent.successful | payment_intent.failed | payment_intent.abandoned | payment_intent.canceled | refund.succeeded | refund.failed | payout.paid | payout.failed | payout.canceled | dispute.created | dispute.won | dispute.lost | invoice.paid | crypto_payout.paid | crypto_payout.failed | topup.succeededAlways empty. Every endpoint receives every event type.
statusenabledAlways enabled. Endpoints aren't paused; delete one to stop it, and it leaves the list.
created_atstring (date-time)secretstring - 400Invalid request
curl -X POST https://sandbox.api.biftpay.com/v1/webhook_endpoints \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"url": "https://merchant.example.com/biftpay/webhooks"
}'{
"id": "…",
"object": "webhook_endpoint",
"livemode": true,
"url": "https://example.com/biftpay/webhooks",
"events": [
"payment_intent.successful"
],
"status": "enabled",
"created_at": "…",
"secret": "whsec_3jR8kQ2nVt9Lm4Xp7Wc1Zy6Hb0Gf5Sd"
}Delete an endpoint
post/v1/webhook_endpoints/{id}/delete
Nothing more is sent to it, including deliveries still waiting, and it leaves the list. Its past deliveries stay in the event history. This can't be undone; add the URL again to get a new endpoint (with a new signing secret).
Parameters
idstring (uuid)in pathrequiredIdempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Responses
- 200Deletedobject
Show the fields
idstringobject"webhook_endpoint"deletedtrue - 404Not found, or not visible to this key
curl -X POST https://sandbox.api.biftpay.com/v1/webhook_endpoints/{id}/delete \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"{
"id": "…",
"object": "webhook_endpoint",
"deleted": true
}List events and their delivery status
get/v1/events
Parameters
limitintegerin query1 to 100 · default 20
starting_afterstring (uuid)in queryThe id of the last item on the previous page.
typepayment_intent.successful | payment_intent.failed | payment_intent.abandoned | payment_intent.canceled | refund.succeeded | refund.failed | payout.paid | payout.failed | payout.canceled | dispute.created | dispute.won | dispute.lost | invoice.paid | crypto_payout.paid | crypto_payout.failed | topup.succeededin querypayment_intentstring (uuid)in queryOnly this payment's events, including its refunds' and disputes'. Send one again with POST /v1/events/{id}/redeliver.
Responses
- 200A page of eventsEventList
Show the fields
object"list"dataarray of EventFields of data
idstring (uuid)object"event"typepayment_intent.successful | payment_intent.failed | payment_intent.abandoned | payment_intent.canceled | refund.succeeded | refund.failed | payout.paid | payout.failed | payout.canceled | dispute.created | dispute.won | dispute.lost | invoice.paid | crypto_payout.paid | crypto_payout.failed | topup.succeededlivemodebooleancreated_atstring (date-time)dataobjectdeliveriesarray of objecthas_moreboolean
curl https://sandbox.api.biftpay.com/v1/events \
-H "Authorization: Bearer bp_test_..."{
"object": "list",
"data": [
{
"id": "…",
"object": "event",
"type": "payment_intent.successful",
"livemode": true,
"created_at": "…",
"data": {
"object": {}
}
}
],
"has_more": true
}Send an event again to its endpoints
post/v1/events/{id}/redeliver
Parameters
idstring (uuid)in pathrequiredIdempotency-Keystringin headerrequiredA unique key per logical request, for example a UUID. Up to 255 characters.
up to 255 characters
Responses
- 200How many deliveries were queuedobject
Show the fields
object"event_redelivery"event_idstringqueuedinteger
curl -X POST https://sandbox.api.biftpay.com/v1/events/{id}/redeliver \
-H "Authorization: Bearer bp_test_..." \
-H "Idempotency-Key: $(uuidgen)"{}