# Implementation of subscriptions and example value for iap.google.notifications\_endpoint\_id

**URL:** <https://forum.heroiclabs.com/t/implementation-of-subscriptions-and-example-value-for-iap-google-notifications-endpoint-id/3685>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [March 24, 2023, 4:14pm UTC](https://forum.heroiclabs.com/t/implementation-of-subscriptions-and-example-value-for-iap-google-notifications-endpoint-id/3685 "2023-03-24T16:14:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![juliobds](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/juliobds/32/1588_2.png) [@juliobds](https://forum.heroiclabs.com/u/juliobds)\
**Post date:** [July 10, 2023, 5:02pm UTC](https://forum.heroiclabs.com/t/implementation-of-subscriptions-and-example-value-for-iap-google-notifications-endpoint-id/3685/5 "2023-07-10T17:02:02Z")

</div>

Hi Sesposito, thanks for your previous answer. I’ve been trying different things on and off but alas, no success.

> [@sesposito](#):
>
> If you run the server in `debug`, it should print a log when a notification is received (but it won’t specify whether a subscription was renewed or not).

I’ve been doing that as far as I know by passing the startup parameter **“–logger.level DEBUG”** and no message is ever triggered related to subscription renewals. I’ve also ran Nakama from source code and added additional log messages in **core\_subscription.go** , in \*\*"func googleNotificationHandler(logger \*zap.Logger, db _sql.DB, config IAPGoogleConfig) http.HandlerFunc {"_ to be more precise.

Unlike before, I am now very confident my setup on Google’s side is correct as I can read notifications from the subscription using the following code:

```auto
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"cloud.google.com/go/pubsub"
)

func main() {
	// Set your Google Cloud project ID and Pub/Sub subscription name
	projectID := "YOUR PROJECT ID"
	subscriptionName := "YOUR SUBSCRIPTION NAME"

	ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
	defer cancel()

	// Create a new Pub/Sub client
	client, err := pubsub.NewClient(ctx, projectID)
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}
	defer client.Close()

	// Get a handle for the specified subscription
	sub := client.Subscription(subscriptionName)

	// Receive messages and print them to the console
	err = sub.Receive(ctx, func(ctx context.Context, msg *pubsub.Message) {
		fmt.Printf("Received message: %s\n", msg.Data)
		msg.Ack()
	})
	if err != nil {
		log.Fatalf("Failed to receive messages: %v", err)
	}
}

```

To anyone that finds this code useful to test your Google backend setup you’ll have to create an environment variable pointing to your .json credentials. In a Mac this would be done with:

```auto
export GOOGLE_APPLICATION_CREDENTIALS="/Path/to/your/google/applications/credentials/appname-80122638-12431ff11581.json"

```

From this I’m concluding the setup on Google’s side is done correctly as I can see the notifications of the events being renewed, however the same doesn’t happen within Nakama. The expiry date displayed in the Nakama console is never updated (Neither are the additional debug logs I added directly to the source code).

I also tried to pass the contents of my .json credentials through the startup commands when starting Nakama, with the **“–google\_auth.credentials\_json=”** parameter. I made sure to add **““redirect\_uris”: [“urn:ietf:wg:oauth:2.0:oob”]”** to the json content as explained in [this forum post](https://forum.heroiclabs.com/t/add-google-credentials-flag-to-nakama-configuration/3864). Not sure what that does or even why we need to add it manually, heck, I don’t even know what exactly to add between the square braces, there’s simply no documentation that I can find that explains this process step by step. It’s extremely frustrating to say the least.

At this point I’m stuck, not sure where to move or even what else to try to receive the notifications within Nakama.

Any help or direction would be greatly appreciated. 🙏

---

_[View the full topic](https://forum.heroiclabs.com/t/implementation-of-subscriptions-and-example-value-for-iap-google-notifications-endpoint-id/3685)._
