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 AdjustAppStoreSubscription2dx
or AdjustPlayStoreSubscription2dx
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.
public: AdjustAppStoreSubscription2dx ( std ::string price, std ::string currency, std ::string transactionId, std ::string receipt)
Create an AdjustAppStoreSubscription2dx
object with the following properties:
Parameter Data type Description price
String The price of the subscription currency
String The currency of the subscription. Formatted as the currencyCode
of the priceLocale
object transactionId
String Your ID for the transaction receipt
String The receipt information
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx (
public: AdjustPlayStoreSubscription2dx ( std ::string price, std ::string currency, std ::string sku, std ::string orderId, std ::string signature, std ::string purchaseToken);
Create an AdjustPlayStoreSubscription2dx
object with the following properties:
Parameter Data type Description price
Number The price of the subscription currency
String The currency of the subscription sku
String The ID of the product orderId
String Your ID for the transaction signature
String The signature of the purchase data purchaseToken
String The unique token of the transaction. See Google’s documentation for more information
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx (
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.
void setTransactionDate ( std :: string transactionDate );
Call the setTransactionDate
method on your subscription object to record the timestamp of the subscription.
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx (
subscription. setTransactionDate (transactionDate);
void setPurchaseTime ( std :: string purchaseTime );
Call the setPurchaseTime
method on your subscription object to record the timestamp of the subscription.
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx (
subscription. setPurchaseTime (purchaseTime);
Record the purchase region (iOS only)
void setSalesRegion ( std :: string salesRegion );
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.
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx (
subscription. setSalesRegion (salesRegion);
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 ( std :: string key , std :: string value );
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx (
subscription. addCallbackParameter ( "key1" , "value1" );
subscription. addCallbackParameter ( "key2" , "value2" );
void addCallbackParameter ( std :: string key , std :: string value );
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx (
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 ( std :: string key , std :: string value );
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx (
subscription. addPartnerParameter ( "key1" , "value1" );
subscription. addPartnerParameter ( "key2" , "value2" );
void addPartnerParameter ( std :: string key , std :: string value );
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx (
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 ( AdjustAppStoreSubscription2dx subscription );
Pass your subscription object to the trackAppStoreSubscription
method to record the user’s subscription purchase.
AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx (
subscription. setTransactionDate (transactionDate);
subscription. setSalesRegion (salesRegion);
subscription. addCallbackParameter ( "key1" , "value1" );
subscription. addCallbackParameter ( "key2" , "value2" );
subscription. addPartnerParameter ( "key1" , "value1" );
subscription. addPartnerParameter ( "key2" , "value2" );
Adjust2dx :: trackAppStoreSubscription (subscription);
static void trackPlayStoreSubscription ( AdjustPlayStoreSubscription2dx subscription );
Pass your subscription object to the trackPlayStoreSubscription
method to record the user’s subscription purchase.
AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx (
subscription. setPurchaseTime (purchaseTime);
subscription. addCallbackParameter ( "key1" , "value1" );
subscription. addCallbackParameter ( "key2" , "value2" );
subscription. addPartnerParameter ( "key1" , "value1" );
subscription. addPartnerParameter ( "key2" , "value2" );
Adjust2dx :: trackPlayStoreSubscription (subscription);