定制 elite/strowallet-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elite/strowallet-sdk

最新稳定版本:v1.1.0

Composer 安装命令:

composer require elite/strowallet-sdk

包简介

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

README 文档

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

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-29