Download the PHP package smladeoye/yii2-paystack without Composer
On this page you can find all versions of the php package smladeoye/yii2-paystack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smladeoye/yii2-paystack
More information about smladeoye/yii2-paystack
Files in smladeoye/yii2-paystack
Package yii2-paystack
Short Description Yii 2 Paystack Payment extension (Component and widget)
License MIT
Informations about the package yii2-paystack
yii2-paystack
YII 2 component for paystack payment integration
- [Installation] (https://github.com/smladeoye/yii2-paystack#installation)
- [Configuration] (https://github.com/smladeoye/yii2-paystack#configuration)
- [Usage] (https://github.com/smladeoye/yii2-paystack#usage-example)
- [Event Handling for Paystack Operations] (https://github.com/smladeoye/yii2-paystack#handling-events)
- [Paystack Inline Widget] (https://github.com/smladeoye/yii2-paystack#using-the-paystack-inline-payment-widget)
Installation
The preferred way to install this extension is through composer.
Either run
or
add '"smladeoye/yii2-paystack": "1.0.0"' to the require section of your composer.json file, then run:
Configuration
In your configuration file (web.php) register the component with the necessary configurations, for example:
Usage Example
There are seven operations available that can be performed which have been grouped based on Paystack's own grouping. Each of the operations also have their individual methods that can be called for performing different actions (create, list -- fetchAll, fetch, update,...) which can accept all the necessary parameters as an array.
The following are the available operations and methods (all sample codes are based on the demo configuration above):
-
customer: To initiatiate any customer operation:
Distinct methods available to customer:
-
whitelist --> whitelist a particular customer.Example:
- blacklist --> blacklist a particular customer.Example:
-
-
transaction: To initiate a transaction operation:
Distinct methods available to transaction:
-
initialize --> initialize a transaction; an authorization url is generated from this method after which the redirect method can then be called to redirect to the payment page. Example:
-
verify --> verify a transaction.Example:
-
charge --> charge authorization for recurring transactions.Example:
-
timeline --> timeline for a particular transactions.Example:
-
total --> get total for transactions within a specified range.Example:
- export --> export a range of transaction details;a url is generated from this method from which the file can be downloaded. To get the path simpley call the path method or call the download method to download the file. Example:
OR to download the file, call:
-
-
subscription: To initiate a subscription operation:
Distinct methods available to subscription:
-
enable --> enable a customer subscription.Example:
- disable --> disable a customer subscription.Example:
-
-
subaccount: To initiate a subaccount operation:
Distinct methods available to subaccount:
- listBank --> list the available bank for creating subaccounts on the system.Example:
-
plan: To initiate a plan operation:
Plan operation contains all the basic methods (create,fetch,fetchAll,update);
-
page: To initiate a page operation:
Distinct methods available to page:
- checkAvailability --> check the availability of a particular slug.Example:
-
settlement: To initiate a settlement operation:
Distinct methods available to settlement:
- fetchAll --> fetch all settlements.Example:
The follwing methods are also available:
-
fetchAll: The fetchall (list) method is available for all operations.Example:
-
create: The create method is available for customer, subscription, subaccount, page and plan operations.Example:
-
fetch --> The fetch method is available to all operations except settlement.Example:
- update --> The update method is available for customer, subaccount, page and plan operations.Example:
Handling Events
The component also supports event handling before and after every request. You can read more on YII2 EVENTS [HERE] (http://www.yiiframework.com/doc-2.0/guide-concept-events.html). You can set the event handler by configuring the property beforeSend - (event before sending the request) and the afterSend - (event after sending the request). The event handlers can be set for all operations or for specific operations; event handlers set for specific operations overwrites the one set for all operations. Example:
Using the Paystack Inline Payment Widget
To use the widget, call the widget from your view and set the widget parameters, example: