JavaScript Bridge
Google In-App Purchase Bridge
Start a Google Play Billing purchase and receive a purchase token for server verification.
Before you start
- Products created in Google Play Console
- App installed from a Play testing or production track
- Backend purchase-token verification
Configure and verify
Choose the product
Use the exact Play Console product ID and specify inapp or subscription through the supported product_type values.
Start the purchase
Call webtoapp.googleIap(options) or send google_iap_init.
Receive the result
Handle webtoapp:google-iap or webtoapp.onmessage. Successful responses include purchase details and token data.
Verify server-side
The app acknowledges non-consumables and subscriptions or consumes consumables after Google Play confirms the purchase. Still send the purchase token and product ID to your backend, verify with the Google Play Developer API, and only then grant durable entitlement.
Example
webtoapp.googleIap({
product_id: "premium_monthly",
product_type: "subscription",
app_account_token: "550e8400-e29b-41d4-a716-446655440000"
});Testing requirement
Test before release
- Product exists and is active
- Test account is licensed
- Result is verified server-side
- Acknowledgement or consumption is handled