Quick Start
SePay Webhooks allow your application to receive real-time transaction notifications whenever money flows in or out of your linked bank account. Instead of constantly polling, SePay proactively sends transaction data to your specified URL.
If you need a test environment, register an account at my.dev.sepay.vn. Here you can create simulated transactions and webhooks for development purposes. After registration, please contact SePay to activate your account.
Integration Overview
The diagram below illustrates the complete integration flow — from configuring webhooks, generating payment QR codes, receiving transaction notifications via webhook, to periodic transaction reconciliation.
How It Works
- A customer transfers money to your bank account
- SePay detects the new transaction and sends a POST request to your configured webhook URL
- Your server receives the data, processes it and responds with
{"success": true}
Quick start
Step 1: Create a Webhook on Dashboard
Access WebHooks
Log in to my.sepay.vn → select WebHooks menu.
Add a New WebHook
Click the + Add webhooks button and fill in:
- Name: Any name to identify the webhook
- Select Event: Choose when to trigger the webhook: money in, money out, or both
- Select Conditions: Choose the bank account(s) that will trigger webhooks
- Call URL: The endpoint that will receive webhooks. To build a custom receiver, see the PHP guide or Node.js guide
- Authentication: Choose OAuth 2.0, API Key or No authentication
Complete
Click Add to finish the integration.
Full configuration details: Create Webhooks
Step 2: WebHook Payload Data
SePay sends a POST request with the following JSON payload:
{
"id": 92704,
"gateway": "Vietcombank",
"transactionDate": "2023-03-25 14:02:37",
"accountNumber": "0123499999",
"code": null,
"content": "chuyen tien mua iphone",
"transferType": "in",
"transferAmount": 2277000,
"accumulated": 19077000,
"subAccount": null,
"referenceCode": "MBVCB.3278907687",
"description": ""
}null if not detected.in = deposit, out = withdrawalnull.Step 3: Sample Webhook Receiver Code
<?php// File: webhook/sepay.php// Get data from POST request$data = json_decode(file_get_contents('php://input'));if (!is_object($data)) {http_response_code(400);echo json_encode(['success' => false, 'message' => 'Invalid data']);exit;}// Verify API Key$apiKey = $_SERVER['HTTP_AUTHORIZATION'] ?? '';if ($apiKey !== 'Apikey YOUR_API_KEY') {http_response_code(401);echo json_encode(['success' => false, 'message' => 'Unauthorized']);exit;}// Deduplication: check if id has been processed// if (transactionExists($data->id)) { ... return; }// Process transaction$transactionId = $data->id;$amount = $data->transferAmount;$code = $data->code; // Payment code (order ID)$type = $data->transferType; // 'in' or 'out'if ($type === 'in' && $code) {// TODO: Update order status by $code// updateOrderStatus($code, 'paid', $amount);}// Respond with success — REQUIREDhttp_response_code(200);echo json_encode(['success' => true]);
Detailed guides for saving transactions to MySQL: PHP · Node.js
Step 4: Recognizing Successful WebHooks
When receiving a webhook from SePay, your server must respond correctly for SePay to mark it as successful:
- OAuth 2.0: Response body
{"success": true}— HTTP Status Code201 - API Key: Response body
{"success": true}— HTTP Status Code200or201 - No authentication: Response body
{"success": true}— HTTP Status Code200or201
If the response does not meet these conditions, SePay will consider the webhook failed.
Timeout parameters:
Step 5: Testing WebHooks
- Demo account: Go to Transactions → Simulate Transaction to create a test transaction. See the Simulate Transaction guide.
- Real account: Send a small amount to your bank account to trigger a real transaction.
- View logs: Go to Logs → WebHooks Log to see all sent webhooks.
- Per-transaction view: Go to Transactions → Auto column → select Pay to see webhooks for each transaction.
Next Steps
- QR Code and Payment Form — Create bank transfer QR codes and build an auto-confirming payment page
- Create Webhooks — Detailed webhook configuration (events, conditions, retry, authentication)
- Webhooks Programming (PHP) — Step-by-step guide to save transactions to MySQL with PHP
- Webhooks Programming (Node.js) — Step-by-step guide with Node.js + Express
- Transaction Reconciliation — Ensure no transactions are missed