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 authenticates with your Application ID and an exact-body SHA-512 hash at
POST /public/api/multihub/v1.Available Examples
Python
Client class using
requests and hashlibNode.js
Client class using
crypto and native fetchPHP
Client class using cURL and
hash('sha512', ...)Go
Client struct using
crypto/sha512 and net/httpHow 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
Serialize the body once, compute the lowercase hex SHA-512 of those exact bytes followed by your
secret key, and send it as
X-Data-Hash. Send the same bytes you hashed.3
Send the POST request
POST to
/public/api/multihub/v1 with your exact configured X-Data-Application-Id.4
Verify and handle the response
Verify the response
X-Data-Hash before trusting the body (see
Response signature). Successful responses return HTTP 200. Most errors
return HTTP 400; some use 403, 404, 409, 429 or 5xx (see Error codes).
Check the success boolean field to determine if the operation succeeded, and handle
error.code / error.message when it did not.Authentication
Every request requiresX-Data-Application-Id and X-Data-Hash:
Send
X-Data-Timestamp and X-Data-Nonce together or not at all — one without the other is
rejected, and so is a reused nonce. They are not part of the X-Data-Hash input.
Environment Variables
Store your credentials securely:API Methods
Method-based routing replaces traditional REST endpoints. You specify the operation in themethod field of the request body:
Request Format
Every request follows this structure:Response Envelope
Every response uses a consistent envelope:Success (HTTP 200)
Error (HTTP 400)
Response Signature
Responses are signed with the same secret: the responseX-Data-Hash header is the lowercase hex
SHA-512 of the exact raw response body followed by your secret key. Every example client checks it
with a constant-time comparison before parsing the body and raises
response signature verification failed on a mismatch.
- Successful responses are always signed; treat an unsigned success as untrusted.
- Errors returned before authentication completes (for example
3000,3001,3003or3006) carry noX-Data-Hashand are returned as-is. - A
503returned before authentication uses a different body (statusCode,message,timestamp) withoutsuccess; the example clients raise an error for it.
Common Pattern Across All SDKs
Regardless of language, every SDK example follows this pseudocode: Payment status handling should treatsuccess, 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
