Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/musheabdulhakim/paystack
Paystack API Library For PHP and Laravel applications.
https://github.com/musheabdulhakim/paystack
payment-gateway paystack paystack-api paystack-library paystack-sdk php php8 sdk
Last synced: about 1 month ago
JSON representation
Paystack API Library For PHP and Laravel applications.
- Host: GitHub
- URL: https://github.com/musheabdulhakim/paystack
- Owner: MusheAbdulHakim
- License: mit
- Created: 2023-01-06T05:21:55.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-06T02:40:11.000Z (7 months ago)
- Last Synced: 2024-10-12T11:28:53.839Z (2 months ago)
- Topics: payment-gateway, paystack, paystack-api, paystack-library, paystack-sdk, php, php8, sdk
- Language: PHP
- Homepage:
- Size: 179 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Paystack
[![Latest Stable Version](https://poser.pugx.org/musheabdulhakim/paystack/v/stable)](https://packagist.org/packages/musheabdulhakim/paystack)
[![License](https://poser.pugx.org/musheabdulhakim/paystack/license)](https://packagist.org/packages/nextpack/nextpack)**Paystack** is a PHP & Laravel package, that makes working with [Paystack](https://paystack.com) api a breeze.
> Laravel and Core PHP supported library for Paystack
- Customers
- Transactions
- Transaction Split
- Terminal
- Misc
1. ### Using Composer
-
```php
composer require musheabdulhakim/paystack
```
-
``` php
require_once __DIR__ . "/vendor/autoload.php";
```
2. ### Manual
- Download the archive
- Extract into your project
- Run composer
```php
composer install
```
- And lastly
``` php
require_once __DIR__ . "/vendor/autoload.php";
```3. ### Clone the repository
```php
git clone https://github.com/MusheAbdulHakim/Paystack.git
``````php
composer install
`````` php
require_once __DIR__ . "/vendor/autoload.php";
```
## Usage## Initialize Paystack
1. Using ``.env`` file, set the values of your keys
```php
SECRET_KEY = "sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
PUBLIC_KEY = "pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
MERCHANT_EMAIL = "[email protected]"
``````php
'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'PUBLIC_KEY' => 'pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'MERCHANT_EMAIL' => '[email protected]'
]);
```
### Transaction### [Initialize Transaction](https://paystack.com/docs/api/transaction/#initialize)
```
$transaction = $paystack->transaction(
$email,
$amount,
[
// optional parameters
]
);//or
$transaction = $paystack->transaction('[email protected]','1000');
//or
$transaction = $paystack->transaction('[email protected]','1000',[
// optional parameters
]);//or
$paystack->transaction->init(
$email,
$amount,
[
// optional parameters
]
);//or
$params = [
'email' => "[email protected]",
'amount' => "20000",
'split_code' => 'SPL_98WF13Eb3w'
];
$paystack->transaction->initialize($params);
```### [Verify Transaction](https://paystack.com/docs/api/transaction/#verify)
```
$transaction = $paystack->transaction->verify('1vl0abs51p');
$transaction = $paystack->transaction()->verify('1vs0ars51p');//check the status of the transaction
$transaction_status = $paystack->transaction->verify('1vl0abs51p')["status"];
```### [List Transaction](https://paystack.com/docs/api/transaction/#list)
```
$transactions = $paystack->transaction->list();
//or
$transaction = $paystack->transaction()->list();//pass optional parameters to the list method
$params = [
'page' => '',
'customer' => '',
'terminalid' => ''
];
$transactions = $paystack->transaction->list($params);
```### [Fetch Transaction](https://paystack.com/docs/api/transaction/#fetch)
```
$transaction = $paystack->transaction->fetch(2745284445);
//or
$transaction = $paystack->transaction()->fetch(2745284445);```
### [Charge Authorization](https://paystack.com/docs/api/transaction/#charge-authorization)
```
$params = [
//optional parameters
];
$transaction = $paystack->transaction->chargeAuth('[email protected]','10000','AUTH_ir6emhfrpk',$params);```
### [View Transaction Timeline](https://paystack.com/docs/api/transaction/#view-timeline)
```
$transaction_timeline = $paystack->transaction->timeline('1vl0abs51p');
```
### [Transaction Totals](https://paystack.com/docs/api/transaction/#totals)
```
$params = [
// Your query parameters
];$transation_total = $paystack->transaction->total($params);
```
### [Export Transactions](https://paystack.com/docs/api/transaction/#export)
```
$params = [
// Your query parameters
];$export = $paystack->transaction->export($params);
```
### [Partial Debit](https://paystack.com/docs/api/transaction/#partial-debit)
```
$params = [
// Your query parameters
];$trans = $paystack->transaction->partialDebit($authorization_code, $currency, $amount, $email, $params);
```
## Customization
1. You can override the Client class and use your own http client## Test
To run the tests, run the following command from the project folder.
``` bash
./vendor/bin/phpunit
```## License
The MIT License (MIT). See the [License File](https://github.com/MusheAbdulHakim/Paystack/blob/master/LICENSE) for more information.