Skip to main content

PHP Examples

Complete PHP example client for integrating with the 123hub API using cURL and hash('sha512', ...).
This is a reference implementation, not an official SDK package. It works with PHP 8.0+ and requires only the built-in cURL and JSON extensions.

Configuration

Store your credentials in environment variables or a .env file:

PaymentApiClient Class

A complete, reusable client class for all API operations:

Usage Examples

Ping (Health Check)

Create a Deposit Payment

The examples below use INR (India), but the same client works for all supported currencies (MXN, ARS, TRY, AUD, LKR, UYU) — just change the serviceId, currency, and country values.

Create a Withdrawal (Payout)

Check Payment Status

Get Balance

Error Handling

Successful responses return HTTP 200, errors return HTTP 400. Always use the success field to determine the outcome:

Handling Network Errors

Network-level errors can still occur independently of API responses:

Laravel Integration

Complete Example