This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
You can install the package via composer:
composer require busha/busha-pay-laravel
##Configuration You can publish the configuration file via this command
php artisan vendor:publish --provider="Busha\BushaPay\BushaPayServiceProvider"
In your .env file and add your api key, api version and api url, see example below:
BUSHAPAY_API_KEY=xxxxxxxxxxxxx
BUSHAPAY_API_VERSION=2019-06-30
BUSHAPAY_API_URL=https://api.pay.busha.co
To list all charges https://docs.api.pay.busha.co/#list-charges
BushaPay::listCharge()->getData();
// To list with pagination and limit
$page = 2;
$limit = 20
BushaPay::listCharge($page, $limit)->getData();
// Pass in the Charge Id or Charge Code
BushaPay::showCharge($charge)->getData();
$charge = BushaPay::createCharge($data); // Returns a Charge Response
// Interacting with the response
$charge->getAddresses(); // Returns addresses
$charge->getPricing(); // Returns pricing
$charge->getChargeId(); // Returns id
$charge->getChargeCode(); //Returns code
// To redirect to host payment page
$charge->redirectNow();
BushaPay::cancelCharge($id);
BushaPay::resolveCharge($id);
Busha Pay can notify your application of a variety of events via webhooks. To handle this webhooks, define a route that points to a controller which extends this package webhook controller. This controller will handle all incoming webhook requests and dispatch them to the proper controller method:
Route::post(
'bushapay/webhook',
'WebhookController@handleWebhook'
);
class WebhookController extends BushaPayWebhookController
{
public handleChargeCreate($data)
{
// Logic to handle charge created
}
public handleChargeFailed($data)
{
// Logic to handle charge failure
}
}
Once you have registered your route, be sure to configure the webhook URL in your Paystack dashboard settings.
By default, this controller will automatically handle cancelling subscriptions that have too many failed charges (as defined by your paystack settings), charge success, transfer success or fail, invoice updates and subscription changes; however, as we'll soon discover, you can extend this controller to handle any webhook event you like.
Make sure you protect incoming requests with Cashier's included webhook signature verification middleware.
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.