PitchHut logo
laravel-cashier-paystack
Streamline your subscriptions with Laravel Cashier for Paystack.
Pitch

Laravel Cashier Paystack simplifies subscription management for developers. With a fluent interface, it handles the complexity of integrating Paystack's billing services, allowing you to focus on building your application. Streamline your payment processes and enhance user experience with minimal hassle.

Description

Laravel Cashier Paystack

Laravel Cashier Paystack provides a fluid and intuitive interface for integrating Paystack's subscription billing services into your Laravel applications. This powerful package simplifies the process by handling most of the tedious subscription billing code, allowing developers to focus on building their projects without getting bogged down by payment processes.

Key Features

  • Expressive Interface: A user-friendly interface that makes managing subscriptions and payments seamless.
  • Easy Configuration: Begin by integrating the package with a simple Composer command:
    composer require veekthoven/laravel-cashier-paystack
    
  • Flexible Currency Handling: By default, the package prioritizes Nigeria Naira (NGN) for transactions but allows you to set different currencies based on your needs.
  • Subscription Management: Effortlessly create, check, and cancel subscriptions using concise methods like newSubscription, subscribed, and cancel.
  • Webhook Integration: Simplify the handling of various Paystack events (like subscription cancellations or charge successes) through built-in webhook support, ensuring your application remains responsive and up-to-date.

Getting Started

Configuration

To start using Laravel Cashier Paystack, publish your configuration file which includes essential parameters such as your Paystack public and secret keys, merchant details, and the user model for customers. Here’s how you can publish the configuration file:

php artisan vendor:publish --provider="veekthoven\Cashier\CashierServiceProvider"

Subscriptions

You can create a subscription with just a few lines of code. Here’s a quick example:

$user = User::find(1);
$plan_name = 'default';
$plan_code = 'PLN_gx2wn530m0i3w3m';  
$auth_token = 'customer_auth_token';  
$user->newSubscription($plan_name, $plan_code)->create($auth_token);

Payment Handling

For one-off payments, the package provides a straightforward charging method:

$user->charge(10000); // charges in lowest currency denomination

You can also generate invoices or handle refunds with ease.

Customer Management

Creating and managing customer details is also part of the package's strengths. It includes methods like createAsCustomer() to register new customers directly within Paystack without initiating a subscription right away.

By utilizing Laravel Cashier Paystack, developers can implement robust subscription management features while leveraging Paystack's functionalities, providing users with a smooth and responsive billing experience.

0 comments

No comments yet.

Sign in to be the first to comment.