API reference
Google Play verification
/v1/google-play/verifyChecks a Google Play purchase token with the service account set on this API key (console → API keys → Edit → Google Play subscription check). The answer comes straight from Google; the gateway bills nothing and your app decides what to unlock. Answers are cached for one minute per token.
#Request parameters
purchase_tokenstringrequiredThe purchase token from Play Billing. In Flutter in_app_purchase it is purchaseDetails.verificationData.serverVerificationData.
subscribed is true for any real subscription of this app, including expired ones; active is true only while it may be used. Canceled subscriptions stay active until expiry_time because auto-renew was only turned off. in_trial is true while the current period is a free trial; expiry_time is then when the trial ends. Unknown tokens return subscribed false and state NOT_FOUND with status 200.
Setting up Google, calling it from a Flutter app and deciding what to unlock are walked through in the guide. Google Play subscriptions in your app →
Every call, including cached answers and failures, appears in Console → Request logs as a free “Google Play check” row on the key that made it, with the result, order ID and the last characters of the token. Search there by the full purchase token, its last characters or the order ID. These rows are left out of request counts.
#Related errors
- 400 invalid_requestThe body is not JSON or purchase_token is missing.
- 400 google_play_not_configuredThis API key has no package name and service account yet.
- 401Invalid or missing bearer token.
- 429Per-key limit on verify calls: 120 per minute by default, raised for a key by support. The key’s Google Play settings show its limit. Wait for Retry-After and keep the last answer.
- 502 google_play_api_disabledThe Google Play Android Developer API is not enabled in the service account’s Google Cloud project. Enable it and retry after a few minutes.
- 502 google_play_permission_deniedGoogle refused access: invite the service account in Play Console with permission to view financial data and manage orders and subscriptions. New permissions can take up to a day.
- 502 google_play_credentials_invalidGoogle rejected the stored service account key. Upload a new one on the key.
- 503 google_play_unavailableGoogle did not answer in time. Retry after a few seconds.
#Request example
curl https://www.aisplice.store/v1/google-play/verify \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"purchase_token": "PURCHASE_TOKEN_FROM_PLAY_BILLING"}'#Response
{
"package_name": "com.example.app",
"subscribed": true,
"active": true,
"in_trial": false,
"state": "SUBSCRIPTION_STATE_ACTIVE",
"product_id": "vip_monthly",
"expiry_time": 1793000000,
"auto_renewing": true,
"acknowledged": true,
"test_purchase": false,
"order_id": "GPA.3300-1111-2222-44444..2",
"checked_at": 1790400000
}Still stuck?
Send us the request ID or the error message and we will look into it.