Notification types Payloads

Overview

In this page you can better understand the payload that each of the OneTimeProductNotification, SubscriptionNotification and VoidedPurchaseNotification can retrieve and how to deal with them.


OneTimeProductNotification

The OneTimeProductNotification contains the following payload:

{
  "version": String,
  "notificationType": Int,
  "purchaseToken": String,
  "sku": String
}

The parameters in this payload are described as the following:

NameTypeDescription
versionStringVersion of the Payload received.
notificationTypeIntType of notification received for the Non-Consumable Product Purchase. Possible values can be seen here.
purchaseTokenStringPurchase Token of the Non-Consumable Purchase. This is a unique value and should be used to obtain more information about the Purchase.
skuStringThe SKU of the Product in the Purchase.

NotificationType

Possible values of the notificationType are the following:

ValueTitleDescription
1COMPLETEDInapp Purchase has been completed successfully.
2CANCELEDInapp Purchase has been canceled.

Processing the OneTimeProductNotification payload

When you receive a notification of the OneTimeProductNotification type, use the orderId parameter to obtain more information about the Purchase to which the Notification is related and then update your backend data with the information you have.

To obtain the Purchase data with orderId of a InApp type Product, use the following endpoint:

https://api.catappult.io/productv2/8.20241201/google/inapp/v3/applications/{packageName}/purchases/products/{sku}/tokens/{purchaseToken}

Which will retrieve the following data:

{
  "kind": String,
  "purchaseTimeMillis": String,
  "purchaseState": Int,
  "consumptionState": Int,
  "developerPayload": String,
  "orderId": String,
  "acknowledgementState": Int,
  "purchaseToken": String,
  "productId": String,
  "regionCode": String,
  "currency": String
}

The parameters in this payload are described as the following:

NameTypeDescription
kindStringType of purchase made.
purchaseTimeMillisStringPurchase time in millies.
purchaseStateIntState of the Purchase.
consumptionStateIntState of the consumption.
developerPayloadStringString based payload specified by the Developer when initiating this Purchase.
orderIdStringThe order UID (Unique Identifier) used internally in Aptoide.
acknowledgementStateIntState of the acknowledgment.
purchaseTokenStringPurchase Token of the Inapp Purchase.
productIdStringThe SKU of the Product in the Purchase.
regionCodeStringString value following the ISO-3166-1-A2 guidelines. Example: US
currencyStringThe price currency, as an ISO 4217 alphabetic code. Example: USD

consumptionState

ValueTitleDescription
0PendingPurchase is still not consumed.
1ConsumedPurchase has been consumed.

acknowledgementState

ValueTitleDescription
0PendingPurchase is still not acknowledged.
1AcknowledgedPurchase has been acknowledged.

SubscriptionNotification

The SubscriptionNotification contains the following payload:

{
  "version": String,
  "notificationType": Int,
  "purchaseToken": String,
  "subscriptionId": String
}

The parameters in this payload are described as the following:

NameTypeDescription
versionStringVersion of the Payload received.
notificationTypeIntType of notification received for a Subscription Purchase. Possible values can be seen here.
purchaseTokenStringPurchase Token of the Subscription Purchase. This is a unique value and should be used to obtain more information about the Purchase.
subscriptionIdStringThe SKU of the Product in the Purchase.

NotificationType

Possible values of the notificationType are the following:

ValueTitleDescription
1SUBSCRIPTION_RECOVEREDA subscription was successfully recovered from account hold.
2SUBSCRIPTION_RENEWEDAn active subscription was renewed successfully.
3SUBSCRIPTION_CANCELEDA subscription was canceled, either voluntarily by the user or involuntarily. For voluntary cancellations, this notification is sent when the user initiates the cancellation.
4SUBSCRIPTION_PURCHASEDA new subscription was purchased.
5SUBSCRIPTION_ON_HOLDA subscription has been placed on account hold (if this feature is enabled).
6SUBSCRIPTION_IN_GRACE_PERIODA subscription has entered the grace period due to issues such as payment failure (if this feature is enabled).
7SUBSCRIPTION_RESTARTEDA user has restored their subscription through AppCoins Wallet > Settings > Manage Subscriptions. The subscription had been canceled but was still within its validity period when restored.
12SUBSCRIPTION_REVOKEDThe subscription was revoked by the system before its expiration date.
13SUBSCRIPTION_EXPIREDThe subscription has reached its expiration date and was not renewed.

Processing the SubscriptionNotification payload

When you receive a notification of the SubscriptionNotification type, use the orderId parameter to obtain more information about the Purchase to which the Notification is related and then update your backend data with the information you have.

To obtain the Purchase data with orderId of a Subscription type Product, use the following endpoint:

https://api.catappult.io/productv2/8.20241201/google/inapp/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{purchaseToken}

Which will retrieve the following data:

{
  "kind": String,
  "startTimeMillis": String,
  "expiryTimeMillis": String,
  "autoRenewing": Boolean,
  "priceCurrencyCode": String,
  "priceAmountMicros": Long,
  "countryCode": String,
  "developerPayload": String,
  "paymentState": Int,
  "orderId": String,
  "acknowledgementState": Int
}

The parameters in this payload are described as the following:

NameTypeDescription
kindStringType of purchase made.
startTimeMillisStringStart time of the Subscription in millies.
expiryTimeMillisStringExpiry time of the Subscription in millies.
autoRenewingBooleanSpecifies if the subscription will renew automatically. If set to true, the subscription remains active and is scheduled to renew on the upcoming billing date. If set to false, the subscription has been canceled, and access to content will end on the next billing date unless the user opts to restore automatic renewal or completes a manual renewal.
priceCurrencyCodeStringThe price currency, as an ISO 4217 alphabetic code. Example: USD
priceAmountMicrosLongThe price in micro-units (millionths of the price currency). Example: 4990000 (for 4.99)
countryCodeStringString value following the ISO-3166-1-A2 guidelines. Example: US
developerPayloadStringString based payload specified by the Developer when initiating this Purchase.
paymentStateIntState of the Payment.
orderIdStringThe order UID (Unique Identifier) used internally in Aptoide.
acknowledgementStateIntState of the acknowledgment.

paymentState

ValueTitleDescription
0PendingPayment is still pending.
1ReceivedPayment has been received.

acknowledgementState

ValueTitleDescription
0PendingPurchase is still not acknowledged.
1AcknowledgedPurchase is not acknowledged.


VoidedPurchaseNotification

The VoidedPurchaseNotification contains the following payload:

{
  "purchaseToken": String,
  "orderId": String,
  "productType": Int,
  "refundType": Int
}

The parameters in this payload are described as the following:

NameTypeDescription
purchaseTokenStringPurchase Token of the Voided Purchase. This is a unique value and should be used to obtain more information about the Purchase.
orderIdStringThe order UID (Unique Identifier) used internally in Aptoide.
productTypeIntType of the SKU in the Purchase that has been Voided.
refundTypeIntType of notification received for the Voided Purchase. Possible values can be seen here .

productType

Possible values of the productType are the following:

ValueTitleDescription
1SUBSA type of SKU for subscriptions.
2INAPPA type of SKU for in-app products.

refundType

Possible values for the refundType are the following:

ValueTitleDescription
1REFUND_TYPE_FULL_REFUNDPurchase has been totally refunded.
2REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUNDPurchase has been partially refunded.

Processing the VoidedPurchaseNotification payload

When you receive a notification of the VoidedPurchaseNotification type, use the orderId parameter to obtain more information about the Purchase that got Voided to which the Notification is related and then update your backend data with the information you have.

To obtain more information regarding the Voided Purchase itself, follow our guide about In-App Voided Purchases Integration.


FAQ

How to obtain more information about the Purchase?

To obtain more information about the Purchase you can use the In-App Purchase Details documentation page which includes our endpoints from which you can request additional data.