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
AdjustEvent2dxobject that represents your purchase and configure purchase properties for the target store. - Create an
AdjustAppStorePurchase2dx(Apple App Store) orAdjustPlayStorePurchase2dx(Google Play Store) object representing the purchase.
When you send purchase information with the Adjust SDK, Adjust does the following:
- Sends the information to the relevant 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 AdjustPurchaseVerificationResult2dx objects containing the following properties:
verificationStatus(std::string)-
The status of the purchase.
code(int)-
The status code of the purchase.
message(std::string)-
Any message returned by the store.
Verify purchase and record event
To send a revenue event for verification and listen for the purchase verification status, follow these steps.
App Store purchases
- Instantiate an
AdjustEvent2dxobject with the your event token and set the following parameters:
productId(std::string)-
The product identifier of the item that was successfully purchased.
transactionId(std::string)-
The ID of the transaction you want to verify.
- Call the
Adjust2dx::verifyAndTrackPlayStorePurchasemethod with the following arguments:
event(AdjustEvent2dx)-
Your instantiated event object.
callback(void(*callback))-
A delegate callback function that receives an
AdjustPurchaseVerificationResult2dxobject as an argument.
In this example, the purchase verification response is output to the logging daemon.
AdjustEvent2dx adjustEvent = AdjustEvent2dx("{YOUR_EVENT_TOKEN}");adjustEvent.setRevenue(0.25, "EUR");adjustEvent.setTransactionId("7d9c2e12-b2ea-4be4-96cf-bd90d8f062fb");adjustEvent.setProductId("{variables.event.revenue.productId}");Adjust2dx::verifyAndTrackPlayStorePurchase(adjustEvent, [](AdjustPurchaseVerificationResult2dx verificationResult) { log("Verification status:s", verificationResult.verificationStatus); log("Code:s", verificationResult.code); log("Message:s", verificationResult.message);});Play Store purchases
- Instantiate an
AdjustEvent2dxobject with the your event token and set the following parameters:
productId(std::string)-
The ID of the product that has been purchased.
purchaseToken(std::string)-
The purchase token associated with the purchase.
- Call the
Adjust::verifyAndTrackPlayStorePurchasemethod with the following arguments:
event(AdjustEvent2dx)-
Your instantiated event object.
callback(void(*callback))-
A delegate callback function that receives an
AdjustPurchaseVerificationResult2dxobject as an argument.
In this example, the purchase verification response is output to the logging daemon.
AdjustEvent2dx adjustEvent = AdjustEvent("{YOUR_EVENT_TOKEN}");adjustEvent.setRevenue(0.25, "EUR");adjustEvent.setProductId("58112286-9fc4-4ba3-9aaa-dd5c69be3e49");adjustEvent.setPurchaseToken("{variables.event.revenue.purchaseToken}");Adjust2dx::verifyAndTrackPlayStorePurchase(adjustEvent, [](AdjustPurchaseVerificationResult2dx verificationResult) { log("Verification status:s", verificationResult.verificationStatus); log("Code:s", verificationResult.code); log("Message:s", verificationResult.message);});Only verify purchase
To send standalone purchase information and listen for the purchase verification status, follow these steps:
App Store purchases
- Instantiate an
AdjustAppStorePurchase2dxobject with the following arguments:
productId(std::string)-
The product identifier of the item that was successfully purchased.
transactionId(std::string)-
The ID of the transaction you want to verify.
- Call the
Adjust2dx::verifyAppStorePurchasemethod with the following arguments:
purchase(AdjustAppStorePurchase2dx)-
Your instantiated purchase object.
callback(void(*callback))-
A delegate callback function that receives an
AdjustPurchaseVerificationResult2dxobject as an argument.
In this example, the purchase verification response is output to the logging daemon.
AdjustAppStorePurchase2dx purchase = AdjustAppStorePurchase2dx("58112286-9fc4-4ba3-9aaa-dd5c69be3e49", "7d9c2e12-b2ea-4be4-96cf-bd90d8f062fb");Adjust2dx::verifyAppStorePurchase(purchase, [](AdjustPurchaseVerificationResult2dx verificationResult) { log("Verification status:s", verificationResult.verificationStatus); log("Code:s", verificationResult.code); log("Message:s", verificationResult.message);});Play Store purchases
- Instantiate an
AdjustPlayStorePurchase2dxwith the following arguments:
productId(std::string)-
The ID of the product that has been purchased.
purchaseToken(std::string)-
The purchase token associated with the purchase.
- Call the
Adjust2dx::verifyPlayStorePurchasemethod with the following arguments:
purchase(AdjustPlayStorePurchase2dx)-
Your instantiated purchase object.
callback(void(*callback))-
A delegate callback function that receives an
AdjustPurchaseVerificationResult2dxobject as an argument.
In this example, the purchase verification response is output to the logging daemon.
AdjustPlayStorePurchase2dx purchase = AdjustPlayStorePurchase2dx("58112286-9fc4-4ba3-9aaa-dd5c69be3e49", "07b946ed-4204-4fa0-8424-6c47413a7df3");Adjust2dx::verifyPlayStorePurchase(purchase, [](AdjustPurchaseVerificationResult2dx verificationResult) { log("Verification status:s", verificationResult.verificationStatus); log("Code:s", verificationResult.code); log("Message:s", verificationResult.message);});