Download the PHP package barstec/laravel-cashbill without Composer
On this page you can find all versions of the php package barstec/laravel-cashbill. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-cashbill
Cashbill payment system for Laravel
Package for easily integrating Cashbill payments with Laravel.
Support
If this package is helpful for you, you can support my work on Ko-fi.
Installation
-
Install composer package using command:
-
Publish configuration files to your project
- Run migrations
Setup
Firstly you need to move environmental variables from .env.example to .env:
If you are in testing mode, set CASHBILL_MODE to dev. When in production, switch it to prod. Retrieve the remaining variables from the CashBill shop settings.
In the configuration file, you can define return routes, default values, the database table name, and the columns for collecting personal data. After modifying columns, rerun the migration process.
Ensure that you specify the same notification route as in the CashBill shop settings. This URL is used to verify transactions and is set by default to /api/cashbill/notification
Usage/Examples
To initiate a transaction, create a Payload object in your controller and assign values. Then, create a Payment object, pass the Payload, and call redirect(). This action will start the transaction and redirect the user to the Cashbill payment page. You can also create a PersonalData object. The first name, surname, and email address will be automatically filled on the Cashbill page.
Upon transaction creation, the TransactionCreated event is triggered. You can use it to retrieve the payload and order ID to associate the transaction with a specific user. To achieve this, create a listener and register it in your EventServiceProvider.
By default, all transaction status changes are handled by the package. The TransactionSuccessfullyCompleted event is triggered after receiving a PositiveFinish signal from Cashbill. Otherwise, for status changes, the TransactionStatusChanged event is triggered.
If you prefer to update order data manually, you can create an Order object by passing a specific order ID to the constructor and then calling the update() method, which returns a PaymentDetails object.
Author
License
This package is distributed under the MIT license