Member-only story
Play Store in-app purchase server verification for subscriptions
In this guide, we’ll walk you through how to verify a subscription on your server after an in-app purchase is completed in your Android app. We’ll be using TypeScript on a Node.js server, but the logic can be adapted to any backend framework.
Step 1: Setup Google Cloud Project & Play Console
First, create a Pub/Sub topic in your Google Cloud Project and register it in the Play Console to receive real-time notifications for subscription purchases or status changes. If you’re unfamiliar with this process, refer to this article first.
Save the service account key in your project folder.
Step 2: Store Product Information
Ensure that all product IDs from the Play Store, along with their associated prices, are saved in your database. This will help in verifying and processing the subscription details accurately.
Step 3: Setup the APIs
Create two POST API endpoints:/iap/play_store/verify_subs
: For verifying the initial subscription purchase./iap/play_store/subs_notifications
: To handle subscription status change notifications like renewals and cancellations from the Play Store.