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
AdjustEvent2dx
object 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
AdjustEvent2dx
object 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::verifyAndTrackPlayStorePurchase
method with the following arguments:event
(AdjustEvent2dx
)Your instantiated event object.
callback
(void(*callback)
)A delegate callback function that receives an
AdjustPurchaseVerificationResult2dx
object as an argument.
In this example, the purchase verification response is output to the logging daemon.
Play Store purchases
Instantiate an
AdjustEvent2dx
object 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::verifyAndTrackPlayStorePurchase
method with the following arguments:event
(AdjustEvent2dx
)Your instantiated event object.
callback
(void(*callback)
)A delegate callback function that receives an
AdjustPurchaseVerificationResult2dx
object as an argument.
In this example, the purchase verification response is output to the logging daemon.
Only verify purchase
To send standalone purchase information and listen for the purchase verification status, follow these steps:
App Store purchases
Instantiate an
AdjustAppStorePurchase2dx
object 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::verifyAppStorePurchase
method with the following arguments:purchase
(AdjustAppStorePurchase2dx
)Your instantiated purchase object.
callback
(void(*callback)
)A delegate callback function that receives an
AdjustPurchaseVerificationResult2dx
object as an argument.
In this example, the purchase verification response is output to the logging daemon.
Play Store purchases
Instantiate an
AdjustPlayStorePurchase2dx
with 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::verifyPlayStorePurchase
method with the following arguments:purchase
(AdjustPlayStorePurchase2dx
)Your instantiated purchase object.
callback
(void(*callback)
)A delegate callback function that receives an
AdjustPurchaseVerificationResult2dx
object as an argument.
In this example, the purchase verification response is output to the logging daemon.