Skip to content

Test Google Play purchases

Documents @snap4id-sdk/app-embed 1.0.0 · @snap4id-sdk/purchase-verifier 1.0.0

Play Billing needs a build installed from Google Play (a testing track) and a Google account the Play Console treats as a tester. Emulators with the Play Store work for flows; check kill-after-pay on a phone.

  1. Product. Play Console → Monetize → In-app products: a consumable with your product id, activated.
  2. Track. Upload a release build (an .aab signed with your upload key) to internal testing and add your testers’ accounts to the track; testers install it from the opt-in link. Expo: expo prebuild, then ./gradlew :app:bundleRelease in android/; the SDK’s examples/partner-app/README.md (“Google Play internal testing”) shows the full commands.
  3. License testers. Settings → License testing: add the same accounts. Their purchases use test payment methods (“Test card, always approves”, “…declines”, “Slow test card” for a pending purchase) and are never charged.
  4. Licensing key. Monetization setup → Licensing: the base64 RSA public key; Snap4ID (when it checks purchases) or your backend needs it to check receipts.

License-tester purchases are sandbox receipts. Production accepts them only while your sandbox window is open (ask Snap4ID; with your backend it is your own allowed_environments / sandbox_in_prod_until). A purchase in the wrong environment fails with environment_not_allowed.

  • The purchase is made with obfuscatedProfileId = the page’s paymentRef (else binding_mismatch).
  • “Slow test card” gives a pending purchase: it must survive an app restart and unlock when it completes.
  • Kill the app right after paying and reopen it: the photo arrives, and the purchase is consumed only then.