Created
November 26, 2022 23:31
-
-
Save Masterxilo/492c5c169ef6be54f43fc5e8a9a01232 to your computer and use it in GitHub Desktop.
Typescript @types for Google Play Billing/Google Play Developer Console Real-time developer notifications rtdn (Cloud Pub Sub Messages) https://developer.android.com/google/play/billing/rtdn-reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// couldn't find this anywhere, so here you go | |
// it's ugly, you can clean it up | |
/** https://developer.android.com/google/play/billing/rtdn-reference */ | |
// TODO no one made typescript @types package for these? | |
interface CloudPubSubPublishMessage { | |
subscription: string; | |
message: pubsub_v1.Schema$PubsubMessage; | |
} | |
interface DeveloperNotification { | |
"version": string, | |
"packageName": string, | |
"eventTimeMillis": number, | |
"oneTimeProductNotification": OneTimeProductNotification, | |
"subscriptionNotification": SubscriptionNotification, | |
"testNotification": TestNotification | |
} | |
/** The type of notification. It can have the following values: */ | |
enum OneTimeProductNotification$NotificationType { | |
ONE_TIME_PRODUCT_PURCHASED = 1, // (1) ONE_TIME_PRODUCT_PURCHASED - A one-time product was successfully purchased by a user. | |
ONE_TIME_PRODUCT_CANCELED = 2, // (2) ONE_TIME_PRODUCT_CANCELED - A pending one-time product purchase has been canceled by the user. | |
} | |
interface OneTimeProductNotification { | |
"version": string, | |
"notificationType": OneTimeProductNotification$NotificationType, | |
"purchaseToken": string, | |
"sku": string | |
} | |
/**The notificationType for a subscription can have the following values:*/ | |
enum SubscriptionNotification$NotificationType { | |
SUBSCRIPTION_RECOVERED = 1, // (1) SUBSCRIPTION_RECOVERED - A subscription was recovered from account hold. | |
SUBSCRIPTION_RENEWED = 2, // (2) SUBSCRIPTION_RENEWED - An active subscription was renewed. | |
SUBSCRIPTION_CANCELED = 3, // (3) SUBSCRIPTION_CANCELED - A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation, sent when the user cancels. | |
SUBSCRIPTION_PURCHASED = 4, // (4) SUBSCRIPTION_PURCHASED - A new subscription was purchased. | |
SUBSCRIPTION_ON_HOLD = 5, // (5) SUBSCRIPTION_ON_HOLD - A subscription has entered account hold (if enabled). | |
SUBSCRIPTION_IN_GRACE_PERIOD = 6, // (6) SUBSCRIPTION_IN_GRACE_PERIOD - A subscription has entered grace period (if enabled). | |
SUBSCRIPTION_RESTARTED = 7, // (7) SUBSCRIPTION_RESTARTED - User has restored their subscription from Play > Account > Subscriptions. The subscription was canceled but had not expired yet when the user restores. For more information, see [Restorations](/google/play/billing/subscriptions#restore). | |
SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8, // (8) SUBSCRIPTION_PRICE_CHANGE_CONFIRMED - A subscription price change has successfully been confirmed by the user. | |
SUBSCRIPTION_DEFERRED = 9, // (9) SUBSCRIPTION_DEFERRED - A subscription's recurrence time has been extended. | |
SUBSCRIPTION_PAUSED = 10, // (10) SUBSCRIPTION_PAUSED - A subscription has been paused. | |
SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11, // (11) SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED - A subscription pause schedule has been changed. | |
SUBSCRIPTION_REVOKED = 12, // (12) SUBSCRIPTION_REVOKED - A subscription has been revoked from the user before the expiration time. | |
SUBSCRIPTION_EXPIRED = 13, // (13) SUBSCRIPTION_EXPIRED - A subscription has expired. | |
} | |
interface SubscriptionNotification { | |
"version": string, | |
"notificationType": SubscriptionNotification$NotificationType, | |
"purchaseToken": string, | |
"subscriptionId": string | |
} | |
interface TestNotification { | |
"version": string | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage in node.js with express: