elite/strowallet-sdk

A simple SDK for making payments and creating USD virtual cards via the Strowallet API.

v1.1.0 2025-04-29 12:25 UTC

This package is auto-updated.

Last update: 2025-05-29 13:07:32 UTC


README

Packagist Version Packagist License License: MIT GitHub Issues

A clean and developer-friendly Laravel SDK for interacting with Strowallet, supporting virtual cards, wallet transfers, and bank transactions with ease.

๐Ÿ“š Table of Contents

โœจ Features

  • ๐Ÿ” Virtual card issuance and management
  • ๐Ÿ’ธ Wallet-to-wallet transfers
  • ๐Ÿฆ Bank verification and transfers
  • โš™๏ธ Simple Laravel service-based architecture
  • โœ… Built-in request validation and error handling
  • ๐Ÿ“˜ Clean, readable, and extendable codebase

๐Ÿ“ฆ Installation

Install via Composer:

composer require elite/strowallet-sdk

โš™๏ธ Configuration

Add the following to your .env file:

STROWALLET_BASE_URL=https://strowallet.com/api
STROWALLET_API_KEY=your_pub_key_here

๐Ÿš€ Usage

You can access services in two ways:

โœ… Via Facade (Recommended)

use Elite\StrowalletLaravel\Facades\Strowallet as StrowalletFacade;

// Get list of banks
$banks = StrowalletFacade::bank()->getBankList();

// Perform bank transfer
$response = StrowalletFacade::bank()->bankTransfer(
    amount: '50000',
    bankCode: '058',
    accountNumber: '0123456789',
    narration: 'Transfer for invoice',
    nameEnquiryRef: 'ref123456',
    senderName: 'Elite Corp'
);

โœ… Via Dependency Injection

use Elite\StrowalletLaravel\Strowallet;

class WalletController extends Controller
{
    public function showBalance(Strowallet $strowallet)
    {
        $balance = $strowallet->wallet()->getWalletBalance();
        return response()->json($balance);
    }
}

Card Service

$strowallet->card()->createCardUser([
    'firstName' => 'John',
    'lastName' => 'Doe',
    // ... additional fields
]);

$strowallet->card()->createCard([
    'name_on_card' => 'John Doe',
    'card_type' => 'visa',
    'amount' => '100.00',
    'customerEmail' => 'john@example.com'
]);

Available Card Methods

  • createCardUser(array $data)
  • updateCardHolder(array $data)
  • getCardHolder(string $customerEmail)
  • createCard(array $data)
  • fundCard(array $data)
  • getCardDetails(string $cardId)
  • cardAction(string $cardId, string $action) โ€” freeze/unfreeze
  • withdrawCard(array $data)
  • getCardTransactions(string $cardId)
  • createGiftCard(array $data)

Wallet Service

$strowallet->wallet()->transfer(
    amount: '100.00',
    currency: 'USD',
    receiver: 'recipient@example.com',
    note: 'Payment for services'
);

Bank Service

// Fetch list of supported banks
$banks = $strowallet->bank()->getBankList();

// Verify bank account
$account = $strowallet->bank()->getBankName(
    bankCode: '000013',
    accountNumber: '0123456789'
);

// Initiate transfer
$transfer = $strowallet->bank()->bankTransfer(
    amount: '5000.00',
    bankCode: '058',
    accountNumber: '0123456789',
    narration: 'Salary payment',
    nameEnquiryRef: 'REF123456'
);

๐Ÿ’ก Examples

Full Virtual Card Flow

// Step 1: Create user
$user = $strowallet->card()->createCardUser([
    'firstName' => 'John',
    'lastName' => 'Doe',
    // required fields...
]);

// Step 2: Create virtual card
$card = $strowallet->card()->createCard([
    'name_on_card' => 'John Doe',
    'card_type' => 'visa',
    'amount' => '100.00',
    'customerEmail' => 'john@example.com'
]);

// Step 3: Fund card
$fund = $strowallet->card()->fundCard([
    'card_id' => $card['id'],
    'amount' => '50.00'
]);

๐Ÿงน Extending

You can easily add custom methods to the SDK:

public function newMethod(array $data): Collection
{
    return $this->client->post('/new-endpoint', $data);
}

Just define your method in the appropriate service class (CardService, WalletService, etc.).

๐Ÿงช Testing

Coming soon. The test suite will be available to ensure SDK stability and easy contribution.

In the meantime, you can run:

composer test

๐Ÿ“„ License

This package is open-source software licensed under the MIT license.

๐Ÿค Contributing

We welcome all contributions!
Please read our CONTRIBUTING.md for guidelines on submitting issues, feature requests, and pull requests.

๐Ÿ™Œ Credits