Skip to main content

SDKs & Code Examples

We provide example client implementations in popular programming languages to help you integrate with the 123hub API. These are reference implementations, not official SDK packages — you can adapt them to your needs or use them as-is.
Each client is configured with one explicit Application ID + API version pair. Version 1 uses the legacy exact-body SHA-512 hash at POST /public/api/multihub/v1; version 2 uses canonical HMAC-SHA512 and mandatory replay protection at POST /public/api/multihub/v2. Clients never fall back between versions.

Available Examples

Python

Client class using requests and hashlib

Node.js

Client class using crypto and native fetch

PHP

Client class using cURL and hash('sha512', ...)

Go

Client struct using crypto/sha512 and net/http

How It Works

Every API call follows the same pattern regardless of the programming language:
1

Build the request body

Construct a JSON body containing method (the operation), an optional service_id, and a params object.
2

Sign the request

For v1, hash the exact body plus the secret. For v2, generate timestamp and nonce, then sign the documented canonical request payload with HMAC-SHA512.
3

Send the POST request

POST to the endpoint selected by the configured API version. Both versions send the exact configured X-Data-Application-Id; v2 never retries as v1.
4

Handle the response

Successful responses return HTTP 200, errors return HTTP 400 (or 404 for unknown methods). Check the success boolean field to determine if the operation succeeded, and handle error.code / error.message when it did not.

Authentication

All requests require X-Data-Application-Id. The remaining headers depend on the configured version:
Never expose your secret key in client-side code, logs, or version control. Always store it in environment variables or a secrets manager.

Environment Variables

Store your credentials securely:

API Methods

Method-based routing replaces traditional REST endpoints. You specify the operation in the method field of the request body:

Request Format

Every request follows this structure:

Response Envelope

Every response uses a consistent envelope:
Success (HTTP 200)
When an error occurs (HTTP 400):
Error (HTTP 400)

Common Pattern Across All SDKs

Regardless of language, every SDK example follows this pseudocode: Payment status handling should treat success, error, canceled, declined, refunded, and partially_refunded as final statuses for polling loops. Handle refunded and partially_refunded as refund outcomes, not as new successful order payments.

Community SDKs

If you have built an SDK or wrapper for the 123hub API, we would love to feature it here. Contact us at support@123hub.pro.

Need Help?

API Reference

Complete API documentation

Support

Contact developer support