Developer Documentation

Complete guide to integrate your organizer system with Akal's webhook infrastructure

Webhook Integration Features

Real-time transaction updates
Secure webhook verification
Flexible event filtering
Retry mechanism for failed deliveries

Webhook Integration Guide

Step-by-step guide to integrate your organizer system with Akal's webhook system

Setting Up Webhooks

1

Configure Webhook URL

Set your webhook URL in school settings under the webhook configuration section.

2

Generate Verification Token

Create a secure verification token to authenticate incoming webhook requests.

3

Enable Webhook on Services

Configure which services should trigger webhook notifications. You can enable it on service's dashboard.

Webhook Payload Structure

{
  "event": "transaction.updated",
  "data": {
    "id": "transaction_cuid",
    "paymentId": "payment_123",
    "status": "PAID",
    "amount": 150000,
    "schoolId": "muslimbootstrap",
    "user": {
      "name": "John Doe",
      "email": "john@example.com",
      "phone": "62812345678"
    },
    "service": {
      "id": "class_cuid",
      "name": "Class Name"
    },
    "priceScheme": {
      "id": "price_scheme_cuid",
      "name": "Price Scheme Name",
      "price": 150000
    },
    "crossSales": [
      {
        "id": "cross_sale_cuid",
        "name": "Additional Course",
        "price": 50000
      }
    ],
    "createdAt": "2024-01-24T08:00:00.000Z",
    "paidAt": "2024-01-24T08:12:00.000Z",
  },
  "idempotencyKey": "idempotency-key",
  "token": "verification_token"
}

Important Fields to Handle

event: Currently only supports "transaction.updated" - sent when transaction status changes (currently when transaction is paid)
status: Currently only supports "PAID" - indicates transaction has been paid successfully

Security Considerations

  • • Always verify webhook token to ensure requests are from Akal
  • • Use HTTPS endpoints for your webhook URLs
  • • Implement idempotency in your webhook handlers to handle duplicate deliveries
  • • Return appropriate HTTP status codes (2xx for success, 4xx/5xx for failures)

Authentication & Security

Understanding authentication mechanisms and securing your webhook endpoints

Webhook Verification

All webhook requests include a verification token that you can use to authenticate the request is from Akal.

// Verify webhook token
const receivedToken = req.body.token;
const expectedToken = 'your_stored_token';

if (receivedToken !== expectedToken) {
  return res.status(401).json({ error: 'Invalid token' });
}

// Process webhook data
console.log('Webhook verified:', req.body.data);

Best Practices

  • Use HTTPS

    Always use HTTPS endpoints for your webhook URLs to encrypt data in transit.

  • Implement Idempotency

    Handle duplicate webhook deliveries by checking if you've already processed the transaction ID.

  • Return Proper Status Codes

    Return 2xx status codes for successful processing and 4xx/5xx for failures to trigger retry logic.

Need More Help?

Check out our complete API documentation or contact our support team for assistance with your integration.