Download the PHP package jinseokoh/purchase-webhooks without Composer
On this page you can find all versions of the php package jinseokoh/purchase-webhooks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jinseokoh/purchase-webhooks
More information about jinseokoh/purchase-webhooks
Files in jinseokoh/purchase-webhooks
Package purchase-webhooks
Short Description Handling App Purchase Server-to-Server Webhooks
License MIT
Informations about the package purchase-webhooks
Handle App Purchase Server-to-Server Webhooks with Laravel
Background
At the time of writing API servers for a new mobile application, I've found this aporat/store-receipt-validator package very useful to validate in-app purchase responses from Apple App Store and Google Play Store. But, there're occasions that anyone can ask refund their purchases directly to the stores without notifying us of the cancellation. We could end up letting them use the app for free.
I know there exists Google Play Store API that we can make use of to retrieve voided purchases information. But, that's not so 2021. The both platforms allow us to register webhook URL address to post back all the store events including INITIAL PURCHASE and CANCELLATION. As long as you have the webhooks in place, you can get almost realtime server-to-server notifications if someone's got refunded. That means you can deprive the user of any privileges within your app at your discretion.
This package handles the server to server notifications via Laravel Jobs. Note that subscription payment notifications are not fully supported as of yet since that's beyond my use-cases. If your application has subscription based payment options, this might not be what you are looking for.
Installation
You can install this package via composer
You must publish the config file with:
This is the config that will be published.
This package registers the following POST routes
/webhooks/apple/purchase
/webhooks/google/purchase
Usage
Uncomment any events of your interest in config/purchase.php
, and let each Job class handle the payload from Apple/Googe server.
A sample Laravel job to handle Apple Server Notifications.
A sample Laravel job to handle Google Server Notifications.
Credits
This package is heavily based on app-vise/laravel-appstore-notifications and imdhemy/laravel-in-app-purchases A big thanks to the authors of their great packages.
License
The MIT License (MIT). Please see License File for more information.