App Store
SDK integration
To initialize the service, call the startAutoTracking
method of the DTDPurchases
interface. Call the method after the SDK initialization call:
let config = DTDAnalyticsConfiguration()
DTDAnalytics.initialize(applicationKey: "App ID", configuration: config)
DTDPurchases.startAutoTracking()
Subscription restore
Subscription renewals, cancellations, and other status changes are tracked using server-to-server data from the App Store. See the following sections for setup.
In order to be able to track status changes for subscriptions that were issued prior to the devtodev SDK integration, you must send the history of previously purchased user subscriptions 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. Use the isRestoreTransactionHistoryRequired
method to check whether it is necessary to send data about previously purchased subscriptions to devtodev.
The isRestoreTransactionHistoryRequired
method returns a BOOL
value.
Here is an example of a purchase history request with the check:
DTDAnalytics.isRestoreTransactionHistoryRequired { isNeedRestore in
if isNeedRestore {
DispatchQueue.main.async {
SKPaymentQueue.default().restoreCompletedTransactions()
}
}
}
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.
In the Integrations tab (1), select In-App Purchase from the menu on the left (2), and click
(+)
to add the key (3).Specify the name of the key, for example: "devtodev API Key", and click
Generate
.To grant the necessary access to the devtodev service, it is necessary to pass the following information:
Issuer ID
Key ID
The generated .p8 file of the In-App Purchase key
Bundle identifier of the application (App Bundle ID)
Settings on devtodev side
In-App Purchases
Go to Settings → Payments integration → IAP auto tracking → Integrate.
Fill in the integration form with the data obtained earlier from the App Store:
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.
Subcriptions
In order for IAP auto tracking to work correctly with subscriptions, you need to integrate 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 menu column, under General, go to App information. Paste the copied endpoint URL into the Production Server URL and Sandbox Server URL fields. Click
Save
to confirm your changes.

Last updated
Was this helpful?