Built on Play Billing v9. A purchase token is never trusted on-device: it is verified server-side, and consumable products are consumed (not just acknowledged) so a customer can buy them again. Unacknowledged purchases are auto-refunded by Google after three days. CashSDK acknowledges on your behalf the moment it verifies.
Google Play
Connect Google Play so Play Billing purchases and subscriptions are verified server-side and resolve to CashSDK entitlements.
Google Play Billing is the billing rail for in-app purchases and subscriptions on Android. CashSDK verifies every Play purchase token against the Google Play Developer API on your server, and ingests Real-time Developer Notifications (RTDN) for renewals, cancellations, and refunds, so Android entitlements are exactly as authoritative as iOS, and roll up into the same analytics.
How it works#
The Android SDK presents the offering and drives Play's native purchase flow, which returns a purchase token.
The SDK forwards the token to CashSDK, which calls the Play Developer API to confirm the purchase, then acknowledges or consumes it before granting an entitlement.
Google publishes Real-time Developer Notifications to a Pub/Sub topic for supported lifecycle events. CashSDK also polls voided purchases for refund and revocation coverage; do not rely on RTDN alone for every refund.
Prerequisites#
- A Google Play Console account with your app published to at least an internal testing track.
- Admin (or owner) access to the Play Console, so you can grant API access.
- A Google Cloud project where you can create a service account and enable the Play Developer API.
Google no longer requires linking the Cloud project under Play Console → Setup → API access. The Cloud project owns the service account and key; Play access is granted separately under Users and permissions.
Connect Google Play#
For the illustrated, one-step-at-a-time flow, open Quickstart → Android and follow the dashboard walkthrough.
CashSDK talks to Google with a service account that has access to your Play Developer account. This lets it verify purchase tokens and read subscription state.
In the Google Cloud console, create a service account and generate a JSON key. In APIs & Services, enable the Google Play Android Developer API for the project. You do not need to grant the service account a Google Cloud IAM role.
In the Play Console, go to Users and permissions → Invite new users and enter the service account's email. Leave Set access expiry date unticked.
On the App permissions tab (not Account permissions), click Add app and choose your app. In the permissions dialog:
- Under App access, tick View app information (read-only). It is required: Apply stays disabled until an App access box is ticked. View app quality information ticks itself.
- Under Financial data, tick View financial data and Manage orders and subscriptions.
Click Apply, then Invite user, then Send invite in the confirmation. When editing an existing user, click Apply, then Save changes. A new grant can take a few minutes to reach Google's API.
In your dashboard, open Quickstart → Android → Select your JSON key (or
Store Connect → Google Play), select the
service-account JSON, and enter your app's package name (for example
com.acme.app). In Quickstart, each input is a separate step; the key is
uploaded at Validate your Play connection. It is stored encrypted at rest
and never ships in your app.
CashSDK provisions a dedicated Pub/Sub topic for your app and shows its name in Quickstart → Android → Set the Play notification topic and Store Connect. Copy it into the Play Console under Monetization setup → Real-time developer notifications, paste the Topic name, and click Send test notification to confirm the link.
The CashSDK onboarding wizard and the MCP server can provision the Pub/Sub topic and validate the service account for you, so you only paste the topic name into the Play Console.
Create your products#
Under Monetization → Subscriptions (or In-app products), create each
product with a Product ID (for example pro_monthly) and define its
base plans and offers.
Create a matching product in CashSDK with the same identifier and attach the entitlement it unlocks. Or import the catalog automatically:
sync_catalog_from_app_store(store="play-store", dryRun=true)
Run it without dryRun to import your Play products as CashSDK products.
Integrate the SDK#
With the catalog mapped, the Android SDK handles offerings, purchase, verification, acknowledgement, and entitlements for you.
import com.cashsdk.CashSDK
CashSDK.configure(context = this, publishableKey = "csk_pk_…")
val entitlements = CashSDK.shared.purchase(activity, "pro_monthly")
val result = CashSDK.purchase(offering.monthly)
if (entitlements.isActive("pro")) unlockPro()
Test on a testing track#
In Play Console under Settings → License testing, add the Google accounts that should make test purchases. For the internal-track workflow, also add them as track testers, have them opt in, and install that build. Google also supports sideloading for license testers with the matching package name.
Configure the SDK with your csk_pk_… key, the same key you ship. Licence
testers can choose test payment instruments without real charges. Check that
checkout shows a test instrument; joining an internal track alone does not make
purchases free. Test renewals run on an accelerated clock.
Verify the purchase grants pro, then watch Events in your dashboard for
purchase.completed and, on renewal, subscription.renewed, driven by the
incoming RTDN.
A purchase must be verified before it is acknowledged within three days, or Google refunds it automatically. Letting the SDK verify (rather than acknowledging in your own app code) guarantees this happens. See Testing.
Go live#
Before you ship:
- The service account has financial data and order management access.
- RTDN is enabled with the CashSDK Pub/Sub topic, and the test notification arrived.
- Products are active on a production track.
The dashboard's setup checklist (get_setup_checklist) turns green when each of
these is satisfied.