App Store
SDK integration
Prerequisites:
Native SDK
StoreKit SDK v1
DTDAnalytics SDK 2.5.0 and higher
Unity
DTDAnalytics 3.9.0
To initialize the service, it is necessary to call the startAutoTracking
method of the DTDPurchases
interface. The method call should be made after SDK initialization call:
Subscription restore
Subscription renewals, cancellations, and other status changes are tracked using server-to-server data from the App Store platform, which requires the settings described in the following sections.
In order to be able to track status changes for subscriptions that were issued prior to the devtodev SDK integration, the history of subscriptions previously purchased by the user must be sent to devtodev.
The SDK keeps track of the need to send this historical data so that it does not make “unnecessary” requests to the App Store. Checking whether it is necessary to send data about previously purchased subscriptions to devtodev is done by the isRestoreTransactionHistoryRequired
method. The method returns a BOOL
value.
Here is an example of a purchase history request with the check of its necessity:
DTDPurchases
service will get the information of previously purchased subscriptions automatically from SKPaymentQueue
. Sending the data via the subscriptionHistory
method is not required.
Settings on the App Store Connect side
To get detailed information about the transaction, devtodev requires access to the App Store Server API. To grant this access, you will need to generate an In-App Purchase API key.
Generating the key:
Authorize on App Store Connect
Navigate to the Users and Access section (pic. 1).
Select the "Integrations" tab, select "In-App Purchase" from the menu on the left, and click (+) add key (pic. 2).
Specify the name of the key for example: "devtodev API Key", and click "Generate" (pic. 3).
To grant the necessary access to the devtodev service, it is necessary to pass (pic. 4):
Issuer ID
Key ID
The generated .p8 file of the In-App Purchase key.
Bundle identifier of the application
Settings on devtodev side
Go to App Settings → Payments integration → IAP auto tracking → Integrate.
Fill in the integration form with the data obtained earlier
App Bundle ID
Issuer ID
Key ID
Upload the .p8 file of the In-App Purchase key.
When the integration is complete, the status will change to Active
In order for IAP auto tracking to work correctly with subscriptions, you need to integrate with App Store Server Notification. Go to Settings → Payments integration → Subscriptions → Integrate.
Fill in the iOS Bundle ID and copy the Endpoint URL
Navigate to App Store Connect. In the left column of the menu, under General, go to App information. Paste the copied endpoint URL into the Production Server URL and Sandbox Server URL fields.
Last updated
Was this helpful?