Your backend receives the Google Play purchase token from the app and forwards it to Frisbii Media for validation. Frisbii Media validates it server-to-server with Google and returns an inAppToken.
Add a Google Play purchase
/**
* @Route("/google/purchases/add", name="GooglePurchase", methods={"POST"})
*/
public function addGooglePurchase(Request $request): Response
{
$content = json_decode($request->getContent(), true);
// The app package name sent by the app as a request header
$appIdentifier = $request->headers->get('x-app-bundle');
// @see https://api.frisbii-media.com/#tag/App-Stores/operation/addGooglePlaystorePurchase
$response = json_decode($client->request('POST', '/appstores/google/purchases', [
'headers' => ['X-plenigo-token' => eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9],
'json' => [
'appIdentifier' => $appIdentifier,
'purchaseToken' => $content['purchaseToken'], // purchase token from Google Play Billing
'productId' => $content['productId'], // Google Play product/SKU ID
],
])->getBody()->getContents(), true);
// inAppToken identifies this purchase until it is associated with a customer
$inAppToken = $response['inAppToken'];
return new JsonResponse(['inAppToken' => $inAppToken]);
}
Verify an existing Google Play purchase
Google sends Real-time Developer Notifications (RTDN) via Pub/Sub to your backend for subscription events — renewals, cancellations, refunds, and so on. Forward each notification to Frisbii Media using the verify endpoint to keep the subscription state in sync.
/**
* @Route("/google/purchases/verify", name="GooglePurchaseVerify", methods={"POST"})
*/
public function verifyGooglePurchase(Request $request): Response
{
$content = json_decode($request->getContent(), true);
$appIdentifier = $request->headers->get('x-app-bundle');
// @see https://api.frisbii-media.com/#tag/App-Stores/operation/verifyGooglePlaystorePurchase
$response = json_decode($client->request('PUT', '/appstores/google/purchases/verify', [
'headers' => ['X-plenigo-token' => eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9],
'json' => [
'appIdentifier' => $appIdentifier,
'purchaseToken' => $content['purchaseToken'],
'productId' => $content['productId'],
],
])->getBody()->getContents(), true);
return new JsonResponse($response);
}
Tip: The verify endpoint is idempotent — passing the same purchase token more than once does not create a duplicate order.
Request payload reference
Field | Description |
|---|---|
| Your Google Play application package name (e.g. |
| The purchase token returned by Google Play Billing after a successful purchase |
| The product or SKU identifier as configured in Google Play Console |
Configuring Google Real-time Developer Notifications
To receive ongoing subscription lifecycle events from Google, you must configure RTDN in the Google Play Console:
Go to Google Play Console → Your app → Monetisation setup → Real-time developer notifications
Set the Pub/Sub topic to your backend's verify endpoint URL
Google will send a Pub/Sub message for every subscription event; decode the
datafield (base64) to get the notification payload
Pass the purchaseToken and productId from the decoded notification to the verify endpoint.