Search in sources :

Example 1 with UserData

use of com.amazon.device.iap.model.UserData in project Osmand by osmandapp.

the class InAppPurchaseHelperImpl method onPurchaseFinished.

// Call when a purchase is finished
private void onPurchaseFinished(@NonNull String sku, @NonNull PurchaseResponse response) {
    Receipt receipt = response.getReceipt();
    logDebug("Purchase finished: " + receipt.getSku());
    PurchaseInfo info = getPurchaseInfo(sku, receipt);
    UserData userData = response.getUserData();
    if (userData != null) {
        info.setPurchaseToken(userData.getUserId());
    } else {
        info.setPurchaseToken(getUserId());
    }
    onPurchaseDone(info);
}
Also used : Receipt(com.amazon.device.iap.model.Receipt) PurchaseInfo(net.osmand.plus.inapp.InAppPurchases.PurchaseInfo) UserData(com.amazon.device.iap.model.UserData)

Example 2 with UserData

use of com.amazon.device.iap.model.UserData in project OsmAnd by osmandapp.

the class InAppPurchaseHelperImpl method onPurchaseFinished.

// Call when a purchase is finished
private void onPurchaseFinished(@NonNull String sku, @NonNull PurchaseResponse response) {
    Receipt receipt = response.getReceipt();
    logDebug("Purchase finished: " + receipt.getSku());
    PurchaseInfo info = getPurchaseInfo(sku, receipt);
    UserData userData = response.getUserData();
    if (userData != null) {
        info.setPurchaseToken(userData.getUserId());
    } else {
        info.setPurchaseToken(getUserId());
    }
    onPurchaseDone(info);
}
Also used : Receipt(com.amazon.device.iap.model.Receipt) PurchaseInfo(net.osmand.plus.inapp.InAppPurchases.PurchaseInfo) UserData(com.amazon.device.iap.model.UserData)

Aggregations

Receipt (com.amazon.device.iap.model.Receipt)2 UserData (com.amazon.device.iap.model.UserData)2 PurchaseInfo (net.osmand.plus.inapp.InAppPurchases.PurchaseInfo)2