Thai/v1/webhooksWebhook Configuration
Where the merchant registers their URL to receive status updates. Webhooks allow you to receive real-time notifications about payment events.
Overview
Configure webhooks to receive real-time notifications about payment events. When a payment status changes, we'll send a POST request to your configured URL with the event details.
Available Events:
payment.succeeded- Payment completed successfullypayment.failed- Payment was declined or failedpayment.pending- Payment is being pendingwithdrawal.processed- withdrawal procssedwithdrawal.succeeded- withdrawal completed successfullywithdrawal.failed- withdrawal was declined or failedwithdrawal.pending- withdrawal is being pendingrefund.completed- Refund has been processedrefund.failed- Refund could not be processed
Available Events
withdrawal is being processed
withdrawal completed successfully
withdrawal was declined or failed
withdrawal is being pending
Payment completed successfully
Payment was declined or failed
Payment is being pending
Refund has been processed
Refund could not be processed
Security:
Always verify webhook signatures to ensure requests are from 1401. Learn how to verify webhooks
Request
urlThe HTTPS URL where webhook events will be sent. Must be publicly accessible.
eventsArray of event types you want to receive. See available events above.
secretYour webhook secret for signature verification. If not provided, one will be generated.
Code Examples
curl -X POST "https://api.1401.com/Thai/v1/webhooks" \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-merchant-site.com/api/webhooks/payment",
"events": [
"payment.succeeded",
"payment.failed",
"refund.completed"
],
"secret": "whsec_your_webhook_secret"
}'Webhook Payload
{
"event": "payment.succeeded",
"data": {
"payment_id": "pay_1234567890abcdef",
"status": "succeeded",
"amount": 10000,
"currency": "THB"
},
"timestamp": "2024-01-15T10:30:15Z"
}Response
Status Codes
{
"webhook_id": "wh_1234567890abcdef",
"url": "https://your-merchant-site.com/api/webhooks/payment",
"events": [
"payment.succeeded",
"payment.failed",
"refund.completed"
],
"status": "active",
"created_at": "2024-01-15T10:00:00Z"
}{
"error": {
"code": "invalid_url",
"message": "The webhook URL is invalid or unreachable",
"type": "validation_error"
}
}