PHPackages                             blaaiz/blaaiz-laravel-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. blaaiz/blaaiz-laravel-sdk

ActiveLibrary[API Development](/categories/api)

blaaiz/blaaiz-laravel-sdk
=========================

Official Laravel SDK for Blaaiz RaaS (Remittance as a Service) API

v1.0.5(2mo ago)0328↓41.2%[5 PRs](https://github.com/Blaaiz/blaaiz-laravel-sdk/pulls)MITPHPPHP ^8.1CI passing

Since Jul 21Pushed 1mo agoCompare

[ Source](https://github.com/Blaaiz/blaaiz-laravel-sdk)[ Packagist](https://packagist.org/packages/blaaiz/blaaiz-laravel-sdk)[ Docs](https://docs.business.blaaiz.com)[ RSS](/packages/blaaiz-blaaiz-laravel-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (14)Versions (13)Used By (0)

Blaaiz Laravel SDK
==================

[](#blaaiz-laravel-sdk)

A comprehensive Laravel SDK for the Blaaiz RaaS (Remittance as a Service) API. This SDK provides easy-to-use methods for payment processing, collections, payouts, customer management, and more.

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

[](#installation)

```
composer require blaaiz/blaaiz-laravel-sdk
```

Quick Start
-----------

[](#quick-start)

```
// Add to your .env file
BLAAIZ_API_KEY=your-api-key-here
BLAAIZ_BASE_URL=https://api-dev.blaaiz.com  // For development
// BLAAIZ_BASE_URL=https://api.blaaiz.com  // For production

// Publish configuration (optional)
php artisan vendor:publish --tag=blaaiz-config

// Test the connection
use Blaaiz\LaravelSdk\Facades\Blaaiz;

$isConnected = Blaaiz::testConnection();
echo $isConnected ? 'API Connected' : 'Connection Failed';
```

Features
--------

[](#features)

- **Customer Management**: Create, update, and manage customers with KYC verification
- **Collections**: Support for multiple collection methods (Open Banking, Card, Crypto, Bank Transfer)
- **Payouts**: Bank transfers and Interac payouts across multiple currencies
- **Virtual Bank Accounts**: Create and manage virtual accounts for NGN collections
- **Wallets**: Multi-currency wallet management
- **Transactions**: Transaction history and status tracking
- **Webhooks**: Webhook configuration and management with signature verification
- **Files**: Document upload with pre-signed URLs
- **Fees**: Real-time fee calculations and breakdowns
- **Banks &amp; Currencies**: Access to supported banks and currencies
- **Laravel Integration**: Native service provider, facade, and configuration

Supported Currencies &amp; Methods
----------------------------------

[](#supported-currencies--methods)

### Collections

[](#collections)

- **CAD**: Interac (push mechanism)
- **NGN**: Bank Transfer (VBA) and Card Payment
- **USD**: Card Payment
- **EUR/GBP**: Open Banking

### Payouts

[](#payouts)

- **Bank Transfer**: NGN, GBP, EUR
- **Interac**: CAD transactions
- **ACH**: USD transactions
- **Wire**: USD transactions
- **Crypto**: USDT, USDC on multiple networks

API Reference
-------------

[](#api-reference)

### Customer Management

[](#customer-management)

#### Create a Customer

[](#create-a-customer)

```
use Blaaiz\LaravelSdk\Facades\Blaaiz;

$customer = Blaaiz::customers()->create([
    'first_name' => 'John',
    'last_name' => 'Doe',
    'type' => 'individual', // or 'business'
    'email' => 'john.doe@example.com',
    'country' => 'NG',
    'id_type' => 'passport', // drivers_license, passport, id_card, resident_permit
    'id_number' => 'A12345678',
    // 'business_name' => 'Company Name' // Required if type is 'business'
]);

echo 'Customer ID: ' . $customer['data']['data']['id'];
```

#### Get Customer

[](#get-customer)

```
$customer = Blaaiz::customers()->get('customer-id');
echo 'Customer: ' . json_encode($customer['data']);
```

#### List All Customers

[](#list-all-customers)

```
$customers = Blaaiz::customers()->list();
echo 'Customers: ' . json_encode($customers['data']);
```

#### Update Customer

[](#update-customer)

```
$updatedCustomer = Blaaiz::customers()->update('customer-id', [
    'first_name' => 'Jane',
    'email' => 'jane.doe@example.com'
]);
```

#### List Customer Beneficiaries

[](#list-customer-beneficiaries)

```
$beneficiaries = Blaaiz::customers()->listBeneficiaries('customer-id');
echo 'Beneficiaries: ' . json_encode($beneficiaries['data']);
```

#### Get Specific Beneficiary

[](#get-specific-beneficiary)

```
$beneficiary = Blaaiz::customers()->getBeneficiary('customer-id', 'beneficiary-id');
echo 'Beneficiary: ' . json_encode($beneficiary['data']);
```

### File Management &amp; KYC

[](#file-management--kyc)

#### Upload Customer Documents

[](#upload-customer-documents)

**Method 1: Complete File Upload (Recommended)**

```
// Option A: Upload from file path
$result = Blaaiz::customers()->uploadFileComplete('customer-id', [
    'file' => file_get_contents('/path/to/passport.jpg'),
    'file_category' => 'identity', // identity, proof_of_address, liveness_check
    'filename' => 'passport.jpg', // Optional
    'content_type' => 'image/jpeg' // Optional
]);

// Option B: Upload from Base64 string
$result = Blaaiz::customers()->uploadFileComplete('customer-id', [
    'file' => 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
    'file_category' => 'identity'
]);

// Option C: Upload from Data URL (with automatic content type detection)
$result = Blaaiz::customers()->uploadFileComplete('customer-id', [
    'file' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
    'file_category' => 'identity'
]);

// Option D: Upload from Public URL (automatically downloads and uploads)
$result = Blaaiz::customers()->uploadFileComplete('customer-id', [
    'file' => 'https://example.com/documents/passport.jpg',
    'file_category' => 'identity'
]);

echo 'Upload complete: ' . json_encode($result['data']);
echo 'File ID: ' . $result['file_id'];
```

**Method 2: Manual 3-Step Process**

```
// Step 1: Get pre-signed URL
$presignedUrl = Blaaiz::files()->getPresignedUrl([
    'customer_id' => 'customer-id',
    'file_category' => 'identity' // identity, proof_of_address, liveness_check
]);

// Step 2: Upload file to the pre-signed URL (implement your file upload logic)
// Use Guzzle or any HTTP client to upload the file

// Step 3: Associate file with customer
$fileAssociation = Blaaiz::customers()->uploadFiles('customer-id', [
    'id_file' => $presignedUrl['data']['file_id'] // Use the file_id from step 1
]);
```

> **Note**: The `uploadFileComplete` method is recommended as it handles all three steps automatically: getting the pre-signed URL, uploading the file to S3, and associating the file with the customer. It supports multiple file input formats:
>
> - **String path/content**: Direct binary data or file path
> - **Base64 string**: Plain base64 encoded data
> - **Data URL**: Complete data URL with mime type (e.g., `data:image/jpeg;base64,/9j/4AAQ...`)
> - **Public URL**: HTTP/HTTPS URL that will be downloaded automatically (supports redirects, content-type detection, and filename extraction)

### Collections

[](#collections-1)

#### Initiate Open Banking Collection (EUR/GBP)

[](#initiate-open-banking-collection-eurgbp)

```
$collection = Blaaiz::collections()->initiate([
    'customer_id' => 'customer-id',
    'wallet_id' => 'wallet-id',
    'amount' => 100.00,
    'currency' => 'EUR', // EUR, GBP, NGN, USD
    'method' => 'open_banking',
    'phone_number' => '+1234567890', // Optional
    'email' => 'customer@example.com', // Optional
    'reference' => 'your-reference', // Optional
    'narration' => 'Payment description', // Optional
    'redirect_url' => 'https://your-site.com/callback' // Optional
]);

echo 'Payment URL: ' . $collection['data']['url'];
echo 'Transaction ID: ' . $collection['data']['transaction_id'];
```

#### Initiate Card Collection (NGN/USD)

[](#initiate-card-collection-ngnusd)

```
$collection = Blaaiz::collections()->initiate([
    'customer_id' => 'customer-id',
    'wallet_id' => 'wallet-id',
    'amount' => 5000,
    'currency' => 'NGN',
    'method' => 'card'
]);

echo 'Payment URL: ' . $collection['data']['url'];
```

#### Accept Interac Money Request (CAD)

[](#accept-interac-money-request-cad)

```
// With security answer (standard transfer)
$interac = Blaaiz::collections()->acceptInteracMoneyRequest([
    'reference_number' => 'interac-reference',
    'security_answer' => 'answer',
    'email' => 'sender@example.com' // Optional
]);

// Auto deposit (no security answer required)
$interacAutoDeposit = Blaaiz::collections()->acceptInteracMoneyRequest([
    'reference_number' => 'interac-reference'
]);

echo 'Message: ' . $interac['data']['message'];
```

#### Crypto Collection

[](#crypto-collection)

```
// Get available networks
$networks = Blaaiz::collections()->getCryptoNetworks();
echo 'Available networks: ' . json_encode($networks['data']);

// Initiate crypto collection
$cryptoCollection = Blaaiz::collections()->initiateCrypto([
    'amount' => 100,
    'network' => 'ethereum',
    'token' => 'USDT',
    'wallet_id' => 'wallet-id'
]);
```

#### Attach Customer to Collection

[](#attach-customer-to-collection)

```
$attachment = Blaaiz::collections()->attachCustomer([
    'customer_id' => 'customer-id',
    'transaction_id' => 'transaction-id'
]);
```

### Payouts

[](#payouts-1)

#### Bank Transfer Payout (NGN)

[](#bank-transfer-payout-ngn)

```
$payout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'bank_transfer',
    'from_amount' => 1000, // Use from_amount OR to_amount
    'from_currency_id' => 'NGN',
    'to_currency_id' => 'NGN',
    'bank_id' => 'bank-id', // Required for NGN
    'account_number' => '0123456789',
    'phone_number' => '+2348012345678' // Optional
]);

echo 'Payout Status: ' . $payout['data']['transaction']['status'];
```

#### Bank Transfer Payout (GBP)

[](#bank-transfer-payout-gbp)

```
$gbpPayout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'bank_transfer',
    'from_amount' => 100,
    'from_currency_id' => 'GBP',
    'to_currency_id' => 'GBP',
    'sort_code' => '123456',
    'account_number' => '12345678',
    'account_name' => 'John Doe'
]);
```

#### Bank Transfer Payout (EUR)

[](#bank-transfer-payout-eur)

```
$eurPayout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'bank_transfer',
    'from_amount' => 100,
    'from_currency_id' => 'EUR',
    'to_currency_id' => 'EUR',
    'iban' => 'DE89370400440532013000',
    'bic_code' => 'COBADEFFXXX',
    'account_name' => 'John Doe'
]);
```

#### Interac Payout (CAD)

[](#interac-payout-cad)

```
$interacPayout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'interac',
    'from_amount' => 100,
    'from_currency_id' => 'CAD',
    'to_currency_id' => 'CAD',
    'email' => 'recipient@example.com',
    'interac_first_name' => 'John',
    'interac_last_name' => 'Doe'
]);
```

#### ACH Payout (USD)

[](#ach-payout-usd)

```
$achPayout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'ach',
    'from_amount' => 100,
    'from_currency_id' => 'USD',
    'to_currency_id' => 'USD',
    'type' => 'individual', // individual or business
    'account_number' => '123456789',
    'account_name' => 'John Doe',
    'account_type' => 'checking', // checking or savings
    'bank_name' => 'Chase Bank',
    'routing_number' => '021000021'
]);
```

#### Wire Payout (USD)

[](#wire-payout-usd)

```
$wirePayout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'wire',
    'from_amount' => 1000,
    'from_currency_id' => 'USD',
    'to_currency_id' => 'USD',
    'type' => 'individual',
    'account_number' => '123456789',
    'account_name' => 'John Doe',
    'account_type' => 'checking',
    'bank_name' => 'Chase Bank',
    'routing_number' => '021000021',
    'swift_code' => 'CHASUS33'
]);
```

#### Crypto Payout

[](#crypto-payout)

```
$cryptoPayout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'crypto',
    'from_amount' => 100,
    'from_currency_id' => 'USD',
    'to_currency_id' => 'USDT',
    'wallet_address' => '0x1234567890abcdef...',
    'wallet_token' => 'USDT', // USDT or USDC
    'wallet_network' => 'ETHEREUM_MAINNET' // BSC_MAINNET, ETHEREUM_MAINNET, TRON_MAINNET, MATIC_MAINNET
]);
```

#### Using to\_amount Instead of from\_amount

[](#using-to_amount-instead-of-from_amount)

You can specify the exact amount the recipient should receive:

```
$payout = Blaaiz::payouts()->initiate([
    'wallet_id' => 'wallet-id',
    'customer_id' => 'customer-id',
    'method' => 'bank_transfer',
    'to_amount' => 50000, // Recipient gets exactly this amount
    'from_currency_id' => 'USD',
    'to_currency_id' => 'NGN',
    'bank_id' => 'bank-id',
    'account_number' => '0123456789'
]);
```

### Virtual Bank Accounts

[](#virtual-bank-accounts)

#### Create Virtual Bank Account

[](#create-virtual-bank-account)

```
$vba = Blaaiz::virtualBankAccounts()->create([
    'wallet_id' => 'wallet-id',
    'account_name' => 'John Doe'
]);

echo 'Account Number: ' . $vba['data']['account_number'];
echo 'Bank Name: ' . $vba['data']['bank_name'];
```

#### List Virtual Bank Accounts

[](#list-virtual-bank-accounts)

You can optionally filter by `wallet_id`, `customer_id`, or both.

```
// All virtual bank accounts
$vbas = Blaaiz::virtualBankAccounts()->list();

// Filter by wallet
$vbasByWallet = Blaaiz::virtualBankAccounts()->list('wallet-id');

// Filter by customer
$vbasByCustomer = Blaaiz::virtualBankAccounts()->list(null, 'customer-id');

// Filter by both wallet and customer
$vbasByBoth = Blaaiz::virtualBankAccounts()->list('wallet-id', 'customer-id');

echo 'All: ' . json_encode($vbas['data']);
echo 'By Wallet: ' . json_encode($vbasByWallet['data']);
echo 'By Customer: ' . json_encode($vbasByCustomer['data']);
echo 'By Both: ' . json_encode($vbasByBoth['data']);
```

#### Close Virtual Bank Account

[](#close-virtual-bank-account)

```
// Close without reason
$closed = Blaaiz::virtualBankAccounts()->close('vba-id');

// Close with reason
$closed = Blaaiz::virtualBankAccounts()->close('vba-id', 'No longer needed');

echo 'Status: ' . $closed['data']['status'];
```

#### Get Identification Type

[](#get-identification-type)

Retrieve the expected identification type label based on country and customer type. This is useful for determining what identification documents are required for a customer.

```
// Using customer_id (recommended if customer already exists)
$idType = Blaaiz::virtualBankAccounts()->getIdentificationType('customer-id');
echo 'Required ID: ' . $idType['data']['label']; // e.g., "Bank Verification Number"
echo 'Type: ' . $idType['data']['type']; // e.g., "bvn"

// Using country and type (for new customers)
$idType = Blaaiz::virtualBankAccounts()->getIdentificationType(null, 'NG', 'individual');
echo 'Required ID: ' . $idType['data']['label'];
```

### Wallets

[](#wallets)

#### List All Wallets

[](#list-all-wallets)

```
$wallets = Blaaiz::wallets()->list();
echo 'Wallets: ' . json_encode($wallets['data']);
```

#### Get Specific Wallet

[](#get-specific-wallet)

```
$wallet = Blaaiz::wallets()->get('wallet-id');
echo 'Wallet Balance: ' . $wallet['data']['balance'];
```

### Transactions

[](#transactions)

#### List Transactions

[](#list-transactions)

```
$transactions = Blaaiz::transactions()->list([
    'page' => 1,
    'limit' => 10,
    'status' => 'SUCCESSFUL' // Optional filter
]);

echo 'Transactions: ' . json_encode($transactions['data']);
```

#### Get Transaction Details

[](#get-transaction-details)

```
$transaction = Blaaiz::transactions()->get('transaction-id');
echo 'Transaction: ' . json_encode($transaction['data']);
```

### Banks &amp; Currencies

[](#banks--currencies)

#### List Banks

[](#list-banks)

```
$banks = Blaaiz::banks()->list();
echo 'Available Banks: ' . json_encode($banks['data']);
```

#### Bank Account Lookup

[](#bank-account-lookup)

```
$accountInfo = Blaaiz::banks()->lookupAccount([
    'account_number' => '0123456789',
    'bank_id' => '1'
]);

echo 'Account Name: ' . $accountInfo['data']['account_name'];
```

#### List Currencies

[](#list-currencies)

```
$currencies = Blaaiz::currencies()->list();
echo 'Supported Currencies: ' . json_encode($currencies['data']);
```

### Fees

[](#fees)

#### Get Fee Breakdown

[](#get-fee-breakdown)

```
// Using from_amount (calculate what recipient gets)
$feeBreakdown = Blaaiz::fees()->getBreakdown([
    'from_currency_id' => 'NGN',
    'to_currency_id' => 'CAD',
    'from_amount' => 100000
]);

echo 'You send: ' . $feeBreakdown['data']['you_send'];
echo 'Recipient gets: ' . $feeBreakdown['data']['recipient_gets'];
echo 'Total fees: ' . $feeBreakdown['data']['total_fees'];

// Using to_amount (calculate what you need to send)
$feeBreakdown = Blaaiz::fees()->getBreakdown([
    'from_currency_id' => 'USD',
    'to_currency_id' => 'NGN',
    'to_amount' => 50000 // Recipient should get exactly this
]);

echo 'You send: ' . $feeBreakdown['data']['you_send'];
```

### Webhooks

[](#webhooks)

#### Register Webhooks

[](#register-webhooks)

```
$webhook = Blaaiz::webhooks()->register([
    'collection_url' => 'https://your-domain.com/webhooks/collection',
    'payout_url' => 'https://your-domain.com/webhooks/payout'
]);
```

#### Get Webhook Configuration

[](#get-webhook-configuration)

```
$webhookConfig = Blaaiz::webhooks()->get();
echo 'Webhook URLs: ' . json_encode($webhookConfig['data']);
```

#### Replay Webhook

[](#replay-webhook)

```
$replay = Blaaiz::webhooks()->replay([
    'transaction_id' => 'transaction-id'
]);
```

#### Simulate Interac Webhook (Non-Production Only)

[](#simulate-interac-webhook-non-production-only)

```
// For testing Interac webhooks in development/sandbox environment
$simulate = Blaaiz::webhooks()->simulateInteracWebhook([
    'interac_email' => 'sender@example.com'
]);

echo 'Message: ' . $simulate['message'];
```

Advanced Usage
--------------

[](#advanced-usage)

### Complete Payout Workflow

[](#complete-payout-workflow)

```
$completePayoutResult = Blaaiz::createCompletePayout([
    'customer_data' => [
        'first_name' => 'John',
        'last_name' => 'Doe',
        'type' => 'individual',
        'email' => 'john@example.com',
        'country' => 'NG',
        'id_type' => 'passport',
        'id_number' => 'A12345678'
    ],
    'payout_data' => [
        'wallet_id' => 'wallet-id',
        'method' => 'bank_transfer',
        'from_amount' => 1000,
        'from_currency_id' => '1',
        'to_currency_id' => '1',
        'account_number' => '0123456789',
        'bank_id' => '1',
        'phone_number' => '+2348012345678'
    ]
]);

echo 'Customer ID: ' . $completePayoutResult['customer_id'];
echo 'Payout: ' . json_encode($completePayoutResult['payout']);
echo 'Fees: ' . json_encode($completePayoutResult['fees']);
```

### Complete Collection Workflow

[](#complete-collection-workflow)

```
$completeCollectionResult = Blaaiz::createCompleteCollection([
    'customer_data' => [
        'first_name' => 'Jane',
        'last_name' => 'Smith',
        'type' => 'individual',
        'email' => 'jane@example.com',
        'country' => 'NG',
        'id_type' => 'drivers_license',
        'id_number' => 'ABC123456'
    ],
    'collection_data' => [
        'method' => 'card',
        'amount' => 5000,
        'wallet_id' => 'wallet-id'
    ],
    'create_vba' => true // Optionally create a virtual bank account
]);

echo 'Customer ID: ' . $completeCollectionResult['customer_id'];
echo 'Collection: ' . json_encode($completeCollectionResult['collection']);
echo 'Virtual Account: ' . json_encode($completeCollectionResult['virtual_account']);
```

### Using Dependency Injection

[](#using-dependency-injection)

```
