nash81/bsicards-php-sdk
Composer 安装命令:
composer require nash81/bsicards-php-sdk
包简介
PHP SDK for BSICARDS - Card Issuance API
README 文档
README
A comprehensive PHP SDK for integrating with the BSICARDS Card Issuance API. Create and manage Mastercard, Visa, and Digital Wallet cards with ease.
Features
- ✅ MasterCard Issuance - Create and manage MasterCards
- ✅ Visa Card Issuance - Create and manage Visa Cards
- ✅ Digital Wallet Cards - Create and manage Digital Wallet cards
- ✅ Digital Visa Wallet Cards - Virtual Visa cards with GPay/Apple Pay & 3DS auto-approve
- ✅ Card Management - Freeze, unfreeze, change PIN, view transactions
- ✅ Card Funding - Fund cards with minimum $10.00
- ✅ Transaction History - View detailed transaction records
- ✅ Laravel Support - Built-in service provider and configuration
- ✅ Environment Configuration - Secure credential management via .env
- ✅ Type Safe - Full PHP type hints and PHPDoc documentation
- ✅ Error Handling - Custom exceptions for API errors
Requirements
- PHP >= 8.1
- Composer
- GuzzleHTTP 7.0+
Installation
Via Composer
composer require nash81/bsicards-php-sdk:^1.0
This package now publishes stable semantic version tags. The first stable release is v1.0.0, so Composer can resolve it normally without lowering your project's stability settings.
If you prefer, installing without an explicit constraint will also resolve the latest stable release:
composer require nash81/bsicards-php-sdk
Packagist Auto-Update Setup
If Packagist shows "This package is not auto-updated", set up one of the following:
-
GitHub Hook (recommended by Packagist)
- Open your package on Packagist
- Click
Update/Auto Update - Connect your GitHub repository (
nash81/bsicards-php-sdk) - Packagist will create/manage the webhook
-
GitHub Actions fallback (included in this repo)
- Add this GitHub repository secret:
PACKAGIST_TOKEN
- Workflow file:
.github/workflows/packagist-update.yml - This workflow pings Packagist for
https://github.com/nash81/bsicards-php-sdkon push/release
- Add this GitHub repository secret:
Manual Setup
- Clone the repository
- Copy
src/andconfig/directories to your project - Ensure Composer autoload is configured
Configuration
Environment Variables
Create a .env file in your project root:
BSICARDS_PUBLIC_KEY=your_public_key_here BSICARDS_SECRET_KEY=your_secret_key_here
Laravel Setup
For Laravel projects, the service provider is auto-discovered. Add credentials to your .env:
BSICARDS_PUBLIC_KEY=your_public_key BSICARDS_SECRET_KEY=your_secret_key
Optional: Publish configuration file:
php artisan vendor:publish --tag=bsicards-config
Quick Start
Basic Usage
use BSICards\BSICardsClient; use BSICards\APIException; // Initialize client (credentials from .env) $client = new BSICardsClient(); try { // Create a MasterCard $response = $client->mastercardCreateCard( 'user@example.com', 'John Doe', '1234' ); echo "Card created: " . $response['message']; } catch (APIException $e) { echo "Error: " . $e->getMessage(); }
Laravel Usage
use BSICards\BSICardsClient; class CardController extends Controller { public function createCard(BSICardsClient $client) { $response = $client->mastercardCreateCard( request('email'), request('name'), request('pin') ); return response()->json($response); } }
API Methods
MasterCard Operations
// Create a new MasterCard $client->mastercardCreateCard($email, $name, $pin); // Get all MasterCards $client->mastercardGetAllCards($email); // Get pending MasterCards $client->mastercardGetPendingCards($email); // Get specific card details $client->mastercardGetCard($email, $cardId); // Get card transactions $client->mastercardGetTransactions($email, $cardId); // Change card PIN $client->mastercardChangePin($email, $cardId, $newPin); // Freeze card $client->mastercardFreezeCard($email, $cardId); // Unfreeze card $client->mastercardUnfreezeCard($email, $cardId); // Fund card (minimum $10.00) $client->mastercardFundCard($email, $cardId, '50.00');
Visa Card Operations
// Create a new Visa card $client->visaCreateCard( $email, $name, $nationalIdNumber, $nationalIdImageUrl, $userPhotoUrl, '1990-01-15' // DOB ); // Get all Visa cards $client->visaGetAllCards($email); // Get pending Visa cards $client->visaGetPendingCards($email); // Get specific card $client->visaGetCard($email, $cardId); // Get transactions $client->visaGetTransactions($email, $cardId); // Freeze/Unfreeze $client->visaFreezeCard($email, $cardId); $client->visaUnfreezeCard($email, $cardId); // Fund card $client->visaFundCard($email, $cardId, '50.00');
Digital Wallet Operations
// Create virtual card $client->digitalCreateVirtualCard( $email, $firstName, $lastName, '1990-01-15', $address, $postalCode, $city, 'GB', // Country code $state, '44', // Country phone code $phone ); // Get all cards $client->digitalGetAllCards($email); // Get specific card $client->digitalGetCard($email, $cardId); // Fund card $client->digitalFundCard($email, $cardId, $amount); // Freeze/Unfreeze $client->digitalFreezeCard($email, $cardId); $client->digitalUnfreezeCard($email, $cardId); // Check 3DS verification $client->digitalCheck3DS($email); // Approve 3DS transaction $client->digitalApprove3DS($email, $cardId, $eventId); // Terminate card $client->digitalTerminateCard($email, $cardId); // Create add-on card $client->digitalCreateAddonCard($email, $cardId); // Loyalty points $client->digitalGetLoyaltyPoints($email, $cardId); $client->digitalRedeemPoints($email, $cardId);
Digital Visa Wallet Operations
Virtual Visa cards with 3DS auto-approve, Google Pay, and Apple Pay support.
// Create a virtual Visa wallet card (minimum $5 funding deducted on creation) $client->visaWalletCreateVirtualCard($email, $firstName, $lastName); // Get all Visa wallet cards $client->visaWalletGetAllCards($email); // Get specific card details (includes full card number, CVV, transactions) $client->visaWalletGetCard($email, $cardId); // Fund card (minimum $5.00) $client->visaWalletFundCard($email, $cardId, '50.00'); // Get OTP for GPay / Apple Pay provisioning $client->visaWalletGetOTP($email, $cardId); // Block / Unblock card $client->visaWalletBlockCard($email, $cardId); $client->visaWalletUnblockCard($email, $cardId);
Administrator Operations
// Get wallet balance $balance = $client->getWalletBalance(); // Get all deposits $deposits = $client->getDeposits(); // Get all transactions $transactions = $client->getTransactions(); // Get all Visa cards $visaCards = $client->getAllVisaCards(); // Get all MasterCards $mastercards = $client->getAllMastercards(); // Get all Digital cards $digitalCards = $client->getAllDigitalCards();
Wallet as a Service Operations
// Swap endpoints $currencies = $client->swapGetCurrencies(); $status = $client->swapGetStatus('transaction_id_here'); $estimate = $client->swapGetEstimate('BTC', 'USDT-TRC20', 'BTC', 'TRC20', 0.5); $swap = $client->swapCreate('BTC', 'USDT-TRC20', 'BTC', 'TRC20', 0.5, 'THUnQJKECXP82EjijVVHpUwFMd3Y3vGBQJ'); // Wallet endpoints $address = $client->walletCreateAddress('user@example.com', 'PAXG'); $addresses = $client->walletGetAllAddresses('user@example.com'); $specificAddress = $client->walletGetAddress('uuid_here', 'user@example.com'); $balance = $client->walletGetBalance('uuid_here', 'user@example.com');
Error Handling
use BSICards\APIException; try { $response = $client->mastercardCreateCard( 'user@example.com', 'John Doe', '1234' ); } catch (APIException $e) { // Handle API error echo "API Error: " . $e->getMessage(); echo "Code: " . $e->getCode(); }
Response Format
All API responses follow this format:
{
"code": 200,
"status": "success",
"message": "Descriptive message",
"data": {}
}
Advanced Configuration
Custom HTTP Settings
$client = new BSICardsClient( 'public_key', 'secret_key', [ 'timeout' => 60, 'connect_timeout' => 15, ] );
Switching Credentials
$client->setPublicKey('new_key'); $client->setSecretKey('new_secret'); $publicKey = $client->getPublicKey(); $secretKey = $client->getSecretKey();
Base URL
The SDK automatically uses the correct base URL:
https://cards.bsigroup.tech/api/
Best Practices
- Never hardcode credentials - Always use environment variables
- Use try-catch blocks - Always handle API exceptions
- Validate input - Check email and other data before sending
- Log errors - Keep records of API failures
- Implement retry logic - For network failures
- Cache responses - Where appropriate for performance
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
This SDK is released under the MIT License. See LICENSE for details.
Support
For issues, questions, or support:
- Email: cs@bsigroup.tech
- Website: https://www.bsigroup.tech
- Documentation: See
/docsdirectory
Changelog
See CHANGELOG.md for version history.
Disclaimer
This SDK is provided as-is. Always test in a sandbox environment before production use.
nash81/bsicards-php-sdk 适用场景与选型建议
nash81/bsicards-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「visa」 「mastercard」 「bsicards」 「card-issuance」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nash81/bsicards-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nash81/bsicards-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nash81/bsicards-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel >=5.6 integration for the PHP Credit Cards package that allows to perform operations on debit and credit cards like format, validate brand, number and Luhn algorithm.
Client SDK for CyberSource REST APIs
A PSR-7 compatible library for making CRUD API endpoints
PHP library for working with Georgian payment providers and banks
Laravel Blade components for SVG credit card and payment icons
DigiWallet Bank Payments PHP SDK
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 43
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-06