Thông báo thời gian thực (RTDN) — tùy chọn
Google Play báo ngay khi có giao dịch mới, hoàn tiền hoặc hủy. Không có RTDN, Portal vẫn thu hồi hoàn tiền nhờ cron 02:25 hằng ngày — chỉ chậm hơn.
i
Backend nhận thông báo ở POST /webhooks/play-store; nginx chuyển /webhooks/ sang backend (cần bản nginx/nginx.conf.template có location /webhooks/; sau khi đổi template phải docker compose -f docker-compose.prod.yml restart nginx). Thiếu GOOGLE_PUBSUB_AUDIENCE thì backend từ chối mọi thông báo — đặt biến này trước khi bật ở Play Console.
- Google Cloud Console → Pub/Sub → Topics → Create topic, ví dụ
play-rtdn. - Topic → Permissions → Add principal:
google-play-developer-notifications@system.gserviceaccount.com, role Pub/Sub Publisher. - Topic → Create subscription: loại Push, endpoint
https://portal.tinysoft.io.vn/webhooks/play-store, bật Enable authentication (chọn một service account, ví dụportal-play), Audience =https://portal.tinysoft.io.vn/webhooks/play-store. - VPS
.env:GOOGLE_PUBSUB_AUDIENCE=https://portal.tinysoft.io.vn/webhooks/play-store; giữGOOGLE_PLAY_VERIFY_PUSH_JWT=true(mặc định).up -d backend. - Play Console → app → Monetize → Monetization setup → Real-time developer notifications: Topic name =
projects/<project-id>/topics/play-rtdn→ Send test notification. Backend trả 202 cho thông báo test.
Áp dụng cho Portal v1.2.2