You can record App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After the user purchases a subscription, create an AdjustAppStoreSubscription or AdjustPlayStoreSubscription instance containing the details.
1. Instantiate a subscription object
To get started, you need to create a subscription object containing details of the subscription purchase.
AdjustAppStoreSubscription ( String _price, String _currency, String _transactionId)
Create an AdjustAppStoreSubscription object with the following properties:
Parameter Data type Description priceStringThe price of the subscription currencyStringThe currency of the subscription. Formatted as the currencyCode of the priceLocale object transactionIdStringYour ID for the transaction
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
AdjustPlayStoreSubscription ( String _price, String _currency, String _sku, String _orderId, String _signature, String _purchaseToken)
Create an AdjustPlayStoreSubscription object with the following properties:
Parameter Data type Description priceStringThe price of the subscription in micro-units. See Google’s documentation for more information currencyStringThe currency of the subscription skuStringThe ID of the product orderIdStringYour ID for the transaction signatureStringThe signature of the purchase data purchaseTokenStringThe unique token of the transaction. See Google’s documentation for more information
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
Record the purchase date
You can record the date on which the user purchased a subscription. The SDK returns this data for you to report on.
Add the transactionDate property in the AdjustAppStoreSubscription class.
Set a timestamp to the transactionDate property of your subscription instance to record the date on which the user purchased a subscription.
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription.transactionDate = 'transactionDate' ;
Add the purchaseTime property in the AdjustPlayStoreSubscription class.
Set a timestamp to the purchaseTime property of your subscription instance to record the date on which the user purchased a subscription.
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
subscription.purchaseTime = 'purchase-time' ;
Record the purchase region (iOS only)
You can record the region in which the user purchased a subscription. To do this, call the setSalesRegion method on your subscription object and pass the country code as a String. This needs to be formatted as the countryCode of the Storefront object.
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription.salesRegion = 'sales-region' ;
Add callback parameters
You can add callback parameters to your subscription object. The SDK appends these parameters to your callback URL. To add callback parameters, call the addCallbackParameter method on your subscription object. You can add multiple callback parameters by calling this method multiple times.
void addCallbackParameter ( String key, String value)
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription. addCallbackParameter ( 'key1' , 'value1' );
subscription. addCallbackParameter ( 'key2' , 'value2' );
void addCallbackParameter ( String key, String value)
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
subscription. addCallbackParameter ( 'key1' , 'value1' );
subscription. addCallbackParameter ( 'key2' , 'value2' );
Add partner parameters
You can add partner parameters to your subscription object. The SDK sends these to Adjust’s servers when the user purchases a subscription. Adjust’s servers forward the information on to your network partner. To add partner parameters, call the addPartnerParameter method on your subscription object. You can add multiple partner parameters by calling this method multiple times.
void addPartnerParameter ( String key, String value)
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription. addPartnerParameter ( 'key1' , 'value1' );
subscription. addPartnerParameter ( 'key2' , 'value2' );
void addPartnerParameter ( String key, String value)
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
subscription. addPartnerParameter ( 'key1' , 'value1' );
subscription. addPartnerParameter ( 'key2' , 'value2' );
Once you have set up your subscription object, you can record it using the Adjust SDK.
static void trackAppStoreSubscription ( AdjustAppStoreSubscription subscription)
Pass your subscription object to the trackAppStoreSubscription method to record the user’s subscription purchase.
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription.transactionDate = 'transactionDate' ;
subscription.salesRegion = 'salesRegion' ;
subscription. addCallbackParameter ( 'key1' , 'value1' );
subscription. addCallbackParameter ( 'key2' , 'value2' );
subscription. addPartnerParameter ( 'key1' , 'value1' );
subscription. addPartnerParameter ( 'key2' , 'value2' );
Adjust . trackAppStoreSubscription (subscription);
static void trackPlayStoreSubscription ( AdjustPlayStoreSubscription subscription)
Pass your subscription object to the trackPlayStoreSubscription method to record the user’s subscription purchase.
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
subscription.purchaseTime = 'purchase-time' ;
subscription. addCallbackParameter ( 'key1' , 'value1' );
subscription. addCallbackParameter ( 'key2' , 'value2' );
subscription. addPartnerParameter ( 'key1' , 'value1' );
subscription. addPartnerParameter ( 'key2' , 'value2' );
Adjust . trackPlayStoreSubscription (subscription);