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
AdjustEvent
object that represents your purchase and configure purchase properties for the target store. - Create an
AdjustAppStorePurchase
(Apple App Store) orAdjustPlayStorePurchase
(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 AdjustPurchaseVerificationResult
objects containing the following properties:
verificationStatus
(String
): The status of the purchase.code
(num
): The status code of the purchase.message
(String
): Any message returned by the store.
Verify purchase and record event
static Future<AdjustPurchaseVerificationResult?> verifyAndTrackAppStorePurchase( AdjustEvent event) async
To send a revenue event for verification and listen for the purchase verification status, follow these steps:
- Instantiate an
AdjustEvent
object with the your event token and set the following parameters:productId
(String
): The product identifier of the item that was successfully purchased.transactionId
(String
): The ID of the transaction you want to verify.
- Call the
Adjust.VerifyAndTrackPlayStorePurchase
method with the following argument:event
(AdjustEvent
): Your instantiated event object. Expect the verification response to arrive as part of theFuture<AdjustPurchaseVerificationResult?>
return value.
In this example, the purchase verification response is output to the logging daemon.
AdjustEvent adjustEvent = new AdjustEvent('abc123');adjustEvent.setRevenue(6.66, 'CAD');adjustEvent.transactionId = 'transaction-id';adjustEvent.productId = 'product-id';Adjust.verifyAndTrackAppStorePurchase(adjustEvent).then((result) { print('Verification status = $result?.verificationStatus'); print('Code = $result?.code.toString()'); print('Message = $result?.message');}
static Future<AdjustPurchaseVerificationResult?> verifyAndTrackPlayStorePurchase( AdjustEvent event) async
To send a revenue event for verification and listen for the purchase verification status, follow these steps:
- Instantiate an
AdjustEvent
object with the your event token and set the following parameters:productId
(String
): The ID of the product that has been purchased.purchaseToken
(String
): The purchase token associated with the purchase.
- Call the
Adjust.verifyAndTrackPlayStorePurchase
method with the following argument:adjustEvent
(AdjustEvent
): Your instantiated event object. Expect the verification response to arrive as part of theFuture<AdjustPurchaseVerificationResult?>
return value.
In this example, the purchase verification response is output to the logging daemon.
AdjustEvent adjustEvent = new AdjustEvent('abc123');adjustEvent.setRevenue(6.66, 'CAD');adjustEvent.productId = 'product-id';adjustEvent.purchaseToken = 'purchase-token';Adjust.verifyAndTrackPlayStorePurchase(adjustEvent).then((result) { print('Verification status = $result?.verificationStatus'); print('Code = $result?.code.toString()'); print('Message = $result?.message');}
Only verify purchase
static Future<AdjustPurchaseVerificationResult?> verifyAppStorePurchase( AdjustAppStorePurchase purchase) async
To send a standalone App Store purchase and listen for the purchase verification status, follow these steps:
- Instantiate an
AdjustAppStorePurchase
object with the following arguments:productId
(String
): The product identifier of the item that was successfully purchased.transactionId
(String
): The ID of the transaction you want to verify.
- Call the
Adjust.verifyAppStorePurchase
method with the following argument:purchase
(AdjustAppStorePurchase
): Your instantiated event object. Expect the verification response to arrive as part of theFuture<AdjustPurchaseVerificationResult?>
return value.
In this example, the purchase verification response is output to the logging daemon.
AdjustAppStorePurchase purchase = new AdjustAppStorePurchase('product-id', 'transaction-id');Adjust.verifyAppStorePurchase(purchase).then((result) { print('Verification status = $result?.verificationStatus'); print('Code = $result?.code.toString()'); print('Message = $result?.message');}
static Future<AdjustPurchaseVerificationResult?> verifyPlayStorePurchase( AdjustPlayStorePurchase purchase) async
To send a standalone Play Store purchase and listen for the purchase verification status, follow these steps:
- Instantiate an
AdjustPlayStorePurchase
with the following arguments:productId
(String
): The ID of the product that has been purchased.purchaseToken
(String
): The purchase token associated with the purchase.
- Call the
Adjust.VerifyPlayStorePurchase
method with the following argument:purchase
(AdjustPlayStorePurchase
): Your instantiated purchase object. Expect the verification response to arrive as part of theFuture<AdjustPurchaseVerificationResult?>
return value.
In this example, the purchase verification response is output to the logging daemon.
AdjustPlayStorePurchase purchase = new AdjustPlayStorePurchase('product-id', 'purchase-token');Adjust.verifyPlayStorePurchase(purchase).then((result) { print('Verification status = $result?.verificationStatus'); print('Code = $result?.code.toString()'); print('Message = $result?.message');}