Per doc
Once you've verified the purchase, your app is ready to grant entitlement to the user. After granting entitlement, your app must then acknowledge the purchase. This acknowledgement communicates to Google Play that you have granted entitlement for the purchase.
Note: If you do not acknowledge a purchase within three days, the user automatically receives a refund, and Google Play revokes the purchase.
We know after Google Play Billing Library 3.0, we must acknowledge the purchase within 3 days. Otherwise, the purchase will be automatically refunded by google play.
The acknowledge logic is done on our server-side, we want to double-check the acknowledge logic through fetching the refunded purchase due to the acknowledgment issue. For example, our server does acknowledge one purchase successfully. Does the refund of this purchase still happen? One solution is to retrieve the refunded purchase data from google play and check whether the acknowledgment is done on our server-side.
However, per google play support guys, we could Not fetch those refunded purchases due to the acknowledgement issues through Voided Purchase.
Is there any way to verify the acknowledgement logic in google play in-app purchase? Or anything am I missing?
Related
I'm having some trouble dealing with the new inapp billing library (version 4)
Ever since I updated the billing library in my app some user purchases are failing to be acknowledged, therefore they get refunded within 3 days, while other work just fine.
My theory is that because of the app only sending an acknowledge request once when a SKU is bought, said request might sometimes fail and the thing remains unacknowledged. That'd explain why some purchases are working and other aren't, getting refunded in the process.
I thought of writing a condition that always sends an acknowledge request whenever a SKU is purchased but isn't acknowledged as a possible solution. This would always send an ackowledge request as long as it's purchased and not acknowledged, therefore if the acknowledge request fails it'd just send it again until it's approved.
I was wondering if successfully processed inapp purchases failing to acknowledge is common?
Check it https://developer.android.com/google/play/billing/integrate#process play billing document, you use to subscription package to acknowledge
Once a user completes a purchase, your app then needs to process that purchase. In most cases, your app is notified of purchases through your PurchasesUpdatedListener. but there are cases where your app is made aware of calling BillingClient.queryPurchasesAsync() as described in Fetching purchases.
Your app should process a purchase in the following way:
Verify the purchase.
Give content to the user, and acknowledge delivery of the content. Optionally, mark the item as consumed so the user can rebuy the item.
To verify a purchase, first, check that the purchase state is PURCHASED. If the purchase is PENDING, then you should process the purchase as described in Handling pending transactions. For purchases received from onPurchasesUpdated() or queryPurchasesAsync(), you should further verify the purchase to ensure legitimacy before your app grants entitlement. To learn how to verify a purchase properly, see Verify purchases before granting entitlements.
Once you've verified the purchase, your app is ready to grant entitlement to the user. After granting entitlement, your app must then acknowledge the purchase. This acknowledgment communicates to Google Play that you have granted entitlement for the purchase.
I've been implementing Google Play Billing Library v3, and noticed that starting v2 we must acknowledge a purchase after granting entitlement to the purchased feature, otherwise the user is refunded within 3 days. So essentially the lifecycle is something like:
User purchases something, e.g. subscription to a premium account.
The client app sends the purchase and signature to the backend so the user is entitled to the purchase, e.g. premium account.
The backend responds with a success, we then acknowledge with Google Play the purchase was entitled (otherwise a refund is given).
However, that got me thinking, what is stopping a malicious user from modifying the APK (or even blocking the network call) so that the acknowledgment call is not made, therefore the user is refunded within 3 days, but entitlement (step 2 above) is still given. What can I do the stop this within my app? How can I make sure the acknowledgment definitely goes through if the entitlement is given?
If no acknowledgement is made and after 3 days gets refunded, the purchased items query to the google servers will return an empty list, so you will know he is not entitled.
If a user keeps on purchasing the same item, and cancelling it due to not acknowledgement or other mechanisms, this should trigger Google alarms, and probably the user's payment method will be revoked. Google purchase system has many mechanisms in-place at server level to verify that purchases are genuine.
I'm working on a subscription renewal feature, in test mode, with testing payment methods. Problem is that we receive cancelation subscription webhook, GooglePlay makes subscription revoke.
From params:
"cancelReason": "1"
Status code from the docs,
Subscription was canceled by the system, for example, because of a
billing problem.
Also from the docs
Revoking a subscription instantly removes access to the subscription
and is usually done when you or Google suspects fraud.
Usually, it sends cancelation webhook immediately after renewal, even when it was successful, so there are cases when I got two e-mails, about renewal success and cancelation. In my case renewal called after 5 minutes (doc)
Have someone idea, what could be the reason? Is it some "Google anti-fraud system". Because for testing purpose we have short subscription period but the big price. But probably anti-fraud should not be executed when we do testing, with testing payment methods, when there is no real transaction.
The problem was, that we didn't acknowledge new subscriptions.
From the docs:
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.
Regarding subscriptions:
For subscriptions, you must acknowledge any purchase that contains a
new purchase token. This means that all initial purchases, plan
changes, and re-signups need to be acknowledged, but you do not need
to acknowledge subsequent renewals.
Test acknowledging purchase with license testers:
For purchases made by license testers, the acknowledgment window is
shorter. Instead of three days, purchases are refunded and revoked if
they are not acknowledged within five minutes.
UPDATE
changes in documentation
You should also verify that purchases are properly acknowledged as
described in processing purchases. For purchases from license testers, a > purchase will be refunded after 3 minutes if your app does not
acknowledge the purchase and you will receive an email about the
cancellation. You can also check the Orders tab in the Google Play
Console to see if an order was refunded after 3 minutes.
I was wondering how to detect a refund, or any type of cancelation of an in-app purchase(not a subscription and not a consumable).
I'm currently making my test and when I refund a test in google like that :
The purchase is still present in billingClient.queryPurchaseHistoryAsync() (even in queryPurchase()).
How can I detect such changes and how can I disable my app for refunded users?
Thanks in advance.
I do understand your concern regarding refunded items.
If you offer in-app products, you can use the Voided Purchases API to request a list of voided purchases for your in-app products. When a user requests a refund for in-app purchases, you can see what was purchased and take back the refunded digital goods from that user.
To protect you app from refund abuse please use the Protect your apps from refund abuse help guide, for the best practises in protecting your app’s in-app products.
Have to tried this function
PurchasesUpdatedListener
Listener interface for purchase updates which happen when, for example, the user buys something within the app or by initiating a purchase from Google Play Store.
void onPurchasesUpdated (int responseCode,
List<Purchase> purchases)
Implement this method to get notifications for purchases updates. Both purchases initiated by your app and the ones initiated by Play Store will be reported here.
OnPurchasesUpdated on developer.android
I am doing the static testing using the 'android.test. ...' purchase items.
'Purchased' seems to work OK.'Cancelled' and 'refunded' always produce a null purchase response when it gets to the listener. Is this what they are supposed to do?
Other response information tracing back through the calls seems OK.
According to my knowledge:
android.test.cancelled and android.test.refunds both are called when if user has been cancel the purchase or subscription or if user has been refunded by the google wallet. so purchase was cancel for both the cases so that you will get response as a null.
android.test.canceled
When you make an In-app Billing request with this product ID Google
Play responds as though the purchase was canceled. This can occur when
an error is encountered in the order process, such as an invalid
credit card, or when you cancel a user's order before it is charged.
android.test.refunded
When you make an In-app Billing request with this product ID, Google
Play responds as though the purchase was refunded. Refunds cannot be
initiated through Google Play's in-app billing service. Refunds must
be initiated by you (the merchant). After you process a refund request
through your Google Wallet merchant account, a refund message is sent
to your application by Google Play. This occurs only when Google Play
gets notification from Google Wallet that a refund has been made. For
more information about refunds, see Handling IN_APP_NOTIFY messages
and In-app Billing Pricing.
check this link for more information.
Hope it will help you.