To send payments to MyTracker, use the following methods:
customRevenue and customRevenueBatch for custom revenue
googlePlayProductTransaction, googlePlaySubscriptionTransaction, and googlePlaySubscriptionToken for Google Play in-app payments and subscriptions
appStoreProductTransaction, appStoreSubscriptionTransaction, and appStoreSubscriptionReceipt
for App Store in-app payments and subscriptions
Uploaded data will be added to the project data and will appear in MyTracker reports within 4 hours
Google Play payments
MyTracker can track in-app payments and subscriptions automatically (see the Revenue tracking section).
But if the automatic tracking is not enough,
or there are problems,
you can upload payments using the S2S API.
Let's consider some examples of using S2S API methods:
Example 1 — Import historical data on in-app payments
When MyTracker has no data on in-app payments, for example,
made before MyTracker SDK integration, use the method googlePlayProductTransaction.
Example 2 — Import historical data on subscriptions
When MyTracker has no data on subscriptions, for example,
made before the MyTracker SDK integration:
If you retransmitted data or loaded previously tracked transactions,
there will be no error because MyTracker removes duplicates
googlePlayProductTransaction
Use the googlePlayProductTransaction
method to send Google Play in-app payments.
To verify a payment, use one of the following parameters:
token — MyTracker will send an in-app payments confirmation request to the Google Play API.
If the payment is valid, MyTracker will classify it as a verified payment;
if not, the payment will be saved as unverified.
isVerified — MyTracker classifies the in-app payment as a verified by default.
If you pass neither token nor isVerified, or pass both parameters at once, the request will not be processed.
Import historical data on in-app payments in chronological order,
otherwise, the information on the first payments will be distorted.
Required parameter: a user identifier customUserId and/or one of the device identifiers: instanceId, gaid, androidId, appSetId (transactions will be related to the user and/or the device), eventTimestamp, as well as parameters from the table below.
Name
Description
Type
Example
orderId*
Transaction identifier
String
"orderId": "1234-1234-1234-12345"
productId*
The product identifier in terms of Google Play (SKU)
String
"productId": "com.some.thing.inapp1"
token
The token provided to the user's device when the product was paid.
Can be passed instead of the isVerified parameter.
String
"token": "ofjkingojelmkmedpgfkfelj"
currency*
Payment currency
String
"currency": "USD"
revenue*
Payment amount in the specified currency
String
"revenue": "4.9"
isVerified
The flag for determining the verification status.
Can be passed instead of the token parameter.
Integer
"isVerified": 1
* — required parameter.
googlePlaySubscriptionTransaction
Use the googlePlaySubscriptionTransaction
method to send Google Play subscription payments.
Import historical data on subscriptions in chronological order,
otherwise, the information on the first payments will be distorted.
Required parameters: a user identifier customUserId and/or one of the device identifiers: instanceId, gaid, androidId, appSetId (transactions will be related to the user and/or the device), eventTimestamp, as well as parameters from the table below.
Name
Description
Type
Example
orderId*
Transaction identifier
String
"orderId": "1234-1234-1234-12345"
priceCurrencyCode*
Payment currency
String
"priceCurrencyCode": "USD"
priceAmountMicros*
Price of the subscription expressed in micro-units,
where 1,000,000 micro-units represents one unit of the currency.
For example, if the subscription price is €1.99, priceAmountMicros is 1990000.
Integer
"priceAmountMicros": "1990000"
subscriptionId*
The subscription identifier in terms of Google Play
String
"subscriptionId": "com.some.thing.monthly001"
paymentState
The payment state of the subscription:
1 — received
2 — trial
Default value: 1
String
"paymentState": "1"
isIntroductory
Introductory price information of the subscription:
0 — regular price
1 — introductory price
Default value: 0
Integer
"isIntroductory": 1
startTimeMillis
Time at which the subscription was granted, in milliseconds
Integer
"startTimeMillis": 1693242344000
expiryTimeMillis
Time at which the subscription will expire (after this transaction), in milliseconds
Integer
"expiryTimeMillis": 1693242344000
* — required parameter.
googlePlaySubscriptionToken
Use the googlePlaySubscriptionToken method
to send information about an active subscription.
Based on the passed subscription ID,
MyTracker will detect the latest renewal
and track future renewals automatically.
All future subscription payments will be related to
the device and user that you specify in the method
We recommend you pass the subscriptionPeriod parameter.
With this parameter, MyTracker will be able to calculate the time of the latest renewal,
and in the future, will be able to time renewals even if Google Play delays data.
Without subscriptionPeriod, the latest renewal and all further renewals
will be logged at the moment of data receipt from Google Play.
Required parameter: a user identifier customUserId and/or one of the device identifiers: instanceId, gaid, androidId, appSetId (transactions will be related to the user and/or the device), as well as parameters from the table below.
Name
Description
Type
Example
orderId*
Transaction identifier
String
"orderId": "GPA.1234-1234-1234-12345"
subscriptionId*
The subscription identifier in terms of Google Play
String
"subscriptionId": "com.some.thing.monthly001"
token*
The token provided to the user's device when the subscription was paid
String
"token": "ofjkingojelmkmedpgfkfelj"
subscriptionPeriod
Subscription period in ISO 8601 format, for example:
P1W — one week
P1M — one month
P3M — three months
P6M — six months
P1Y — one year
String
"subscriptionPeriod": "P6M"
* — required parameter.
App Store payments
MyTracker can track in-app payments and subscriptions automatically
(see the Revenue tracking section).
But if the automatic tracking is not enough, or there are problems,
you can upload payments using the S2S API.
Let's consider some examples of using S2S API methods:
Example 1 — Import historical data on in-app payments
When MyTracker has no data on in-app payments, for example, made before MyTracker SDK integration, use the method appStoreProductTransaction.
Example 2 — Import historical data on subscriptions
When MyTracker has no data on subscriptions, for example,
made before the MyTracker SDK integration:
If MyTracker does not track a subscription automatically,
for example, subscription made before the MyTracker SDK integration, import
subscription data using appStoreSubscriptionReceipt.
Example 4 — Import data after configuring a verification
If you took a while to add the verification key to MyTracker,
and as a consequence, missed some of the renewals:
Required parameters: a user identifier customUserId and/or one of the device identifiers: instanceId, idfa, iosVendorId (transactions will be related to the user and/or the device), eventTimestamp, as well as parameters from the table below.
Required parameters: a user identifier customUserId and/or one of the device identifiers: instanceId, idfa, iosVendorId (transactions will be related to the user and/or the device), eventTimestamp, as well as parameters from the table below.
Original transaction identifier
(the first transaction in the subscription).
String
"transactionIdOriginal": "1234567890098765"
isTrial
Trial subscription:
0 — no
1 — yes
Default value: 0
Integer
"isTrial": 1
isIntroductory
Introductory price information of the subscription:
0 — regular price
1 — introductory price
Default value: 0
Integer
"isIntroductory": 1
tsPaymentOriginal
Time at which the subscription was granted
Integer
"tsPaymentOriginal": 1643453453
tsPaymentExpires
Time at which the subscription will expire (after this transaction)
Integer
"tsPaymentExpires": 1643453453
quantity
The number of products purchased
Default value: 1
Integer
"quantity": 1
* — required parameter.
appStoreSubscriptionReceipt
The appStoreSubscriptionReceipt method is in beta testing.
If you have any questions, please contact our
support team
Use the appStoreSubscriptionReceipt method
to send information about an active subscription.
Based on the passed receipt, MyTracker will send a request to the App Store API,
get historical subscription transactions and track future renewals automatically.
All transactions from the receipt
will be related to the device or/and user that you specify in the method
Required parameters: a user identifier customUserId and/or one of the device identifiers: instanceId, idfa, iosVendorId (transactions will be related to the user and/or the device), as well as parameters from the table below.
Custom revenue involves other payment transactions
that cannot be sent as ads revenue, in-app payments, or subscriptions.
For example, it may be offline purchases, payments from WeChat or AppGallery.
In other words, it is any revenue for which
there is not yet another mechanism for collecting data.
You can send custom revenue only via S2S API,
using customRevenue and customRevenueBatch methods.
customRevenue
Use the customRevenue method to send data on a custom payment.
It may be any payment that could not pass to MyTracker as ad revenue,
an in-app payment, or a subscription. Like an offline purchase or a payment via WeChat Pay.
For details, please refer to the
Revenue tracking section.
Required parameters: a user identifier customUserId and/or one of the device identifiers instanceId, lvid, gaid, androidId, idfa, iosVendorId (transactions will be related to the user and/or the device), eventTimestamp, as well as parameters from the table below.
One parameter without a name.
It's an array,
through which you can pass parameters from the customRevenue method.
If validation rules are broken in at least one set of parameters,
the server will return the error