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.
public 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 (
public 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 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
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
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.
public string TransactionDate { get; set; }
Set the setTransactionDate property of your AdjustAppStoreSubscription instance to record the timestamp of the subscription.
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription.TransactionDate = transactionDate;
public string PurchaseTime { get; set; }
Set the PurchaseTime property of your AdjustPlayStoreSubscription instance to record the timestamp of the subscription.
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
subscription.PurchaseTime = purchaseTime;
Record the purchase region (iOS only)
public string SalesRegion { get; set; }
You can record the region in which the user purchased a subscription. To do this, set the SalesRegion property of your AdjustPlayStoreSubscription instance to the country code as a string. This needs to be formatted as the countryCode of the Storefront object.
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription.SalesRegiom = 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.
public void AddCallbackParameter ( string key , string value );
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription. AddCallbackParameter ( "key1" , "value1" );
subscription. AddCallbackParameter ( "key2" , "value2" );
public 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.
public void AddPartnerParameter ( string key , string value );
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription. AddPartnerParameter ( "key1" , "value1" );
subscription. AddPartnerParameter ( "key2" , "value2" );
public 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.
public static void TrackAppStoreSubscription ( AdjustAppStoreSubscription subscription );
Pass your subscription object to the Adjust.TrackAppStoreSubscription method to record the user’s subscription purchase.
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription (
subscription.TransactionDate = transactionDate;
subscription.AalesRegion = salesRegion;
subscription. AddCallbackParameter ( "key1" , "value1" );
subscription. AddCallbackParameter ( "key2" , "value2" );
subscription. AddPartnerParameter ( "key1" , "value1" );
subscription. AddPartnerParameter ( "key2" , "value2" );
Adjust. TrackAppStoreSubscription (subscription);
public static void TrackPlayStoreSubscription ( AdjustPlayStoreSubscription subscription );
Pass your subscription object to the Adjust.TrackPlayStoreSubscription method to record the user’s subscription purchase.
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription (
subscription.PurchaseTime = purchaseTime;
subscription. AddCallbackParameter ( "key1" , "value1" );
subscription. AddCallbackParameter ( "key2" , "value2" );
subscription. AddPartnerParameter ( "key1" , "value1" );
subscription. AddPartnerParameter ( "key2" , "value2" );
Adjust. TrackPlayStoreSubscription (subscription);