rtdn
Installation
SKILL.md
Real Time Developer Notifications (RTDN)
RTDN pushes subscription and purchase state changes from Google Play to your backend within seconds. Use it as the primary signal for entitlement updates; polling the Play Developer API on a schedule is a fallback, not a substitute.
Phase 1: Understand
Pin down the following before you write code:
- What triggers a notification. Google Play publishes a message to a Cloud Pub/Sub topic you own every time a subscription or one time product changes state (renewal, cancellation, refund, hold, pause, revocation, price change confirmation, etc.).
- What the notification contains. A
DeveloperNotificationJSON object withpackageName,eventTimeMillis, and exactly one ofsubscriptionNotification,oneTimeProductNotification,voidedPurchaseNotification, ortestNotification. It carries apurchaseTokenand a type code, not the full purchase state. - Who owns what. You own the Pub/Sub topic and subscription in your own Google Cloud project. Google Play only has publish rights.
- Delivery semantics. Cloud Pub/Sub guarantees at least once delivery and does not guarantee ordering. Duplicates and out of order messages are normal.
- The golden rule. RTDNs are signals, not sources of truth. For every notification, call
purchases.subscriptionsv2.getorpurchases.products.getand update entitlements from the API response, not the notification type.
Decide push vs pull: