PHPackages                             stephenjude/providus-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. stephenjude/providus-sdk

AbandonedArchivedLibrary[API Development](/categories/api)

stephenjude/providus-sdk
========================

Laravel SDK for Providus Bank collection APIs

2.0.1(1y ago)1144MITPHPPHP ^8.1|^8.2|^8.3CI passing

Since Feb 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/stephenjude/providus-sdk)[ Packagist](https://packagist.org/packages/stephenjude/providus-sdk)[ Docs](https://github.com/stephenjude/providus-sdk)[ RSS](/packages/stephenjude-providus-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (12)Used By (0)

Laravel SDK for Providus Bank APIs
==================================

[](#laravel-sdk-for-providus-bank-apis)

[![Latest Version on Packagist](https://camo.githubusercontent.com/884ff3270e45a2307c01ac4f92b6e7f27b2b86ea7fa75f7366e292b6c9581848/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374657068656e6a7564652f70726f76696475732d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stephenjude/providus-sdk)[![GitHub Tests Action Status](https://camo.githubusercontent.com/99fb4218bf00f9054d02fd7c624b942ba82d35cecb7b1d1ff49a9ca91948f1ca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374657068656e6a7564652f70726f76696475732d73646b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/stephenjude/providus-sdk/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f94b6f8de4029f9f9d7dadedaf6c61c9c595ce491a407ed8bb10017cfe332c29/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374657068656e6a7564652f70726f76696475732d73646b2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/stephenjude/providus-sdk/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c559b639b77c18ee1fbecff13b484cbe3ef69d653a9859229834ef64cbefab66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374657068656e6a7564652f70726f76696475732d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stephenjude/providus-sdk)

Laravel SDK for Providus Bank collection APIs

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require stephenjude/providus-sdk
```

You can publish the config file with:

```
php artisan vendor:publish --tag="providus-sdk-config"
```

This is the contents of the published config file:

```
return [
    'id' => env('PROVIDUS_ID'),

    'secret' => env('PROVIDUS_SECRET'),

    'base_url' => env('PROVIDUS_BASE_URL', 'http://154.113.16.142:8088/AppDevAPI/api/'),

    /**
     * Set SDK to demo mode. This mode makes use of the demo signature provided by Providus bank.
     */
    'demo_mode' => env('PROVIDUS_DEMO', false),

    /**
     * Auth signature used for demo requests
     */
    'demo_signature' => 'BE09BEE831CF262226B426E39BD1092AF84DC63076D4174FAC78A2261F9A3D6E59744983B8326B69CDF2963FE314DFC89635CFA37A40596508DD6EAAB09402C7',

    'webhook' => [
        /**
         * This secret is used to verify that the payload has not been tampered with.
         */
        'signing_secret' => env('PROVIDUS_SECRET'),

        /**
         * The name of the header containing the signature.
         */
        'signature_header_name' => 'X-Auth-Signature',

        /**
         * This class will verify that the content of the signature header is valid.
         * It should implement \Providus\Providus\SignatureValidator\SignatureValidator
         */
        'signature_validator' => \Providus\Providus\SignatureValidator\DefaultSignatureValidator::class,

        /**
         * The classname of the controller to be used to process the webhook.
         * This should be set to a class that extends \Providus\Providus\Http\Controllers\WebhookController::class
         */
        'controller' => \Providus\Providus\Http\Controllers\WebhookController::class,

        /**
         * The route path that maps the webhook request to the webhook controller.
         */
        'path' => '/internals/webhook/providus/events',
    ],
];
```

Usage
-----

[](#usage)

Initiailize the Providus API

```
$bank = new \Providus\Providus\Providus();

$bank->verifyTransactionBySessionId(SETTLEMENT_ID);

//Or use Facade
use \Providus\Providus\Facades\Providus;

Providus::verifyTransactionBySessionId(SETTLEMENT_ID);
```

### Creating dynamic account number:

[](#creating-dynamic-account-number)

```
$accountDetails = $bank->createDynamicAccountNumber('customer_name');
$accountDetails->accountName;
$accountDetails->accountNumber;
```

### Creating reserved account number:

[](#creating-reserved-account-number)

```
$accountDetails =  $bank->createReservedAccountNumber('customer_name', 'customer_bvn');
$accountDetails->accountName;
$accountDetails->accountNumber;
$accountDetails->bvn;
```

### Updating account name:

[](#updating-account-name)

```
$accountDetails = $bank->updateAccountName('customer_updated_name', 'customer_account_number');
$accountDetails->accountName;
$accountDetails->accountNumber;
```

### Blacklisting account number:

[](#blacklisting-account-number)

```
$bank->blacklistAccountNumber('customer_account_number');
```

### Verifying transaction using session or settlement ID:

[](#verifying-transaction-using-session-or-settlement-id)

```
$transaction = $bank->verifyTransactionBySessionId('session_id');

$transaction =  $bank->verifyTransactionBySettlementId('settlement_id');

$transaction->sessionId;
$transaction->settlementId;
$transaction->accountNumber;
$transaction->currency;
$transaction->transactionAmount;
$transaction->transactionReference;
$transaction->transactionDate;
$transaction->feeAmount;
$transaction->settledAmount;
$transaction->sourceAccountNumber;
$transaction->sourceAccountNumber;
$transaction->sourceBankName;
$transaction->remarks;
$transaction->channelId;
```

### Webbhook Controller

[](#webbhook-controller)

You have to create a controller class that extends the base webhook controller that comes with this package. Update the providus config file to use your own defined controller.

```
   /**
     * The classname of the controller to be used to process the webhook.
     * This should be set to a class that extends \Providus\Providus\Http\Controllers\WebhookController::class
     */
    'controller' => App\Http\Controllers\ProvidusWebhookController::class,
```

Update your controller like this to return the valid responses to providus for successful and duplicate responses. This package handles rejected response for you.

```
