Notch Pay Laravel SDK
The Notch Pay Laravel SDK provides a convenient way to integrate Notch Pay into your Laravel applications with native Laravel features like facades, config files, and Blade components.
Installation
Configuration
Publish the Configuration
config/notchpay.php file in your application.
Set Your API Keys
Add your Notch Pay API keys to your.env file:
Basic Usage
Using the Facade
Using the Helper Function
The SDK also provides a helper function for quick access:Blade Components
The SDK provides Blade components for easy integration in your views:Payment Button Component
Inline Checkout Component
Webhook Handling
Register the Route
Add the webhook route to yourroutes/api.php file:
Create a Webhook Controller
Using Event Listeners
You can also use Laravel’s event system to handle webhooks:- Register the events in your
EventServiceProvider:
- Create the event listeners:
Complete Example
Routes
Controller
Views
Advanced Features
Custom Middleware
The SDK provides middleware for webhook verification, but you can also create your own middleware:Using with Laravel Cashier
If you’re using Laravel Cashier for subscription billing, you can integrate Notch Pay as an additional payment provider:API Reference
The Laravel SDK provides access to all Notch Pay API endpoints through the facade:Payments
NotchPay::payments()->create($data)- Create a paymentNotchPay::payments()->retrieve($reference)- Retrieve a paymentNotchPay::payments()->list($params)- List paymentsNotchPay::payments()->cancel($reference)- Cancel a payment
Transfers
NotchPay::transfers()->create($data)- Create a transferNotchPay::transfers()->retrieve($reference)- Retrieve a transferNotchPay::transfers()->list($params)- List transfersNotchPay::transfers()->cancel($reference)- Cancel a transferNotchPay::transfers()->createBulk($data)- Create a bulk transfer
Customers
NotchPay::customers()->create($data)- Create a customerNotchPay::customers()->retrieve($id)- Retrieve a customerNotchPay::customers()->update($id, $data)- Update a customerNotchPay::customers()->list($params)- List customersNotchPay::customers()->delete($id)- Delete a customer
Beneficiaries
NotchPay::beneficiaries()->create($data)- Create a beneficiaryNotchPay::beneficiaries()->retrieve($id)- Retrieve a beneficiaryNotchPay::beneficiaries()->update($id, $data)- Update a beneficiaryNotchPay::beneficiaries()->list($params)- List beneficiariesNotchPay::beneficiaries()->delete($id)- Delete a beneficiary
Balance
NotchPay::balance()->retrieve()- Check balanceNotchPay::balance()->retrieveCurrency($currency)- Check balance for a specific currencyNotchPay::balance()->history($params)- List balance history
Webhooks
NotchPay::webhooks()->create($data)- Create a webhookNotchPay::webhooks()->retrieve($id)- Retrieve a webhookNotchPay::webhooks()->update($id, $data)- Update a webhookNotchPay::webhooks()->list($params)- List webhooksNotchPay::webhooks()->delete($id)- Delete a webhook
Related Resources
API Reference
Complete API documentation
PHP SDK
Base PHP SDK documentation
Webhooks
Learn about webhooks