kidacallos/coinsph-sdk
Composer 安装命令:
composer require kidacallos/coinsph-sdk
包简介
A laravel package wrapper for integrating with CoinsPH API
README 文档
README
A Laravel package wrapper for integrating with CoinsPH API. This package provides a simple and elegant way to interact with CoinsPH's payment services.
Features
- Cash out operations
- QR code generation for deposits
- QR code status verification
- Fiat order details retrieval
- Deposit and withdrawal validation
- Secure API authentication with signatures
Requirements
- PHP 8.0 or higher
- Laravel 8.0 or higher
- GuzzleHTTP 7.9 or higher
- Illuminate/Support 12.17 or higher
Installation
You can install the package via composer:
composer require kidacallos/coinsph-sdk
Configuration
-
First, set up your CoinsPH API credentials. You'll need:
- API Key
- Secret Key
- API URL
-
Initialize the SDK and configure your vault:
use Kidacallos\CoinsPhSdk\CoinsPh; $coinsPh = new CoinsPh(); $coinsPh->setVault([ 'api_key' => 'your_api_key', 'secret_key' => 'your_secret_key', 'api_url' => 'https://api.coins.ph/v1' ]);
Usage
Cash Out Operation
try { $response = $coinsPh ->validateWithdrawal([ 'amount' => '1000.00', 'currency' => 'PHP', // Add other required withdrawal parameters ]) ->cashOut(); // Handle successful response } catch (VaultNotFoundException $e) { // Handle vault configuration error } catch (FailedResponseException $e) { // Handle API request failure } catch (InvalidArgumentException $e) { // Handle validation errors }
Generate QR Code for Deposit
try { $response = $coinsPh ->validateDeposit([ 'amount' => '1000.00', 'currency' => 'PHP', // Add other required deposit parameters ]) ->generateQRCode(); // Handle QR code response } catch (Exception $e) { // Handle errors }
Check QR Code Status
$isValid = $coinsPh->getQRCodeStatus('request_id_here');
Get Fiat Order Details
$orderExists = $coinsPh->getFiatOrderDetail('internal_order_id_here');
Response Handling
The package returns responses as CoinsPhResponse objects which provide methods to access:
- Response status
- Payload data
- Error messages
- Raw response
Error Handling
The package throws the following exceptions:
VaultNotFoundException: When API credentials are not configuredFailedResponseException: When an API request failsInvalidArgumentException: When validation fails for deposit/withdrawal payloads
Security
The package automatically handles:
- API authentication
- Request signatures
- Secure HTTP headers
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
Author
- Kenneth I. Dacallos (kennethdacallos@gmail.com)
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-07