Esenda
Recurring Payments

Payment Webhooks

Receive event notifications for recurring payment transactions

If a notification_url is provided in the payment request, Esenda sends webhooks for the following events:

ScenarioEvent Type
Payment successfully processedrecurring_payment.success
Payment processing failsrecurring_payment.failed
Payment is refundedrecurring_payment.refunded
Payment is partially refundedrecurring_payment.partially_refunded
  • Currently supports single card per customer. Multiple cards per customer will be supported in a future version.
  • When a customer has only one active card, it is automatically used for payment requests.
  • If payment fails, customers can retry using standard manual payment methods.
  • Receipts (send_confirmation_email: true) are only sent for successful payments, not failures or refunds.

HMAC Signature Verification

All webhooks include an X-Hmac-Signature header. Use the webhook HMAC shared secret provided by Esenda with SHA-512 to verify authenticity.

Webhook Headers

Content-Type:      application/json
X-Hmac-Signature:  <hmac_signature>

Payment Success

{
  "id": "456e7890-e89b-12d3-a456-426614174000",
  "created_at": "2024-01-23 15:30:45.123456",
  "event_type": "recurring_payment.success",
  "shortcode": "example-school",
  "data": {
    "order_id": "f1e2d3c4-5678-9012-3456-789012345678",
    "tokenised_card_id": "c3e7f8a9-1234-5678-9012-3456789abcde",
    "idempotency_id": "8e87ef2a-9faf-4627-9a54-8aca13890335",
    "amount": 1500,
    "status": "completed",
    "reference": "INV-2024-001",
    "description": "School fees payment",
    "card_last_four": "1234",
    "card_brand": "visa",
    "confirmation_email_sent": true,
    "processed_at": "2024-01-23 15:30:45.123456"
  }
}

Payment Failure

{
  "id": "456e7890-e89b-12d3-a456-426614174001",
  "created_at": "2024-01-23 15:32:15.654321",
  "event_type": "recurring_payment.failed",
  "shortcode": "example-school",
  "data": {
    "order_id": "f1e2d3c4-5678-9012-3456-789012345678",
    "tokenised_card_id": "c3e7f8a9-1234-5678-9012-3456789abcde",
    "idempotency_id": "8e87ef2a-9faf-4627-9a54-8aca13890335",
    "amount": 1500,
    "status": "failed",
    "reference": "INV-2024-001",
    "description": "School fees payment",
    "card_last_four": "1234",
    "card_brand": "visa",
    "error_message": "Insufficient funds",
    "error_code": "card_declined",
    "processed_at": "2024-01-23 15:32:15.654321"
  }
}

Payment Partially Refunded

{
  "id": "456e7890-e89b-12d3-a456-426614174001",
  "created_at": "2024-01-23 15:32:15.654321",
  "event_type": "recurring_payment.partially_refunded",
  "shortcode": "example-school",
  "data": {
    "order_id": "f1e2d3c4-5678-9012-3456-789012345678",
    "tokenised_card_id": "c3e7f8a9-1234-5678-9012-3456789abcde",
    "idempotency_id": "8e87ef2a-9faf-4627-9a54-8aca13890335",
    "amount": 1500,
    "amount_refunded": 700,
    "status": "partially_refunded",
    "reference": "INV-2024-001",
    "description": "School fees payment",
    "card_last_four": "1234",
    "card_brand": "visa",
    "processed_at": "2024-01-23 15:32:15.654321"
  }
}

On this page