Callbacks
The Terminal API uses webhooks to notify your application about payment session and payment object events. This allows you to receive real-time updates about transaction status changes.Webhook Configuration
Webhooks are configured through the Xendit Dashboard. You’ll need to provide a webhook URL where notifications will be sent.Make sure your webhook endpoint is publicly accessible and can handle POST requests with JSON payloads.
Authentication
All webhook requests include authentication headers to verify the source:Webhook verification token - can get from dashboard
Unique identifier for the webhook request
Payment Session Callbacks
These callbacks are triggered by payment session events.Endpoint
Events
terminal_session.completed
Payment session has been completed successfully
terminal_session.voided
Payment session has been voided
terminal_session.canceled
Payment session has been canceled
Payload Structure
The event enum:
terminal_session.completed, terminal_session.voided, terminal_session.canceledXendit business ID
Timestamp for webhook notification creation
Payment session data
Xendit-generated identifier for business that owns the transaction
Merchant’s reference ID
Payment Session ID
Country where the payment happened
ISO 4217 Alpha-3 code
Amount of session
Payment details
Terminal’s id
Merchant’s Order ID
Payment status
A set of key-value pairs that can be used to store custom, unstructured information about the object
The timestamp indicates when the resource was created
The timestamp indicates when the resource was last modified
Example Payment Session Callback
Payment Object Callbacks
These callbacks are triggered by payment object events.Endpoint
Events
terminal_payment.succeeded
Payment has been successfully processed
terminal_payment.voided
Payment has been voided
Payload Structure
The event enum:
terminal_payment.succeeded, terminal_payment.voidedXendit business ID
Timestamp for webhook notification creation
Payment object data
Xendit-generated identifier for business that owns the transaction
Merchant’s reference ID
Payment ID
Country where the payment happened
ISO 4217 Alpha-3 code
Amount of payment
Payment details
Terminal’s id
Merchant’s Order ID
Payment status
A set of key-value pairs that can be used to store custom, unstructured information about the object
The timestamp indicates when the resource was created
The timestamp indicates when the resource was last modified
Example Payment Object Callback
Response Handling
Your webhook endpoint should respond with appropriate HTTP status codes:Success
HTTP status code = 200Indicates successful processing of the webhook
Error
HTTP status code != 200Indicates an error in processing the webhook
Error Response Format
If you need to return an error, include the following fields in your response:Error code
Providing additional information about the response
Example Error Response
Best Practices
Idempotency
Implement idempotency to handle duplicate webhook deliveries
Retry Logic
Xendit will retry failed webhooks, so ensure your endpoint can handle retries
Security
Always verify the webhook signature using the x-callback-token
Logging
Log all webhook events for debugging and audit purposes