google play in-app purchase notification for pub/sub topic
Asked Answered
W

4

10

I'm trying to implement the backend of payment processor with google play in-app billing.
Google play billing api is tottally built for serveless scenario and is being a hell of a work to make it work for a normal world situation where apps have backends that need to validate and process payment logic.

i'm following this tutorial: https://developer.android.com/google/play/billing/getting-ready#configure-rtdn

but only after implementing the whole logic i read the small line

Real-time developer notifications (RTDN) is a mechanism to receive notifications from Google whenever there is a change in a user's entitlement within your app. RTDN leverages the use of Google Cloud Pub/Sub, which allows you to receive data that is either pushed to a URL that you set or is polled using a client library. These notifications allow you to react immediately to subscription state changes, avoiding the need to poll the Google Play Developer API. Note that inefficient use of the Google Play Developer API can lead to API quota restrictions.

so my logic integration is well done, the test message in play console works but google play billing is not sending the real notifications because my app deals with in-app products and not with subscriptions

then i read this tutorial https://developer.android.com/google/play/billing/rtdn-reference and it says

Note: A OneTimePurchaseNotification is sent only for some types of one-time purchases. For more information, see Integrate.

but the link that was: https://developer.android.com/google/play/integrate goes to 404

does anyone know how to make google play console send notification for payment status on in-app purchases?

also how to get notifications for refunded purchases

Windermere answered 2/7, 2020 at 19:22 Comment(2)
how did you receive RTDN inside mobile app? I did all the cinfiguration part of pub/sub library but dont know how to receive published msgs in app.Oblivion
The broken link is: developer.android.com/google/play/billing/integrateCrist
S
6

OneTimeProductNotification was introduced in 2019-05-07 and its main purpose of handling cash purchases

https://developer.android.google.cn/google/play/billing/release-notes#release-2_0

As release notes says: "This notification type is sent only for purchases associated with delayed forms of payment, such as cash"

enter image description here

Squib answered 8/7, 2020 at 15:30 Comment(0)
E
6

+1 for your question becuase this is a weird scenario with lack of docs from google. When I tested the notification from google play console by clicking "Send test notification" it works, but when I'm trying do so from my android app using testing client billing IT DOES NOT WORK!
but this screenshot says that

...for updates to your in-app products and subs...

Screen shot from google play RTDN page

Exigent answered 16/1, 2021 at 12:21 Comment(1)
i have exact the same problem. How did you solve it?Astor
L
2

In order to get refund purchases, you can try Voided Purchases API

The Google Play Voided Purchases API provides a list of orders that are associated with purchases that a user has voided. You can use information from this list to implement a revocation system that prevents the user from accessing products from those orders.

This API applies to one-time in-app orders and App Subscriptions.

A purchase can be voided in the following ways:

  • The user requests a refund for their order.
  • The user cancels their order.
  • An order is charged back.
  • Developer cancels or refunds order. Note: only revoked orders will be shown in the Voided Purchases API. If developer refunds without setting the revoke option, orders will not show up in the API.
  • Google cancels or refunds order.
Luisluisa answered 2/7, 2021 at 8:44 Comment(0)
C
-1

Just copy and paste the below line of code to the permissions input box and then add this to the members.

[email protected]

Next give permission to pub/sub publisher and you are good to go.

The mistake you would have done is you would have added a service account already present in your google cloud account which is not correct.

Above solution works perfectly fine for me!

Creedon answered 30/6, 2021 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.