Automated Payment with SePay
Want to optimize your order processing workflow and automatically confirm payments when customers transfer money? The Automated Payment with SePay feature on AhaChat is the ideal solution for you!
Automated Payment with SePay allows your chatbot to detect successful bank transfers, automatically confirm the order, and continue the customer journey—all without manual intervention.
How does this feature work?
When a customer places an order via chatbot, the system will display the payment information (amount and transfer note or a QR code). Once the customer makes a successful bank transfer, SePay verifies the transaction and sends a notification to AhaChat, which then allows the chatbot to continue processing the order automatically.
Copy the sample flow at: https://app.ahachat.com/share-story-to-bot/b058a1431759ed104d2fb8fb638deda1ltxu8MStPu3808524
View demo: https://m.me/ahachatdemo?ref=sepaypayment
Register a SePay Account & Get a Virtual Account (VA)
Before integrating, you need to:
- Register a SePay account at:
👉 https://docs.sepay.vn/dang-ky-sepay.html
- Create a sub-account (Virtual Account - VA) at:
👉 https://docs.sepay.vn/tai-khoan-phu.html
After creating, you will receive a Virtual Account number (VA) – use this VA to set up in AhaChat so the system can automatically recognize matching transactions.
Step 1: Add Your Bank Account to AhaChat
Go to AhaChat → Sales → Payments → Bank Account Info, and fill in the following:
Bank name
Account number (VA)
Account holder name
Step 2: Connect SePay with AhaChat
1. Generate an API Key on AhaChat
Go to the integration section and copy your API Key to use for authenticating with SePay’s webhook.
2. Set Up Webhook on SePay
On SePay, go to “Webhook Integration” → click “+ Add Webhook” → under “Call URL”, enter:
📌 Replace BOT_ID
with your bot’s actual ID from AhaChat.
Choose authentication type as API Key, and paste the API Key from AhaChat into the corresponding field.
Step 3: Create a Payment Block Using SePay in AhaChat
Go to Create New Block → Select Payment Block → SePay
Configure:
Amount: Use a bot variable, e.g.,
{{price}}
QR Code: Use an API to generate a QR code link
Generate a Payment QR Code:
Use VietQR API to create a dynamic QR Code:
Example:
Replace:
<BANK_ID>
: Bank code (refer to: https://vietqr.io/danh-sach-api/link-tao-ma-nhanh)<ACCOUNT_NO>
: Bank account number (VA)<ACCOUNT_NAME>
: Account holder’s name<AMOUNT>
:{{format(price, '')}}
or{{price}}
<DESCRIPTION>
:{{bank_code}}
Step 4: Set Up Conditional Branching After Payment
After the customer transfers the money and SePay verifies the transaction:
Payment Success → the bot will continue processing the order
Payment Failed → resend payment instructions to the customer
👉 You can also add a button to open a Webform showing the QR code and payment details for easy access.