Events & Webhooks API

ClapPay sends webhook notifications when events happen in your account. Subscribe to events by creating webhook endpoints and selecting the event types you want to receive.

Endpoints

GET/api/v1/payment/webhook-events/

List all webhook events with pagination. Filter by type, status, created_after.

GET/api/v1/payment/webhook-events/{id}/

Get event detail including full payload.

POST/api/v1/payment/webhook-events/{id}/retry/

Retry delivery of a failed event.

GET/api/v1/payment/webhook-event-types/

List all available event types and their descriptions.

GET/api/v1/payment/webhook-endpoints/

List webhook endpoints.

POST/api/v1/payment/webhook-endpoints/

Create a webhook endpoint. Body: { url, events, description? }

POST/api/v1/payment/webhook-endpoints/{id}/test/

Send a test event to verify your endpoint.

POST/api/v1/payment/webhook-endpoints/{id}/rotate-secret/

Rotate the endpoint signing secret.

Event Types

Payments

payment_intent.createdpayment_intent.succeededpayment_intent.payment_failedpayment_intent.canceledcharge.succeededcharge.failedcharge.refunded

Subscriptions

subscription.createdsubscription.updatedsubscription.deletedsubscription.trial_will_endsubscription.past_duesubscription.resumed

Invoices

invoice.createdinvoice.finalizedinvoice.paidinvoice.payment_failedinvoice.voidedinvoice.sent

Customers

customer.createdcustomer.updatedcustomer.deleted

Disputes

dispute.createddispute.updateddispute.closeddispute.funds_withdrawndispute.funds_reinstated

Products & Prices

product.createdproduct.updatedproduct.deletedprice.createdprice.updatedprice.deleted

Checkout

checkout.session.completedcheckout.session.expiredcheckout.session.async_payment_succeeded

Credit Notes

credit_note.createdcredit_note.voided

Discounts

coupon.createdcoupon.updatedcoupon.deleted

Event Object

{
  "id": "evt_1234567890",
  "type": "payment_intent.succeeded",
  "created": "2026-02-16T12:00:00Z",
  "livemode": true,
  "data": {
    "object": {
      "id": "pi_xxx",
      "amount": 2999,
      "currency": "usd",
      "status": "succeeded",
      "customer": "cus_xxx"
    }
  },
  "request": {
    "id": "req_xxx",
    "idempotency_key": null
  }
}

Signature Verification

Verify webhook signatures using the ClapPay-Signature header and your endpoint secret key.

import hmac
import hashlib

def verify_signature(payload, signature, secret):
    expected = hmac.new(
        secret.encode(),
        payload.encode(),
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(expected, signature)