I am trying to update my database according to the push notifications that come from Google when a user purchases or subscribes in my app.For this I will use php. What will happen is:
- User makes a subscription in my app.
- Pub/Sub receives that data and sends a push notification to a link provided by me.
- Data in database is updated. 4.The app makes an http request and gets the subscription information.
I provided an URL for pub sub notifications , what I need is to parse the data, make a request to get the updated data and update the database accordingly . I know how to make the request
$client = new \Google_Client();
$client->setAuthConfig('credentials.json');
$client->addScope('https://www.googleapis.com/auth/androidpublisher');
$service = new \Google_Service_AndroidPublisher($client);
$subscription = $service->purchases_subscriptions->get($package_name,
$product_id,
$token);
But I don't know how to handle subscription or purchase coming from PubSub and flow accordingly. How should I do it?