use of com.android.billingclient.api.ConsumeParams in project AmazeFileManager by TeamAmaze.
the class Billing method onPurchasesUpdated.
@Override
public void onPurchasesUpdated(BillingResult response, @Nullable List<Purchase> purchases) {
if (response.getResponseCode() == BillingClient.BillingResponseCode.OK && purchases != null) {
for (Purchase purchase : purchases) {
ConsumeResponseListener listener = (responseCode1, purchaseToken) -> {
// we consume the purchase, so that user can perform purchase again
Toast.makeText(activity, R.string.donation_thanks, Toast.LENGTH_LONG).show();
};
ConsumeParams consumeParams = ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();
billingClient.consumeAsync(consumeParams, listener);
}
}
}
Aggregations