Public
SePay → Base44 webhook: auto top-up wallet
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Webhook trung gian nhận giao dịch từ SePay, trích xuất email từ nội dung chuyển khoản, và tự động cộng tiền vào ví (wallet) người dùng trên Base44 Shop.
Rendering mermaid diagram...
- Khách chuyển khoản với nội dung chứa email:
minhduongceo102@gmail.com→ nhận diện trực tiếpminhduongceo102gmailcomhoặcminhduongceo102gmail.com→ tự thêm@minhduongceo102(chỉ username) → tự thêm@gmail.comnapvi minhduongceo102→ bỏ từ banking, giữ username
- SePay gửi webhook POST tới Val Town
- Webhook trích xuất email, validate số tiền, tìm user trên Base44, cộng số dư
- Chống trùng lặp bằng
sepay_id
| Key | Mô tả |
|---|---|
BASE44_APP_ID | App ID từ Base44 (trong URL editor) |
BASE44_ADMIN_EMAIL | Email admin user |
BASE44_ADMIN_PASSWORD | Password admin user |
- Webhook URL: Copy endpoint URL của file
webhook.ts - Phương thức: POST
- Content Type: JSON
- Sự kiện: Chỉ tiền vào (In only)
| File | Mô tả |
|---|---|
webhook.ts | HTTP handler - entry point |
handler.ts | Xử lý logic webhook |
base44-client.ts | Kết nối Base44 API |
utils.ts | Trích xuất email + validate payload |
test-utils.ts | Unit tests cho email extraction |
Bạn cần kiểm tra tên entities trong Base44 app của mình. File base44-client.ts giả định:
- Entity
Usercó trườngemail - Entity
Walletcó trườngbalancevàuser_id - Entity
Transactioncó các trườnguser_id,wallet_id,amount,type,description,reference,sepay_id
Nếu tên khác, cần chỉnh sửa trong base44-client.ts.