kidacallos/coinsph-sdk

A laravel package wrapper for integrating with CoinsPH API

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/kidacallos/coinsph-sdk

dev-main 2025-06-07 11:47 UTC

This package is auto-updated.

Last update: 2025-12-07 12:52:12 UTC


README

MIT Licensed

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

  1. First, set up your CoinsPH API credentials. You'll need:

    • API Key
    • Secret Key
    • API URL
  2. 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 configured
  • FailedResponseException: When an API request fails
  • InvalidArgumentException: 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