Testing Guide
123hub provides a test mode that allows you to simulate transactions without processing real money. This guide covers how to use test mode effectively.Test vs Production Mode
Test and production use the same API endpoint (
POST /public/api/multihub/v1). The environment is determined by your credentials. Your 123hub account manager will provide separate test and production credential pairs.| Credential Set | Environment | Behavior |
|---|---|---|
Test application_id + secret_key | Test | Simulated transactions, no real money |
Production application_id + secret_key | Production | Real transactions, actual money movement |
Getting Test Credentials
Test credentials are provided by the 123hub team during onboarding. You will receive:- application_id — an integer identifying your test application
- secret_key — a private key used to sign requests in test mode
Request credentials
Contact your 123hub account manager or [email protected] to request test credentials.
Contact [email protected] if you need test credentials.
Test Mode Behavior
Payments
- Payments are created and go through normal status transitions
- No actual bank transfers or card charges occur
- Webhooks are delivered normally
- All API responses mirror production behavior
Balance
- Test mode uses a separate test balance
- Initial test balance may be pre-funded for testing
- Balance changes reflect test transactions only
Webhooks
- Webhooks are delivered to your configured endpoints
- Use webhook testing to verify your integration
- Same signature verification as production
Simulating Payment Scenarios
Successful Deposit
Create a deposit payment usingpayment.in — it will transition through created to success status:
Successful Withdrawal
Create a withdrawal payment usingpayment.out (requires sufficient test balance):
Check Payment Status
Query the status of a payment usingpayment.status:
Error Response Example
All errors are returned with HTTP 200 andsuccess: false. Here is an example of an invalid signature error:
Testing Webhooks
Local Development
For local development, use a tunneling service like ngrok to expose your local server:Integration Checklist
Before going live, verify your integration handles these scenarios:Authentication
Authentication
- Compute
X-Data-Hashcorrectly assha512(requestBody + secretKey) - Send
X-Data-Application-Idheader with correct integer value - Verify
gateway.pingreturns a successful response - Store credentials securely (environment variables, not hardcoded)
Payment Creation
Payment Creation
- Create deposit payments (
payment.in) successfully - Create withdrawal payments (
payment.out) successfully - Handle error responses gracefully (check
successfield) - Store
h_idfrom response for subsequent status queries - Send unique
c_idper payment to avoid duplicates (error 6001)
Payment Status
Payment Status
- Retrieve payment status using
payment.statuswithh_id - Handle all status values:
created,processing,success,error,canceled,declined,refunded - Check the
finalfield to determine if a payment has reached a terminal state - Check the
successfield to determine if a final payment was successful
Webhooks
Webhooks
- Receive webhook notifications
- Verify webhook signatures
- Handle payment completion events
- Handle payment failure events
- Process events idempotently
Error Handling
Error Handling
- Success returns HTTP 200, errors return HTTP 400/404 — always check
successfield - Handle error code 3000 (authentication error / invalid signature)
- Handle error code 3003 (application not found)
- Handle error code 2002 (no route available)
- Handle error code 6004 (insufficient funds for withdrawals)
- Handle error code 1005 (missing or invalid fields)
- Handle network timeouts and retry with the same
c_id
Balance
Balance
- Check balance using
balance.getbefore withdrawals - Handle insufficient funds errors (error code 6004)
Error Code Reference
| Code | Description |
|---|---|
| 1000 | Common error |
| 1002 | Method not available (HTTP 404) |
| 1005 | Invalid request format (missing required field) |
| 2002 | Payment provider not available |
| 3000 | Authentication error (invalid signature) |
| 3003 | Application not found |
| 6001 | Incorrect transaction amount |
| 6002 | Incorrect currency code |
| 6004 | Insufficient funds |
| 6009 | Payment already exists (duplicate c_id) |
| 6010 | Payment does not exist |
| 7001 | Provider interaction error |
| 8801 | Invalid status transition |
| 9000 | Validation error |
Going Live
Request Production Credentials
Contact your 123hub account manager or [email protected] to request production
application_id and secret_keyUpdate Configuration
Replace test
application_id and secret_key with production credentials in your production environmentCommon Testing Mistakes
Using Production Credentials in Dev
Always use test
application_id and secret_key in developmentSkipping Signature Verification
Always verify webhook signatures, even in test mode
Not Testing Errors
Test error scenarios, not just happy paths. Verify your code checks the
success field in every response.Hardcoding Credentials
Use environment variables for
application_id and secret_keyNeed Help?
Developer Support
Contact our team if you have questions about testing
