Skip to main content

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

This will create a 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 your routes/api.php file:
Or, if you want to use your own controller:

Create a Webhook Controller

Using Event Listeners

You can also use Laravel’s event system to handle webhooks:
  1. Register the events in your EventServiceProvider:
  1. 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 payment
  • NotchPay::payments()->retrieve($reference) - Retrieve a payment
  • NotchPay::payments()->list($params) - List payments
  • NotchPay::payments()->cancel($reference) - Cancel a payment

Transfers

  • NotchPay::transfers()->create($data) - Create a transfer
  • NotchPay::transfers()->retrieve($reference) - Retrieve a transfer
  • NotchPay::transfers()->list($params) - List transfers
  • NotchPay::transfers()->cancel($reference) - Cancel a transfer
  • NotchPay::transfers()->createBulk($data) - Create a bulk transfer

Customers

  • NotchPay::customers()->create($data) - Create a customer
  • NotchPay::customers()->retrieve($id) - Retrieve a customer
  • NotchPay::customers()->update($id, $data) - Update a customer
  • NotchPay::customers()->list($params) - List customers
  • NotchPay::customers()->delete($id) - Delete a customer

Beneficiaries

  • NotchPay::beneficiaries()->create($data) - Create a beneficiary
  • NotchPay::beneficiaries()->retrieve($id) - Retrieve a beneficiary
  • NotchPay::beneficiaries()->update($id, $data) - Update a beneficiary
  • NotchPay::beneficiaries()->list($params) - List beneficiaries
  • NotchPay::beneficiaries()->delete($id) - Delete a beneficiary

Balance

  • NotchPay::balance()->retrieve() - Check balance
  • NotchPay::balance()->retrieveCurrency($currency) - Check balance for a specific currency
  • NotchPay::balance()->history($params) - List balance history

Webhooks

  • NotchPay::webhooks()->create($data) - Create a webhook
  • NotchPay::webhooks()->retrieve($id) - Retrieve a webhook
  • NotchPay::webhooks()->update($id, $data) - Update a webhook
  • NotchPay::webhooks()->list($params) - List webhooks
  • NotchPay::webhooks()->delete($id) - Delete a webhook

API Reference

Complete API documentation

PHP SDK

Base PHP SDK documentation

Webhooks

Learn about webhooks