Webhooks - In-App Purchase Topics

Cleeng Webhooks

Webhooks are notifications that Cleeng sends out to subscribed broadcasters about certain events occurring in the platform. The events are sent in the form of a POST request made to specified endpoints with a JSON payload as its body.

The body of the request consists of three constant fields:

broadcasterId – the ID of the broadcaster that the webhook is sent for,
topic – the name of the topic that the webhook is sent about,
data – topic-specific payload about the event.

Available In-App Purchase Topics

The following webhook topics are used for in-app purchases:

To find out more about validation of in-app purchases, visit Webhooks - In-App Purchase Validation section.

inappPurchaseValidationSucceeded

Trigger:

The event is triggered when an in-app purchase validation is successful and ends with one of the success results: SubscriptionSynchronized, SubscriptionRevived, SubscriptionTransferred, SubscriptionCreated.

{
    "broadcasterId": 123456789,
    "topic": "inappPurchaseValidationSucceeded",
    "data": {
        "result": "SubscriptionSynchronized",
        "paymentGateway": "amazon",
        "offerId": "S123123123_US",
        "inAppSpecificData": {
            "receiptUserId": "receipt-user-id",
            "receiptId": "receipt-id"
        },
        "offerType": "subscription",
        "subscriptionId": 123456789,
        "active": true,
        "inTrial": false,
        "expirationDate": "2030-01-01T00:00:00+01:00",
        "customerId": 987654321
    }
}

Fields:

  • result - one of: SubscriptionSynchronized, SubscriptionRevived, SubscriptionTransferred, SubscriptionCreated
  • inAppSpecificData - it will differ depending on the gateway - for details see the In-App Specific Data section below
  • prevSubscriptionId - only present in case of subscription transfer
  • prevCustomerId - only present in case of subscription transfer

inappPurchaseValidationFailed

Trigger:
The event is triggered when an in-app purchase validation results in failure.

{
    "broadcasterId": 123456789,
    "topic": "inappPurchaseValidationFailed",
    "data": {
        "paymentGateway": "amazon",
        "offerId": "S123123123_US",
        "inAppSpecificData": {
            "receiptUserId": "receipt-user-id",
            "receiptId": "receipt-id"
        },
        "customerId": 987654321,
        "reason": "why it failed"
    }
}

inAppSpecificData will differ depending on the gateway - for details see the In-App Specific Data section below.

In-App Specific Data

inAppSpecificData for each of the webhook topics above will differ depending on the gateway:

Apple iOS & tvOS

        "inAppSpecificData": {
            "originalTransactionId": "<originalTransactionId>,
            "transactionId": "<transactionId>"
        }

Android

        "inAppSpecificData": {
            "purchaseToken": "<purchaseToken>”
        }

Amazon FireTV

        "inAppSpecificData": {
            "receiptId": "<receiptId>,
            "receiptUserId": "<receiptUserId>"
        }