You can record App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After a user purchases a subscription, you need to create a corresponding App Store or Play Store subscription table.
1. Instantiate a subscription table
To get started, create a subscription table containing the details of the purchase.
Set the transactionDate key in your App Store subscription table to the Unix timestamp (as a string) representing the purchase date.
1
-- App Store subscription
2
local adjust =require"plugin.adjust"
3
4
adjust.trackAppStoreSubscription({
5
-- price as string, for example "0.99" or "6.00"
6
price ="6.00",
7
currency ="EUR",
8
transactionId ="transaction-id",
9
transactionDate ="unix-timestamp-as-string"
10
})
Set the purchaseDate key in your Play Store subscription table to the Unix timestamp (as a string) representing the purchase date.
1
-- Play Store subscription
2
local adjust =require"plugin.adjust"
3
4
adjust.trackPlayStoreSubscription({
5
-- price as string in micros, for example "0.99" should be "990000"
6
price ="990000",
7
currency ="EUR",
8
sku ="product-sku",
9
orderId ="order-id",
10
signature ="signature",
11
purchaseToken ="purchase-token",
12
purchaseDate ="unix-timestamp-as-string"
13
})
Record the purchase region (iOS only)
You can record the region in which the user purchased a subscription. To do this, set the salesRegion method of your Apple App Store subscription map to the country code as a string. This needs to be formatted as the countryCode of the Storefront object.
1
-- App Store subscription
2
local adjust =require"plugin.adjust"
3
4
adjust.trackAppStoreSubscription({
5
-- price as string, for example "0.99" or "6.00"
6
price ="6.00",
7
currency ="EUR",
8
transactionId ="transaction-id",
9
salesRegion ="sales-region"
10
})
This field is optional and doesn’t need to be set.
Add callback parameters
You can add callback parameters to your subscription object. These parameters are appended to your callback URL when the SDK sends subscription information.
Add key-value pairs under the callbackParameters table in your subscription table:
-- price as string in micros, for example "0.99" should be "990000"
5
price ="990000",
6
currency ="EUR",
7
sku ="product-sku",
8
orderId ="order-id",
9
signature ="signature",
10
purchaseToken ="purchase-token",
11
callbackParameters = {
12
{
13
key ="key",
14
value ="value",
15
},
16
{
17
key ="foo",
18
value ="bar",
19
}
20
}
21
})
Add partner parameters
You can also add partner parameters to your subscription object. The SDK sends these parameters to Adjust’s servers when the user purchases a subscription, and Adjust forwards the information to your configured network partners.
Include key-value pairs under the partnerParameters table: