axel / subscription-webhooks
Handling Appstore and Android subscription webhooks/notifications
Requires
- php: ^7.4|^8.0
- ext-json: *
- bensampo/laravel-enum: *
- illuminate/support: ^5.5|^6.0|^7.0|^8.0|^10.0
This package is auto-updated.
Last update: 2025-03-24 05:10:34 UTC
README
Installation
You can install this package via composer
composer require axel/subscription-webhooks
The service provider will register itself. Publish the config and migration files with:
php artisan vendor:publish
This is the config that will be published.
return [ 'jobs' => [ 'apple'=>[ // 'initial_buy' => \App\Jobs\AppstoreNotifications\HandleInitialBuy::class, ], 'android'=>[ // 'initial_buy' => \App\Jobs\AppstoreNotifications\HandleInitialBuy::class, ] ], ];
You should run migrate next to create the subscription_notifications table:
php artisan migrate
This packages registers a POST routes for Appstore and Android notifications to the WebhooksController of this package
Usage
When there is an change in one of the subscriptions Apple will send a POST request to a configured endpoint.
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
You should extend AnyJobFile from BaseJob
<?php namespace App\Jobs\AppstoreNotifications; use Axel\SubscriptionWebhooks\Jobs\BaseJob; class AnyJobFile extends BaseJob { public function handle() { // Do something that matches your business logic with $this->payload } }
Security
If you discover any security related issues, please email satybaldiev@gmail.com
Credits
A big thanks to App Vise laravel-appstore-notifications which was a huge inspiration and starting point for this package. Even README file was copied from them
License
The MIT License (MIT). Please see License File for more information.