Bỏ qua để đến nội dung

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 PlayMonetization setup Pub/Sub topicplay-rtdn Push subscriptionJWT (audience) nginx/webhooks/ backend/webhooks/play-store publisher: google-play-developer-notifications@system.gserviceaccount.com
  1. Google Cloud Console → Pub/Sub → Topics → Create topic, ví dụ play-rtdn.
  2. Topic → Permissions → Add principal: google-play-developer-notifications@system.gserviceaccount.com, role Pub/Sub Publisher.
  3. 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.
  4. 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.
  5. 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