Google In-App Purchase are always refunded
V

1

7

I have some problems with google in-app purchase. All received payments are refunded after 72 hours. Is there an error in my payment codes? I paid myself and did not request any refund, but even that was refunded after 72 hours.

play_console_screenshot

private void setupBilling() {
    mBillingClient = BillingClient.newBuilder(MainActivity.this).setListener(this).enablePendingPurchases().build();
    mBillingClient.startConnection(new BillingClientStateListener() {
        @Override
        public void onBillingSetupFinished(BillingResult billingResult) {
            if (billingResult.getResponseCode() ==  BillingClient.BillingResponseCode.OK) {
                final List<String> skuList = new ArrayList<> ();
                skuList.add("remove_ads");
                final SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
                params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);

                mBillingClient.querySkuDetailsAsync(params.build(), new SkuDetailsResponseListener() {
                    @Override
                    public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> list) {
                        if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && list != null) {
                            BillingFlowParams flowParams = BillingFlowParams.newBuilder()
                                    .setSkuDetails(list.get(0))
                                    .build();
                            mBillingClient.launchBillingFlow(MainActivity.this, flowParams);
                        }
                    }
                });

            }else{
                Toast.makeText(MainActivity.this, "error", Toast.LENGTH_SHORT).show();
            }
        }
        @Override
        public void onBillingServiceDisconnected() {
            Toast.makeText(MainActivity.this, "error", Toast.LENGTH_SHORT).show();
        }
    });
}

@Override
public void onPurchasesUpdated(BillingResult billingResult, @Nullable List<Purchase> list) {
    if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK
            && list != null) {
        for (Purchase purchase : list) {
            if(purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED){

                Toast.makeText(MainActivity.this, purchase.getSku() + " ok", Toast.LENGTH_SHORT).show();

            }
        }
    } else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) {
        Toast.makeText(this, "İptal edildi", Toast.LENGTH_SHORT).show();
    } else if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED) {

        Toast.makeText(this, "alreadry owned", Toast.LENGTH_LONG).show();

    }else{
        Toast.makeText(this, "error", Toast.LENGTH_SHORT).show();
    }

}
Viddah answered 19/4, 2020 at 10:55 Comment(0)
O
6

It seems like you're not properly acknowledging the purchase.

If you use the Google Play Billing Library version 2.0 or newer, you must acknowledge all purchases within three days. Failure to properly acknowledge purchases results in those purchases being refunded.

You can find more details in the documentation: https://developer.android.com/google/play/billing/billing_library_overview#acknowledge

BillingClient client = ...
AcknowledgePurchaseResponseListener acknowledgePurchaseResponseListener = ...

void handlePurchase(Purchase purchase) {
    if (purchase.getPurchaseState() == PurchaseState.PURCHASED) {
        // Grant entitlement to the user.
        ...

        // Acknowledge the purchase if it hasn't already been acknowledged.
        if (!purchase.isAcknowledged()) {
            AcknowledgePurchaseParams acknowledgePurchaseParams =
                AcknowledgePurchaseParams.newBuilder()
                    .setPurchaseToken(purchase.getPurchaseToken())
                    .build();
            client.acknowledgePurchase(acknowledgePurchaseParams, acknowledgePurchaseResponseListener);
        }
    }
}
Otha answered 20/4, 2020 at 15:20 Comment(2)
Users paid in-app purchase in our app, but google automatic refunds after 72 hrs & 10 mins, I don't know why this happens. i did all code as a flutter document and also added below(app/build.gradle) dependencies { implementation 'com.android.billingclient:billing:2.0.3' but each and every time user users paid in-app purchase but google automatic refunds after 72 hrs & 10 mins. Any solutions please? (Flutter App)Il
Payment is getting refunded even if this is added. Any idea about this?Senhor

© 2022 - 2024 — McMap. All rights reserved.