Register Google Play purchase

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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Errors

HTTP Status CodeError CodeMessage
400REQ0001Invalid request body
400GPLAY0004Provided product type is not supported
409GPLAY0300Synchronization already in progress
422GPLAY0200No Google Play Billing configuration profile found for the provided packageName
500SXXXX (X - number)Internal server error

Body Params
int32
required

Cleeng's unique identifier for the customer who made the purchase.

string
required

Google Play's unique purchase token for the purchase. This token is used to verify the purchase with Google Play and track its status in Cleeng's system.

string
required

Android application package name (e.g., com.example.app). Used to identify the correct configuration profile for this publisher.

string
required

The type of Google Play product being purchased. Only subscription is supported; one-time products are not supported (400 is returned for any other value).

string

IP address of the customer who made the purchase. This information will be stored in the user's profile as the IP address of their latest activity. Accepted: IPv4, IPv6.

The parameter is required in backend intergrations (with middleware) to ensure the correct customer IP address (address of their latest activity) is stored

Headers
string

Can be used only within server-to-server integrations. Either a JWT or X-Publisher-Token header authorization is required, depending on how you integrate with Cleeng.

string

Correlation ID for the request, which is used to link the initial purchase registration or transfer request with the subsequent synchronization process. This ID is not used as the synchronizationId but is included in the response for tracking and correlation purposes.

It is recommended to provide a Correlation-Id for easier tracking of requests, especially if you need to correlate the purchase registration with other events or processes in your system. Ensure that the Correlation-Id is unique within the context of your specific client integration to avoid conflicts.

string

Version of the publisher's application making the API request.
This header helps you track which versions of the publisher's app are being used and how they interact with Cleeng API. It can be valuable in identifying compatibility issues, understanding the impact of app updates on API usage, and providing support for different app versions.

string

Unique identifier for the device making the request (if applicable).
This header is useful for tracking requests at the device level, especially in mobile app integrations. It can help you identify issues related to specific devices, analyze user behavior across devices, and gather insights into device-specific usage patterns.

string

Specifies the type of device the request is coming from.
This header provides additional context about the device making the request, beyond just its unique ID. It helps you categorize devices (e.g., "Pixel 8", "Samsung Galaxy S24", "Android TV") and identify potential issues or trends related to specific device types.

This information can be particularly useful for debugging, as it allows you to narrow down issues that may be specific to certain device models or types. It also helps in understanding user behavior and preferences across different device categories. Example: Android TV.

string

Specifies the action performed by the user in the publisher's application.
This header provides additional context about the user's actions within the app, such as "Purchase", "Restore Purchase", "Updating Plan", "Content Access", etc. It helps you understand user behavior, track specific actions that trigger API requests, and analyze usage patterns based on user actions.

By capturing user actions in the app, you can gain insights into user engagement, preferences, and interactions with your API. This information can be valuable for optimizing the user experience, tailoring content recommendations, and improving app performance.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json