7

We want to store when a google play purchase is refunded to a user for data analysis.

According to documentation, there are 3 ways for a user to request a refund for a subscription on google play: https://support.google.com/googleplay/answer/2479637?hl=en

If the user requests the refund to the developer (us), we can keep track of it on our servers and manage it on our end, no problem. However, users can also ask google for a refund directly. Problem is that we can't find documentation on this kind of refunds.

Looking at the API documentation for subscriptions, it doesn't provide whether a purchase was refunded or not: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions

Also tried looking into the realtime developer notifications system. Looks like it doesn't have an event for refunds. https://developer.android.com/google/play/billing/realtime_developer_notifications#json_specification

Any idea what happens if google refunds a purchase on their end?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Tonidero
  • 107
  • 1
  • 8

1 Answers1

7

In my experience with the realtime events thus far, after a subscription is refunded two realtime-events get sent. First, a SUBSCRIPTION_CANCELED event is sent, followed by a SUBSCRIPTION_REVOKED event.

On my server, I treat the SUBSCRIPTION_CANCELED as a normal cancel, then if that event is followed by a SUBSCRIPTION_REVOKED event for the same subscription, I mark it as refunded.

Details can be found for these two specific events, as you also mentioned, at this link: https://developer.android.com/google/play/billing/realtime_developer_notifications.html#json_specification

Iman Askur
  • 302
  • 1
  • 12
  • Great! Do you know if this includes refunds from the google side? As in, do you get any SUBSCRIPTION_REVOKED events for purchases that you don't refund on your end (through the play console or the revoke api) – Tonidero May 23 '19 at 20:20
  • @Tonidero yes, I receive those events when it is revoked by google as well – Iman Askur May 30 '19 at 22:11
  • That worked! Looks like we are getting SUBSCRIPTION_REVOKED events for google refunds. Thanks for the help! – Tonidero Jul 11 '19 at 14:31
  • @ImanAskur How did you get those 2 events of CANCELED and REVOKED? I also used real time notification but didn't get any event. as it is mentioned "the refund API does not change the user entitlement, so it won't trigger a notification." Thanks for your help – NoamG Jan 14 '20 at 20:26
  • @NoamG you should see those events automatically sent after a subscription is refunded. Are you getting any events at the moment? – Iman Askur Jan 15 '20 at 01:40
  • @ImanAskur Currently I get real time notifications of all types but not refund (don't get the couple of Cancel & Revoke after a refund). I do get Cancelled event but when I test with a user (subscribe app and ask refund from play) I don't get any event. In the documents https://developer.android.com/google/play/billing/realtime_developer_notifications.html#json_specification i's written "... the refund API does not change the user entitlement, so it won't trigger a notification" so I wonder how exactly did you get those events. Thanks for your help! – NoamG Jan 15 '20 at 11:39
  • @NoamG I'm not 100% sure on what triggers it, but I know that even in the past few hours I have received REVOKED events. Maybe it is a setting in the play store? Sorry I don't know much beyond that – Iman Askur Jan 16 '20 at 23:58
  • Hi guys, but if the subscription is canceled and then it was refunded either by Google or by the developer then there is no SUBSCRIPTION_REVOKED event. did you guys test this case? I also have to implement this refund case on our server. – Deepak Goyal Feb 27 '20 at 13:18
  • 1
    I tested to check this SUBSCRIPTION_REVOKED event: 1. When the refund is from the Google side then we have this event on the server. 2. But when we manually refund the payment then we have to select the revoke checkbox so that we can receive the event. – Deepak Goyal Feb 28 '20 at 11:48
  • what about refund for 'in app purchase'? does the developer receive the SUBCRIPTION_REVOKED event as well? – Ehsan Rosdi Jan 06 '22 at 07:16