If you’ve enabled purchase verification, you can use the Adjust SDK to request purchase verification.
There are two ways to verify purchases with the Adjust SDK:
- Create an
ADJEvent
object that represents your purchase and add the following properties:transactionId
(NSString
): The ID of the transaction you want to verify.productId
(NSString
): The product identifier of the item that was successfully purchased.
- Create an
ADJAppStorePurchase
object with your transaction ID and product ID.
When you send purchase information with the Adjust SDK, Adjust does the following:
- Sends the information to the App Store and waits for a status response.
- Forwards the status response to the Adjust SDK.
You can access the purchase verification status by using a callback. Results are returned as ADJPurchaseVerificationResult
objects containing the following properties:
verificationStatus
(NSString
): The status of the purchase.code
(int
): The status code of the purchase.message
(NSString
): Any message returned by the App Store.
Record event and verify purchase
To send a revenue event for verification and listen for the purchase verification status, follow these steps:
- Instantiate an
ADJEvent
object with the your event token and set the following parameters:transactionId
(NSString
): The ID of the transaction you want to verify.productId
(NSString
): The product identifier of the item that was successfully purchased.
- Call the
Adjust.verifyAndTrackPlayStorePurchase
method with the following arguments:event
(ADJEvent
): Your instantiated event object.callback
(ADJVerificationResultBlock
): A delegate callback function that receives anADJPurchaseVerificationResult
object as an argument.
In this example, the purchase verification response is output to the logging daemon.
Only verify purchase
To send a standalone purchase and listen for the purchase verification status, follow these steps:
- Instantiate an
ADJAppStorePurchase
with the following arguments:transactionId
(NSString
): The ID of the transaction you want to verify.productId
(NSString
): The product identifier of the item that was successfully purchased.
- Call the
Adjust.verifyAppStorePurchase
method with the following arguments:purchase
(ADJAppStorePurchase
): Your instantiated purchase object.callback
(ADJVerificationResultBlock
): A delegate callback function that receives anADJPurchaseVerificationResult
object as an argument.
In this example, the purchase verification response is output to the logging daemon.