https://github.com/stephenjude/paystack-lite
Fastest Way To Setup Paystack Checkout Form In Your Laravel Application
https://github.com/stephenjude/paystack-lite
checkout checkout-form laravel payment payment-integration paystack paystack-lite
Last synced: 13 days ago
JSON representation
Fastest Way To Setup Paystack Checkout Form In Your Laravel Application
- Host: GitHub
- URL: https://github.com/stephenjude/paystack-lite
- Owner: stephenjude
- License: mit
- Archived: true
- Created: 2019-07-10T15:15:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-22T16:55:21.000Z (almost 4 years ago)
- Last Synced: 2025-10-18T05:47:39.849Z (3 months ago)
- Topics: checkout, checkout-form, laravel, payment, payment-integration, paystack, paystack-lite
- Language: PHP
- Homepage: http://stephenjude.me/articles/paystacklite-fastest-way-to-setup-paystack-checkout-form-in-your-laravel-application
- Size: 45.9 KB
- Stars: 22
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Paystack Lite - Use Paystack Checkout Form on the go.
Paystack Lite creates a blade directive you can include in your views. This is the easiest integration of paystack checkout form for Laravel applications.
## Installation
1. Install PaystackLite with composer
```bash
composer require stephenjude/paystack-lite
```
2. if you are using Laravel less than 5.4 Add `Stephenjude\PaystackLite\PaystackLiteServiceProvider::class` to the `providers` array in your `config/app.php`.
3. Open your .env file and add your public key, secret key, customer default email and payment url like so:
```
PAYSTACK_PUBLIC_KEY=xxxxxxxxxxxxx
PAYSTACK_SECRET_KEY=xxxxxxxxxxxxx
```
## Usage
Paystack-lite make use of blade directive to abstract away all javascript configurations for setting up paystack checkout forms.
### Paystack Popup Example
Include the Blade Directive (`@paystack`) somewhere in your template before your main application JavaScript is loaded.
The `@paystack` blade directive creates `payWithPaystack(amount, email, meta, onPaymentCompleted, onPaymentCancelled)` JavaScript helper which takes five parameters. the amount, customer email, meta data, callback for payment completed and callback when checkout form is closed.
```js
var amount = 1000;
var email = 'customer@email.com';
var meta = { /* optional meta data array */ };
document.getElementById('paymentBtn').onclick = function() {
//display checkout form
payWithPaystack(amount, email, meta, onPaymentCompleted, onPaymentCancelled);
};
function onPaymentCompleted(response) {
alert('payment completed!');
console.log(resposne);
}
function onPaymentCancelled() {
alert('payment cancelled!');
}
```
### Paystack Emebeded Example
Include the paystack embeded blade directive inside of your html container
```html
@paystackEmbeded(1000, 'onPaymentCompleted', 'customer@email.com')
```
Add your javascript callback function
```js
function onPaymentCompleted(response) {
alert('payment completed!');
console.log(resposne);
}
```
## Paystack Fluent APIs
This package makes use of [bosunski/lpaystack](https://github.com/bosunski/lpaystack) package. So you can use all [paystack fluent APIs](https://paystack-client.herokuapp.com/#/api/supported) provided in the package.
### Usage
```php
use Stephenjude\PaystackLite\Facades\PaystackLite;
/**
* This gets all your transactions
*/
PaystackLite::api()->transactions()->list();
/**
* This verifies a transaction with transaction reference passed as parameter
*/
PaystackLite::api()->transactions()->verify($ref);
/**
* This gets all your paystack customers.
*/
PaystackLite::api()->customers()->list();
/**
* This gets all the plans that you have registered on Paystack
*/
PaystackLite::api()->plans()->list();
```
See the supported Paystack APIs [here](https://paystack-client.herokuapp.com/#/api/supported).
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
### Security
If you discover any security related issues, please email stephen@ahoba.org.ng instead of using the issue tracker.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.