PHPackages                             app-vise/laravel-google-server-notifications - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. app-vise/laravel-google-server-notifications

ActiveLibrary[HTTP &amp; Networking](/categories/http)

app-vise/laravel-google-server-notifications
============================================

Handling Google play server to server notifications

23.0k2PHPCI failing

Since Nov 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/app-vise/laravel-google-server-notifications)[ Packagist](https://packagist.org/packages/app-vise/laravel-google-server-notifications)[ RSS](/packages/app-vise-laravel-google-server-notifications/feed)WikiDiscussions development Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Handle Google Play server-to-server notifications for subscriptions
===================================================================

[](#handle-google-play-server-to-server-notifications-for-subscriptions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/44a257fa6cdc5771b386cccb13cf290aec833e7fdc39a136bc6aa2f256b5cdfc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7461672f6170702d766973652f6c61726176656c2d676f6f676c652d7365727665722d6e6f74696669636174696f6e732e7376673f7374796c653d666c61742d73717561726526736f72743d73656d766572)](https://packagist.org/packages/app-vise/laravel-google-server-notifications)[![Build Status](https://camo.githubusercontent.com/bccfb3898d0a3f11d5b584d9008189a48c2e37367a611183333c433137b94c07/68747470733a2f2f7472617669732d63692e6f72672f6170702d766973652f6c61726176656c2d676f6f676c652d7365727665722d6e6f74696669636174696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/app-vise/laravel-google-server-notifications)[![StyleCI](https://camo.githubusercontent.com/c39ccb2374483d24743b83a675e7bb15f29e23a33ab26008e283aef46c33b42b/68747470733a2f2f7374796c6563692e696f2f7265706f732f3232323839363434342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/222896444)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/39447228cdf137eb2a1d2a521a9ddcc03d5c176a415bf5d9d01b090406a5914c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6170702d766973652f6c61726176656c2d676f6f676c652d7365727665722d6e6f74696669636174696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/app-vise/laravel-google-server-notifications/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/3a10cb7ac9c0238693ff362af927ab8ce9f87676f3576e956d31a7a944f5d2bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6170702d766973652f6c61726176656c2d676f6f676c652d7365727665722d6e6f74696669636174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/app-vise/laravel-google-server-notifications)

Installation
------------

[](#installation)

You can install this package via composer

```
composer require app-vise/laravel-google-server-notifications
```

The service provider will register itself. You have to publish the config file with:

```
php artisan vendor:publish --provider="Appvise\GooglePlayNotifications\NotificationsServiceProvider" --tag="config"
```

This is the config that will be published.

```
return [
    /*
     * All the events that should be handeled by your application.
     * Typically you should uncomment all jobs
     *
     * You can find a list of all notification types here:
     * https://developer.android.com/google/play/billing/realtime_developer_notifications
     */
    'jobs' => [
        // 'subscription_recovered' => \App\Jobs\PlayStore\HandleRecovered::class,
        // 'subscription_renewed' => \App\Jobs\PlayStore\HandleRenewed::class,
        // 'subscription_canceled' =>  \App\Jobs\PlayStore\HandleCanceled::class,
        // 'subscrip￼￼tion_purchased' => \App\Jobs\PlayStore\HandlePurchased::class,
        // 'subscription_on_hold' => \App\Jobs\PlayStore\HandleOnHold::class,
        // 'subscription_in_grace_period' => \App\Jobs\PlayStore\HandleInGracePeriod::class,
        // 'subscription_restarted' => \App\Jobs\PlayStore\HandleRestarted::class,
        // 'subscription_price_change_confirmed' => \App\Jobs\PlayStore\HandlePriceChangeConfirmed::class,
        // 'subscription_deferred' => \App\Jobs\PlayStore\HandleDeferred::class,
        // 'subscription_paused' => \App\Jobs\PlayStore\HandlePaused::class,
        // 'subscription_pause_schedule_changed' => \App\Jobs\PlayStore\HandlePauseScheduleChanged::class,
        // 'subscription_revoked' => \App\Jobs\PlayStore\HandleRevoked::class,
        // 'subscription_expired' => \App\Jobs\PlayStore\HandleExpired::class
    ],
];
```

This package logs all the incoming requests to the database so these steps are mandatory:

```
php artisan vendor:publish --provider="Appvise\GooglePlayNotifications\NotificationsServiceProvider" --tag="migrations"
```

You should run migrate next to create the google\_notifications table:

```
php artisan migrate
```

This packages registers a POST route (/google/server/notifications) to the Webhookscontroller of this package

Usage
-----

[](#usage)

When there is an change in one of the subscriptions Google will send a realtime notification via POST request to a configured endpoint. [Follow this guide to setup Pub/Sub:](https://developer.android.com/google/play/billing/realtime_developer_notifications.html)

This package will send a 200 response if you configured the right Job for the right Notification Type otherwise it will send a 500 back to Google. Google will retry a couple of times more. The incoming payload is stored in the google\_notifications table.

### Handling incoming notifications via Jobs

[](#handling-incoming-notifications-via-jobs)

```
