adjust-icon

Send subscription information

You can record Play Store subscriptions and verify their validity with the Adjust SDK. After the user purchases a subscription, instantiate an AdjustPlayStoreSubscription object containing the details.

1. Instantiate a subscription object

Method signature
public AdjustPlayStoreSubscription(final long price,
final String currency,
final String sku,
final String orderId,
final String signature,
final String purchaseToken)

To get started, you need to instantiate a subscription object containing details of the subscription purchase. To do this, create a new AdjustPlayStoreSubscription object and pass the following arguments:

ParameterData typeDescription
pricelongThe 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

Record the purchase date

Method signature
public void setPurchaseTime(final long purchaseTime)

You can record the date on which the user purchased a subscription. The SDK returns this data for you to report on. Call the setPurchaseTime method with a timestamp to record this information.

Add callback parameters

Method signature
public void addCallbackParameter(String key, String value)

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.

Add partner parameters

Method signature
public void addPartnerParameter(String key, String value)

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.

2. Send subscription information

Method signature
public static void trackPlayStoreSubscription(final AdjustPlayStoreSubscription subscription)

Once you have set up your subscription object, you can send it to Adjust using the Adjust SDK. Pass your completed object to the trackPlayStoreSubscription method to record the user’s subscription purchase.