Search by

vanryx / vanryx-php

Vanryx

Vanryx PHP SDK

Package info

github.com/Vanryx/vanryx-php

pkg:composer/vanryx/vanryx-php

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-27 10:37 UTC

This package is auto-updated.

Last update: 2026-11-28 08:42:26 UTC


README

Vanryx is a modern Crypto Payment Gateway & Wallet designed for high-performance commerce. This official SDK provides a simple, type-safe interface for integrating Vanryx payments, swaps, and webhooks into your PHP applications.

Vanryx.com • Dashboard • API Documentation

Core Highlights

  • Competitive Fees: Starting from 0.5% for transactions.
  • Merchant Benefits: 0% internal merchant-to-merchant transfer fees.
  • Fast Onboarding: No-KYC onboarding process.
  • Broad Asset Support:
    • Native Coins (9): SOL, ETH, TRON, XRP, BTC, DOGE, BCH, BNB, LTC.
    • Tokens (2): USDT (on TRON), USDC (on ETH).

Requirements & Installation

  • PHP: 8.2 or higher.
  • Extensions: curl, json.

Install via Composer

composer require vanryx/vanryx-php

Quick Start

Initialize the Client

use Vanryx\VanryxClient;

$client = new VanryxClient('your_api_key_here');

// Access services via the client
$payment = $client->payment;
$swap = $client->swap;

Create a Payment Invoice

Generate a checkout link for your customers.

$invoice = $payment->createInvoice([
    'amount' => '49.99',
    'currency' => 'USD',
    'order_id' => 'ORDER_12345',
    'description' => 'Payment for Order #12345',
    'callback_url' => 'https://your-site.com/webhooks/vanryx'
]);

echo "Invoice URL: " . $invoice['url'];

Create a Static Deposit Address

Generate a permanent address for a specific asset and network.

$deposit = $payment->createStaticAddress([
    'to_currency' => 'BTC',
    'network' => 'BTC',
    'label' => 'User_Wallet_1'
]);

echo "Deposit Address: " . $deposit['address'];

Lookup Swap Rates

$rate = $swap->getRate('ETH', 'USD');
echo "Current Rate: 1 ETH = " . $rate['price'] . " USD";

Handling Webhooks

Vanryx sends webhooks for transaction events. Use the WebhookHandler to process these securely.

use Vanryx\WebhookHandler;

$handler = new WebhookHandler();

// Get the raw JSON payload from the request body
$payload = json_decode(file_get_contents('php://input'), true);

// 1. Check for fulfillment
if ($handler->isInvoiceFulfilled($payload)) {
    error_log("Invoice {$payload['track_id']} is paid!");
}

// 2. Prevent duplicate processing (Idempotency)
$dedupeKey = $handler->eventDedupeKey($payload);
if (isAlreadyProcessed($dedupeKey)) {
    http_response_code(200);
    exit('Already processed');
}

// Process event...

Available Methods

PaymentService

  • $client->payment->createInvoice(array $params): Creates a new payment invoice.
  • $client->payment->createStaticAddress(array $params): Generates a static deposit address.

SwapService

  • $client->swap->getRate(string $from, string $to): Retrieves exchange rates between currencies.

WebhookHandler

  • eventDedupeKey(array $payload): Returns a unique key (event:tx_id) for idempotency.
  • isInvoiceFulfilled(array $payload): Checks if an invoice transaction is fulfilled.

Exceptions & Error Handling

The SDK throws specific exceptions based on the API response:

  • Vanryx\Exception\AuthenticationException (401)
  • Vanryx\Exception\ForbiddenException (403)
  • Vanryx\Exception\ValidationException (422)
  • Vanryx\Exception\RateLimitException (429)
  • Vanryx\Exception\ServiceUnavailableException (503)
  • Vanryx\Exception\VanryxException (General error)

Security Notes

  1. API Key Safety: Store your Merchant-API-Key in environment variables (.env).
  2. HTTPS Required: Your webhook callback_url must use HTTPS.
  3. Idempotency: Always use handler->eventDedupeKey() to prevent duplicate processing.

Official Links