A Laravel Package for Hubtel payment integration for laravel 11 and above

Installs: 115

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/hellofromsteve/hubtel

v1.1.0 2025-12-24 02:43 UTC

This package is auto-updated.

Last update: 2025-12-24 12:49:06 UTC


README

A simple Laravel package for integrating Hubtel payments into your Laravel 11 and Above application.

Installation

composer require hellofromsteve/hubtel

Configuration

Publish the configuration file:

php artisan vendor:publish --tag=hubtel-config

Add your hubtel credentials to your .env file:

HUBTEL_API_KEY=************
HUBTEL_API_SECRET=****************
HUBTEL_MERCHANT_ACCOUNT_ID=**************

# Local Testing Callback
LOCAL_HUBTEL_CALLBACK_URL="(you can use webhook.site to get a url for local testing)"

#Recommended
HUBTEL_CALLBACK_URL="${APP_URL}/payment/callback"
HUBTEL_RETURN_URL="${APP_URL}/payment/return"
HUBTEL_CANCELLED_URL="${APP_URL}/payment/cancel"

You can set the endpoints in the config after publishing there

Usage

Using the Helper Function

// Or use helper function and chain methods directly
hubtel()


$transaction = hubtel()->initialize([
   'totalAmount' => 100,
   'description' => 'payment for service',

]);

// These defaults are set in the initialize() method and then merged to your $payload

// The can be overwritten

 $defaults = [
            'callbackUrl'           => config('hubtel.callback_url'),
            'returnUrl'             => config('hubtel.return_url'),
            'cancellationUrl'       => config('hubtel.cancelled_url'),
            'merchantAccountNumber' => config('hubtel.merchant_account_number'),
            'clientReference'       => (string) \Illuminate\Support\Str::uuid(),
        ];

## Available Methods

- `initialize(array $finalPayload)` - Initiate a payment
- `status(array $payload)` - Get transaction status


## More Methods
More methods will be updated soon



## License

MIT