Download the PHP package yasserbenaioua/chargily-epay-laravel without Composer
On this page you can find all versions of the php package yasserbenaioua/chargily-epay-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yasserbenaioua/chargily-epay-laravel
More information about yasserbenaioua/chargily-epay-laravel
Files in yasserbenaioua/chargily-epay-laravel
Package chargily-epay-laravel
Short Description A laravel package for chargily epay gateway
License MIT
Homepage https://github.com/yasserbenaioua/chargily-epay-laravel
Informations about the package chargily-epay-laravel
A laravel package for chargily epay gateway
Installation
You can install the package via composer:
You must publish the config file with:
This is the contents of the config file that will be published at config/chargily.php
:
Next, you must publish the migration with:
After the migration has been published, you can create the chargily_webhook_calls
table by running the migrations:
Finally, take care of the routing: At the chargily config file you must configure at what URL Chargily webhook should be sent. In the routes file of your app you must pass that route to the Route::githubWebhooks
route macro:
Behind the scenes this macro will register a POST
route to a controller provided by this package. We recommend to put it in the api.php
routes file, so no session is created when a webhook comes in, and no CSRF token is needed.
Should you, for any reason, have to register the route in your web.php
routes file, then you must add that route to the except
array of the VerifyCsrfToken
middleware:
Usage
Firstly, you may create a payment like this:
then use getRedirectUrl()
method to get the checkout link:
Chargily will sign all requests hitting the webhook url of your app. This package will automatically verify if the signature is valid.
Unless something goes terribly wrong, this package will always respond with a 200
to webhook requests. All webhook requests with a valid signature will be logged in the chargily_webhook_calls
table. The table has a payload column where the entire payload of the incoming webhook is saved.
If the signature is not valid, the request will not be logged in the chargily_webhook_calls
table but a Spatie\WebhookClient\Exceptions\InvalidWebhookSignature
exception will be thrown. If something goes wrong during the webhook request the thrown exception will be saved in the exception column. In that case the controller will send a 500
instead of 200
.
To handle webhook requests you can define a job that does the work. Here's an example of such a job:
After having created your job you must register it at the jobs
array in the chargily.php
config file.
Deleting processed webhooks
The YasserBenaioua\Chargily\Models\ChargilyWebhookCall
is MassPrunable
. To delete all processed webhooks every day you can schedule this command.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- Yasser Benaioua
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of chargily-epay-laravel with dependencies
guzzlehttp/guzzle Version ^7.5
illuminate/contracts Version ^8.77|^9.0
spatie/laravel-package-tools Version ^1.9.0
spatie/laravel-webhook-client Version ^3.1.0