PHPackages                             libern/laravel-appstore-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. libern/laravel-appstore-server-notifications

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

libern/laravel-appstore-server-notifications
============================================

Handling Appstore server to server notifications

v0.0.5(5y ago)023MITPHPPHP ^7.1

Since Oct 30Pushed 5y agoCompare

[ Source](https://github.com/libern/laravel-appstore-notifications)[ Packagist](https://packagist.org/packages/libern/laravel-appstore-server-notifications)[ RSS](/packages/libern-laravel-appstore-server-notifications/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (0)

Handle Appstore server-to-server notifications for auto-renewable subscriptions
===============================================================================

[](#handle-appstore-server-to-server-notifications-for-auto-renewable-subscriptions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5df4d2425aec20ccb1468c277c203e9003d3866a554e57ee6c30456f1c265c43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7461672f6170702d766973652f6c61726176656c2d61707073746f72652d7365727665722d6e6f74696669636174696f6e732e7376673f7374796c653d666c61742d73717561726526736f72743d73656d766572)](https://packagist.org/packages/app-vise/laravel-appstore-server-notifications)[![Build Status](https://camo.githubusercontent.com/0ae1c294bfc998c61f2bec49ae8fff53456ce7b3db88781fbed88dd71bbb3b04/68747470733a2f2f7472617669732d63692e6f72672f6170702d766973652f6c61726176656c2d61707073746f72652d6e6f74696669636174696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/app-vise/laravel-appstore-notifications)[![StyleCI](https://camo.githubusercontent.com/f2b2965aae945a82584baeef505e4b9e6e465f1739251ea95820cc2dde132197/68747470733a2f2f7374796c6563692e696f2f7265706f732f3231353533393434332f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/215539443)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c964e2ef2002c2129bce863e557053471c8402959bd7ceacef382f1a1b19493c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6170702d766973652f6c61726176656c2d61707073746f72652d6e6f74696669636174696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/app-vise/laravel-appstore-notifications/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/1d13c2617288de9df6067fcb7c77fe19b3e0ec6afa4851c2519a28541475136d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6170702d766973652f6c61726176656c2d61707073746f72652d7365727665722d6e6f74696669636174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/app-vise/laravel-appstore-server-notifications)

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

[](#installation)

You can install this package via composer

```
composer require libern/laravel-appstore-server-notifications
```

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

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

This is the config that will be published.

```
return [
    /*
     * Apple will send the shared secret with the request that should match
     * the one you use when validating receipts.
     * https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_server-to-server_notifications?language=objc#overview
     */
    'shared_secret' => env('APPLE_SHARED_SECRET'),
    /*
     * 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.apple.com/documentation/storekit/in-app_purchase/enabling_server-to-server_notifications?language=objc#3162176
     */
    'jobs' => [
        // 'initial_buy' => \App\Jobs\AppstoreNotifications\HandleInitialBuy::class,
        // 'cancel' => \App\Jobs\AppstoreNotifications\HandleCancellation::class,
        // 'renewal' => \App\Jobs\AppstoreNotifications\HandleRenewal::class,
        // 'interactive_renewal' => \App\Jobs\AppstoreNotifications\HandleInteractiveRenewal::class,
        // 'did_change_renewal_pref' => \App\Jobs\AppstoreNotifications\HandleDidChangeRenewalPreferences::class,
        // 'did_change_renewal_status' => \App\Jobs\AppstoreNotifications\HandleDidChangeRenewalStatus::class,
    ],
];
```

The shared secret should match the one you send to the store to validate receipts

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

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

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

```
php artisan migrate
```

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

Usage
-----

[](#usage)

When there is an change in one of the subscriptions Apple will send a POST request to a configured endpoint. [Follow this guide to configure the endpoint:](https://help.apple.com/app-store-connect/#/dev0067a330b)

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 Apple. Apple will retry a couple of times more. The incoming payload is stored in the apple\_notifications table.

### Handling incoming notifications via Jobs

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

```
