登录

Import payments

Methods

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:

  1. Import historical data using googlePlaySubscriptionTransaction
  2. Enable tracking of future renewals using googlePlaySubscriptionToken

Example 3 — Track active subscriptions

If MyTracker does not track a subscription automatically (for example, subscription made before the MyTracker SDK integration):

  1. Import historical data using googlePlaySubscriptionTransaction
  2. Enable renewals tracking using googlePlaySubscriptionToken

Example 4 — Import data after configuring a verification

If you took a while to add the verification key to MyTracker, and as a consequence, did not verify the first payments:

  1. Ensure you add Google Play credentials to MyTracker.
  2. Import lacking in-app payments data using googlePlayProductTransaction
  3. Import lacking subscription data using googlePlaySubscriptionTransaction
  4. Enable subscription tracking using googlePlaySubscriptionToken

Example 5 — Import data after tracking failure

When MyTracker has no data on in-app payments and subscriptions due to a failed update to the app and a broken tracking setting:

  1. Import lacking in-app payments data using googlePlayProductTransaction
  2. Import lacking subscription data using googlePlaySubscriptionTransaction
  3. Enable subscription tracking using googlePlaySubscriptionToken

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.

Request format:

https://tracker-s2s.my.com/v1/googlePlayProductTransaction/?idApp=XXX

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.

Request format:

https://tracker-s2s.my.com/v1/googlePlaySubscriptionTransaction/?idApp=XXX

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.

Request format:

https://tracker-s2s.my.com/v1/googlePlaySubscriptionToken/?idApp=XXX

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:

  1. Import historical data using appStoreSubscriptionTransaction.
  2. Send the receipt for the active subscriptions using appStoreSubscriptionReceipt.

Example 3 — Track active subscriptions

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:

  1. Ensure you add App Store credentials to MyTracker.
  2. Import lacking subscription data using appStoreSubscriptionTransaction.
  3. Enable subscription tracking using appStoreSubscriptionReceipt.

Example 5 — Import data after tracking failure

When MyTracker has no data on in-app payments and subscriptions due to a failed update to the app and a broken tracking setting:

  1. Import lacking in-app payments data using appStoreProductTransaction.
  2. Import lacking subscription data using appStoreSubscriptionTransaction.
  3. Enable subscription tracking using appStoreSubscriptionReceipt.

If you retransmitted data or loaded previously tracked transactions, there will be no error because MyTracker removes duplicates

appStoreProductTransaction

The appStoreProductTransaction method is in beta testing. If you have any questions, please contact our support team

Use the appStoreProductTransaction method to send App Store in-app payments. All uploaded payments will be saved in MyTracker as verified.

Import historical data on in-app payments in chronological order, otherwise, the information on the first payments will be distorted.

Request format:

https://tracker-s2s.my.com/v1/appStoreProductTransaction/?idApp=XXX

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.

Name Description Type Example
transactionId* Transaction identifier String "transactionId": "1234567890098765"
productId* The product identifier in terms of App Store.
See the Apple documentation
String "productId": "com.some.thing.inapp1"
price* Price of the product Float "price": "1.99"
currency* Payment currency String "currency": "USD"
quantity The number of products purchased
Default value: 1
Integer "quantity": 1

* — required parameter.

appStoreSubscriptionTransaction

The appStoreSubscriptionTransaction method is in beta testing. If you have any questions, please contact our support team

Use the appStoreSubscriptionTransaction method to send App Store subscription transactions.

Import historical data on subscriptions in chronological order, otherwise, the information on the first payments will be distorted.

Request format:

https://tracker-s2s.my.com/v1/appStoreSubscriptionTransaction/?idApp=XXX

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.

Name Description Type Example
transactionId* Transaction identifier String "transactionId": "1234567890098765"
productId* The product identifier in terms of App Store.
See the Apple documentation
String "productId": "com.some.thing.monthly001"
price* Price of the product Float "price": "1.99"
currency* Payment currency String "currency": "USD"
transactionIdOriginal* 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

Request format:

https://tracker-s2s.my.com/v1/appStoreSubscriptionReceipt/?idApp=XXX

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.

Name Description Type Example
transactionId* Transaction identifier String "transactionId": "1234567890098765"
productId* The product identifier in terms of App Store.
See the Apple documentation
String "productId": "com.abc.def"
receipt* Payment receipt in base64 format String "receipt": "aaabbcbcac=="
price* Price of the product Float "price": "9.99"
currency* Payment currency String "currency": "USD"

* — required parameter.

Custom revenue

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.

Request format:

https://tracker-s2s.my.com/v1/customRevenue/?idApp=XXX

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.

Name Description Type Example
idTransaction* Transaction identifier unique in the project String, minimum length 1, maximum length 255 "idTransaction": "order1234"
currency* The numeric code assigned to a currency by ISO 4217 String, length 3 symbols "currency": "USD"
total* Amount of payment Nonintegral, minimum value 0 "total": 1.99

* — required parameter.

customRevenueBatch

Use the customRevenueBatch method to send batch data. This method is similar to customRevenue but allows you to send more than one payment.

Request format:

https://tracker-s2s.my.com/v1/customRevenueBatch/?idApp=XXX

Required parameters:

Name Description Type Example
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
Array. Maximum size 20 [
{"customUserId": "1111", "lvid":"00000000000000000000000000000000", "idTransaction": "order1", "currency":"USD", "total": 1.99},
{"customUserId": "2222", "lvid":"00000000000000000000000000000000", "idTransaction": "order2", "currency":"USD", "total": 10.99}
]

Parameters

All parameters are passed in the request body in JSON format.

Limit on the maximum size of imported data — 10Kb.

Name Description Type Example

Common

eventTimestamp Event time Number, minimum value 946674000, maximum value 4294967295. By default, timestamp of receiving the event "eventTimestamp":"1577191920"
customUserId User identifier String, maximum size 1024 "customUserId":"1234"
ipv4 ipv4 address String, maximum size 15 "ipv4":"125.125.125.125"
ipv6 ipv6 address String, maximum size 45 "ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
idGender Gender Number, possible values:
  • 0 — unknown
  • 1 — man
  • 2 — woman
"idGender":"1"
age Age Number, maximum value 128 "age":"38"
connectionType Connection type Number, possible values:
  • 0 — unknown
  • 1 — mobile
  • 2 — wi-fi
By default, 0
"connectionType":"1"
bluetoothEnabled Bluetooth Number, possible values:
  • 0 — unknown
  • 1 — on
  • 2 — off
By default, 0
"bluetoothEnabled":"2"

For mobile apps

instanceId S2S device identifier String, number of symbols 36 "instanceId":"00000000-0000-0000-0000-000000000000"
adTrackingEnabled Tracking permission Number, possible values:
  • 1 — on
  • 0 — off
By default, 1
"adTrackingEnabled":"0"
iOS
idfa iOS advertising identifier String, number of symbols 36 "idfa":"00000000-0000-0000-0000-000000000000"
iosVendorId iOS vendor identifier String, number of symbols 36 "iosVendorId":"00000000-0000-0000-0000-000000000000"
Android
gaid Android advertising identifier (advertisingId) String, number of symbols 36 "gaid":"00000000-0000-0000-0000-000000000000"
appSetId Android identifier, unique within a Google Play developer account String, number of symbols 36 "appSetId":"00000000-0000-0000-0000-000000000000"
androidId Android identifier String, number of symbols 16 "androidId":"000000000000000"

For websites

lvid S2S device identifier String, number of symbols 32 "lvid":"00000000000000000000000000000000"
adBlocker Ad blocker Number, possible values:
  • 1 — on
  • 0 — off
By default, 0
"adBlocker":"0"
userAgent User-Agent String, maximum size 2048 "userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"

For VK Mini Apps

customPlatformUserId User identifier in the VK platform (vk id) String
"customPlatformUserId":"12345"
vkPlatform Platform type on which the event occurred String, possible values:
  • desktop_web
  • mobile_web
  • mobile_android
  • mobile_android_messenger
  • mobile_ipad
  • mobile_iphone
  • mobile_iphone_messenger
"vkPlatform":"desktop_web"

For VK Play

lvid S2S device identifier String, number of symbols 32 "lvid":"00000000000000000000000000000000"
sezamUserId User identifier in the VK Play platform Integer "sezamUserId": 123456789
hwid Desktop device identifier for apps on the VK Play platform, Hardware ID String with a positive number. Maximum possible value "18446744073709551615" "hwid":"17311996565727399517"

Example query

HTTP POST request:

curl https://tracker-s2s.my.com/v1/customRevenue/?idApp=666 \
–k –X POST --header "Authorization: aaaaaAAAaaa01aaaaaaa1aaAAA11a" \
-d '{"customUserId": "1", "idTransaction": "order1234",
"currency": "USD", "total": 1.99, "eventTimestamp": "1580213208",
"instanceId": "00000000-0000-0000-0000-000000000000"}'

Status codes

Code Response Description
200 {"message": "ОK"} The request was successfully processed
400 {"error": "Bad Request"} Request error, parameters not validated
403 {"error": "Forbidden"} The token has not been validated or is not suitable for the application
400 {"error": "Empty post data"} Empty request body
400 {"error": "Bad json"} Passed an invalid JSON file in the request body
400 {"error": "Bad api version"} Unsupported API version
400 {"error": "Platform is not supported in this method. Please, use googlePlay* methods for Android and appStore* methods for iOS"} Platform is not supported in this method. Please, use googlePlay* methods for Android and appStore* methods for iOS
404 {"error": "Method not found"} API method not found
500 {"error": "Internal Server Error"} Internal API error. Try to repeat the request later
Was this article helpful?
    Sorry, the translation has not been completed yet