Configure bank payments with Pay2S
Connect a bank account, create a Pay2S webhook, store its secret and configure recipient details in ChatHub for automatic wallet crediting.
How Pay2S works with ChatHub#
When a customer reaches a Top up via Pay2S workflow step, ChatHub creates a reference code beginning with NAP and sends transfer instructions. Pay2S watches the connected bank account and posts incoming transfers to ChatHub; a positive transfer carrying the correct code is recorded and credited to the customer's wallet.
- 1
Connect the recipient bank account to Pay2S.
- 2
Create an Incoming webhook in Pay2S using the address supplied by ChatHub.
- 3
Copy the webhook secret key and save it with recipient bank details in ChatHub.
- 4
Use a workflow with a Top up via Pay2S step, then verify a test transfer containing the exact reference code.
1. Prepare the accounts and public URL#
- 1
A ChatHub account allowed to open Administration → Settings → Payments.
- 2
An active Pay2S account and a bank account supported by Pay2S. Have the bank login, account-holder information and OTP method available if required.
- 3
A production ChatHub domain with HTTPS that Pay2S can reach from the Internet. Do not use localhost or a DDEV hostname that works only on your computer for a real webhook.
- 4
Choose the recipient account. The bank, account number and holder entered in ChatHub must match it so customers receive accurate instructions.
2. Connect the bank account in Pay2S#
- 1
In the Pay2S customer centre, open Ngân hàng (Bank) → Thêm tài khoản (Add account).
- 2
Check the supported account types for each bank: personal, household business or company. Click Kết nối (Connect) on the correct bank row.
- 3
Choose the API method offered for that bank, enter all requested information and review the service policies before accepting them.
- 4
Complete OTP if requested. Return to Bank and confirm that the new account is active before creating the webhook.
3. Copy the webhook address from ChatHub#
- 1
In ChatHub, open Administration → Settings and select Payments.
- 2
Expand Pay2S under Bank transfer.
- 3
Under Webhook address, click Copy. It has the form https://your-chathub-domain/api/payments/pay2s/webhook.
- 4
Confirm that it uses your public production HTTPS domain before pasting it into Pay2S.
4. Create an Incoming webhook in Pay2S#
- 1
Return to Pay2S, open Webhooks → Danh sách webhook (Webhook list), then click Thêm webhook (Add webhook).
- 2
Give it a recognizable name, such as ChatHub - incoming.
- 3
Choose Tiền vào (Incoming) for the event and select the bank account connected in step 2.
- 4
Paste the ChatHub address into Gọi đến URL (Webhook URL).
- 5
Keep the optional payment-code structure set to Không giới hạn theo mã thanh toán (No payment-code restriction) so ChatHub can match NAP codes in transfer descriptions. Invoice information is not required for this wallet top-up flow.
- 6
Review the account, event and URL, then click Thêm webhook.
5. Copy the secret key and save ChatHub settings#
- 1
Immediately after creating the webhook, copy the token/secret shown by Pay2S. Pay2S documentation says it appears only once during webhook creation.
- 2
Return to Pay2S settings in ChatHub and paste it into Webhook secret key.
- 3
Enter the bank, account number and holder exactly as used by the recipient account in Pay2S. The workflow includes these three values in customer transfer instructions.
- 4
Click Save and wait for the payment-settings saved message. The Pay2S card should show Configured.
6. Use Pay2S in a wallet top-up workflow#
- 1
Open Automation → Workflow and choose the sales or top-up workflow that should offer bank transfer.
- 2
Add or inspect the Top up via Pay2S step. If it says Pay2S configuration required, return to step 5 and confirm that the secret was saved.
- 3
Make sure the workflow sends the correct bank, account number, holder, amount and reference generated by the Pay2S step.
- 4
Enable the workflow after reviewing success, failure and cancellation paths. Avoid having several workflows greet or process the same customer unless intended.
7. Verify transfer detection and wallet credit#
- 1
Run a test contact through the Top up via Pay2S step and record the amount and NAP code supplied by ChatHub.
- 2
Transfer the exact amount to the correct account and place the full NAP code in the transfer description. Use one transaction for one test.
- 3
In Pay2S, confirm the incoming transfer under Bank transactions, then inspect Webhooks → Transaction history for delivery to ChatHub.
- 4
In ChatHub, confirm that the workflow continues, the customer's wallet increases by the correct amount and balance history identifies the payment gateway.
8. Troubleshoot common failures#
- 1
Pay2S does not see the transfer: confirm the bank connection is active, its session/OTP remains valid and the transfer appears under Bank transactions.
- 2
Webhook does not run: confirm it is enabled, uses Incoming, selects the intended account and calls a public HTTPS URL. Inspect its response under Webhook transaction history.
- 3
ChatHub returns 401: the stored secret does not match the webhook token. Recreate or copy the Pay2S token and store the new value in ChatHub.
- 4
Webhook arrives but the wallet is unchanged: check for a positive amount, the complete NAP code for a pending top-up and whether that code was already used.
- 5
Customer instructions are wrong: update Bank, Account number or Account holder in ChatHub and save. The secret does not need changing if the webhook is unchanged.
- 6
Pay2S retries delivery when the endpoint does not return HTTP 200. Do not create duplicate webhooks as a routine fix because they complicate reconciliation.
9. Keep the integration secure#
- 1
Limit access to payment settings and the Pay2S account.
- 2
Never share the secret through email, group chat or public documents. If exposure is suspected, replace the webhook token and update ChatHub immediately.
- 3
Monitor webhook transaction history for failures or timeouts and reconcile bank transfers with wallet movements before making manual adjustments.
- 4
When changing recipient accounts, update the Pay2S connection, webhook selection and all three bank fields in ChatHub before re-enabling the workflow.