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:string
required
Webhook verification token - can get from dashboard
string
required
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
string
The event enum:
terminal_session.completed, terminal_session.voided, terminal_session.canceledstring
Xendit business ID
DateTime
Timestamp for webhook notification creation
object
Payment session data
string
Xendit-generated identifier for business that owns the transaction
string
Merchant’s reference ID
string
Payment Session ID
string
Country where the payment happened
string
ISO 4217 Alpha-3 code
number
Amount of session
object
Payment details
string
Terminal’s id
string
Merchant’s Order ID
string
Payment status
object
A set of key-value pairs that can be used to store custom, unstructured information about the object
DateTime
The timestamp indicates when the resource was created
DateTime
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
string
The event enum:
terminal_payment.succeeded, terminal_payment.voidedstring
Xendit business ID
DateTime
Timestamp for webhook notification creation
object
Payment object data
string
Xendit-generated identifier for business that owns the transaction
string
Merchant’s reference ID
string
Payment ID
string
Country where the payment happened
string
ISO 4217 Alpha-3 code
number
Amount of payment
object
Payment details
string
Terminal’s id
string
Merchant’s Order ID
string
Payment status
object
A set of key-value pairs that can be used to store custom, unstructured information about the object
DateTime
The timestamp indicates when the resource was created
DateTime
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:string
Error code
string
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