adjust-icon

Purchase verification

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:

  1. Create an AdjustEvent2dx object that represents your purchase and configure purchase properties for the target store.
  2. Create an AdjustAppStorePurchase2dx (Apple App Store) or AdjustPlayStorePurchase2dx (Google Play Store) object representing the purchase.

When you send purchase information with the Adjust SDK, Adjust does the following:

  1. Sends the information to the relevant store and waits for a status response.
  2. 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

  1. 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.

  2. Call the Adjust2dx::verifyAndTrackPlayStorePurchase method with the following arguments:

    event (AdjustEvent2dx)

    Your instantiated event object.

    callback (void(*callback))

    A delegate callback function that receives anAdjustPurchaseVerificationResult2dxobject 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("");
Adjust2dx::verifyAndTrackPlayStorePurchase(adjustEvent, [](AdjustPurchaseVerificationResult2dx verificationResult) {
log("Verification status: %s", verificationResult.verificationStatus);
log("Code: %s", verificationResult.code);
log("Message: %s", verificationResult.message);
});

Play Store purchases

  1. 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.

  2. Call the Adjust::verifyAndTrackPlayStorePurchase method with the following arguments:

    event (AdjustEvent2dx)

    Your instantiated event object.

    callback (void(*callback))

    A delegate callback function that receives anAdjustPurchaseVerificationResult2dxobject 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("");
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

  1. 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.

  2. Call the Adjust2dx::verifyAppStorePurchase method with the following arguments:

    purchase (AdjustAppStorePurchase2dx)

    Your instantiated purchase object.

    callback (void(*callback))

    A delegate callback function that receives anAdjustPurchaseVerificationResult2dxobject 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

  1. 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.

  2. Call the Adjust2dx::verifyPlayStorePurchase method with the following arguments:

    purchase (AdjustPlayStorePurchase2dx)

    Your instantiated purchase object.

    callback (void(*callback))

    A delegate callback function that receives anAdjustPurchaseVerificationResult2dxobject 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);
});