Use this endpoint to register a purchase made via Google Play Billing to initiate an asynchronous synchronization process. This process involves verifying the purchase with Google Play and updating the user's entitlement status in Cleeng's system.
Due to the time required for Google's verification, this operation is asynchronous. Upon successful registration, the API will return a 202 Accepted status with a unique synchronizationId in the response body.
You can then use the following methods to check the status of the synchronization process:
- Polling: Use the /purchases/synchronizations/{synchronizationId} endpoint to periodically retrieve the status. This endpoint provides a concise response with the essential status information.
- Webhooks: Subscribe to the inappPurchaseSyncResult webhook to receive real-time updates on the synchronization status. The webhook payload (WebhookSynchronizationStatus) includes detailed information about the synchronization, including the synchronizationId, purchase details (purchaseToken, packageName, cleengCustomerId), accessGranted, offerId, and result.
You can choose to use either the polling mechanism, the webhook, or both, depending on your needs.
The cleengCustomerId is used to identify the user in Cleeng's system and associate the purchase with their account.
Important: Requests to this endpoint are idempotent by purchaseToken. If a duplicate request is detected - whether a synchronization is already in progress or was already completed for the given purchaseToken - a 409 Conflict error will be returned containing the existing synchronizationId.
The productType field determines which Google Play API is used to verify the purchase:
-subscription - uses purchases.subscriptionsv2.get
Scope: Only subscription is supported. One-time products are not supported - requests with any other productType are rejected with 400.
Please note that this endpoint can be authorized with a publisher (X-Publisher-Token) or JWT (Bearer) token. Depending on how you integrate with Cleeng (directly or through middleware), use either a JWT or X-Publisher-Token header authorization.
Please use JWT (Bearer) token to try out the endpoint in the API console in this documentation.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Errors
| HTTP Status Code | Error Code | Message |
|---|---|---|
| 400 | REQ0001 | Invalid request body |
| 400 | GPLAY0004 | Provided product type is not supported |
| 409 | GPLAY0300 | Synchronization already in progress |
| 422 | GPLAY0200 | No Google Play Billing configuration profile found for the provided packageName |
| 500 | SXXXX (X - number) | Internal server error |

