PHP code example of matscode / paystack-laravel-sdk
1. Go to this page and download the library: Download matscode/paystack-laravel-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
matscode / paystack-laravel-sdk example snippets
// Using the Facade
Paystack::transaction()->initialize([
'email' => '[email protected]',
'amount' => 500000, // amount in kobo
'callback_url' => 'https://yourapp.com/paystack/transaction/verify',
]);
// Using the helper
paystack()->transaction->initialize([
'email' => '[email protected]',
'amount' => 500000, // amount in kobo
'callback_url' => 'https://yourapp.com/paystack/transaction/verify',
]);
// Using the Facade
Paystack::transaction()->list();
// Using the helper
paystack()->transaction->list();
// Using the Facade
$verification = Paystack::transaction()->verify($reference);
// Using the helper
$verification = paystack()->transaction->verify($reference);
// Using the Facade
$isSuccessful = Paystack::transaction()->isSuccessful($reference); // returns true/false
// Using the helper
$isSuccessful = paystack()->transaction->isSuccessful($reference);
use Paystack; // Make sure the facade is properly registered
// ... inside your controller or service
$response = Paystack::transaction()
->setCallbackUrl('https://yourapp.com/paystack/verify')
->setEmail('[email protected]')
->setAmount(75000) // amount in Naira
->initialize();
$authorizationUrl = $response->data->authorization_url;
// Using the helper
$response = paystack()->transaction
->setCallbackUrl('https://yourapp.com/paystack/verify')
->setEmail('[email protected]')
->setAmount(75000)
->initialize();
$authorizationUrl = $response->data->authorization_url;
// Using the Facade
$response = Paystack::transaction()->initialize([
'email' => '[email protected]',
'amount' => 500000, // amount in kobo
'callback_url' => 'https://yourapp.com/paystack/verify',
]);
$authorizationUrl = $response['data']['authorization_url'];
// Using the helper
$response = paystack()->transaction->initialize([
'email' => '[email protected]',
'amount' => 500000, // amount in kobo
'callback_url' => 'https://yourapp.com/paystack/verify',
]);
$authorizationUrl = $response['data']['authorization_url'];
// Using the Facade
Paystack::bank()->list();
// Using the helper
paystack()->bank->list();
// Using the Facade
$account = Paystack::bank()->resolve($bankCode, $accountNumber);
// Using the helper
$account = paystack()->bank->resolve($bankCode, $accountNumber);