play-billing-samples icon indicating copy to clipboard operation
play-billing-samples copied to clipboard

is it possible acknowledge consumable products from server side?

Open p4689428 opened this issue 4 years ago • 11 comments

According to this document, https://developer.android.com/google/play/billing/release-notes it says "You can acknowledge a purchase by using one of the following methods:

For consumable products, use consumeAsync(), found in the client API. For products that aren't consumed, use acknowledgePurchase(), found in the client API. A new acknowledge() method is also available in the Server API."

but others document, https://developer.android.com/google/play/billing/integrate#acknowledge Product.Purchases.Acknowledge from the Google Play Developer API is only used to acknowledge non-consumable purchases and Subscriptions .

is Product.Purchases.Acknowledge used to acknowledge consumable purchases ?

Thank you.

p4689428 avatar Aug 19 '20 06:08 p4689428

Purchases.Acknowledge can be used to acknowledge consumables, but the client app will still have to consume the purchase by calling consumeAsync().

We have a feature request to add something like Purchases.consume for the Server API so this can be less confusing. If we have any updates, I'll be sure to update this issue, and thanks for the feedback!

calren avatar Aug 19 '20 22:08 calren

Now we know Purchases.Acknowledge can be used to acknowledge consumable item. we planning scenario is that 1.APP do a google play billing request for consumable item.

2.APP request server to apply consumable item right

3.app call consumeAsync() to consume this item.

but we are afraid of the unexpected case between step2 and step3 and consumeAsync() is not called, we plan in step2, server call Purchases.Acknowledge after apply consumable item right to user. so we want check the case, if server call Purchases.Acknowledge success but app doesn't call consumeAsync() because of some result 1.Would this transaction be refunded after 3days? 2.Could user buy the same consumable item in app?

Thank you again for your generosity.

p4689428 avatar Aug 20 '20 01:08 p4689428

If the item is: acknowledged but not consumed, the item will not be refunded, but the user will also not be able to buy it again. Hope that helps!

calren avatar Aug 21 '20 17:08 calren

Any updates on Purchases.consume for the server? Currently it's not consistent at all. All my premium functionality is "calculated" on the server and delivered from the server, and all the purchases are consumable, for me I don't care if it has been consumed by the device or not. If it was consumed but the app wasn't able to tell this to the server (for example connection disappeared) then I will need to write a lot of code just to synchronize the state, and to do polling of the google services again to catch the current state, while the idea of all this was to avoid this. Same for the real time developer notifications, I'm getting notifications only for pending purchases. But not for the purchases which complete immediately. I want server to handle this all, Currently it's partially Android, partially Server . Current state for the purchase Api on both the android and server looks incomplete, inconsistent and intricate. In order to achieve something it doesn't help, It's the place I have to overcome like a disease. Where to report this?

truestep avatar Oct 03 '20 11:10 truestep

If the item is: acknowledged but not consumed, the item will not be refunded, but the user will also not be able to buy it again. Hope that helps!

So in order to prevent the obvious exploit of infinite 3 day auto-refunds from a bad actor who can deliberately intercept and discard a client-side acknowledge or consume, we are required to do server-to-server acknowledgement. Is my understanding correct?

grog444 avatar Mar 09 '21 17:03 grog444

This option to acknowledge consumable in-app product purchases in the server is crucial to avoid long waiting time to confirm the payments in client-side in some cases so that we can show the order status to the users as "pending confirmation" and can acknowledge it later via Real-time developer notification so that even if the user closes the app we won't lose a valid purchase because of the inability to acknowledge it.

With that said. Is there is any ETA for when it will be available.

JohnPremKumar avatar May 31 '21 19:05 JohnPremKumar

@JohnPremKumar https://issuetracker.google.com/issues/174226424?pli=1 ETA is never

apos-cadabra avatar May 31 '21 20:05 apos-cadabra

@apos-cadabra Thanks for pointing out the above issue. I think I have not properly conveyed the issue in the above comment.

The real-time developer notification is delivered for approval-delayed in-app purchases. But not for purchases that approve instantly. I am totally fine with this behaviour.

But for acknowledging such approval-delayed in-app purchases in the server. Currently, there is an endpoint(https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/acknowledge) which is fine for non-consumable(one-time purchase) items.

But when we use the same endpoint for acknowledging consumable items(can be purchased multiple times). This endpoint acknowledges it as a non-consumable(one-time purchase) item by default and there is no option to specify during acknowledging that this purchase consumable using the above endpoint in the server.

Hope I have clearly explained the issue this time.

JohnPremKumar avatar May 31 '21 21:05 JohnPremKumar

Do you have any solution for this problem?

RonaldoBueno16 avatar Jun 14 '22 03:06 RonaldoBueno16

If the item is: acknowledged but not consumed, the item will not be refunded, but the user will also not be able to buy it again. Hope that helps!

We call consumeAsync in our client for consumable items but when we added acknowledgement on the server side we got these errors:

image

Do consumeable in app purchases need to be acknowledged?

jonatino avatar Oct 20 '22 06:10 jonatino

@jonatino yes it needs to be acknowledged else it will be refunded automatically after a timeframe. But unfortunately, there is no way to do that on the server at the moment. It needs to be only done on the client as of now.

There seems to be no update on this case for quite some time now. If somehow we fail to acknowledge in client, then we need to treat the payment as not completed in the server.

JohnPremKumar avatar Oct 20 '22 08:10 JohnPremKumar