Skip to main content

Payments Guide

This guide covers everything you need to know about creating and managing payments through the 123hub API. All payment operations use a single endpoint with method-based routing.

Overview

The 123hub API provides three payment methods through a single endpoint:

Endpoint

All requests are sent to a single endpoint:
Successful responses return HTTP 200. Most errors return HTTP 400; some use 403, 404, 409, 429 or 5xx — see Error Codes. Always check the success field in the response body to determine the outcome.

Authentication

Every request requires the application ID and exact-body hash. The timestamp and nonce are optional and must be supplied together when used: The hash is computed as:
Where requestBody is the raw JSON string of the request body, and secretKey is your merchant secret key. The optional timestamp and nonce are not part of the hash; see Replay protection.
Keep your secret key secure. Never expose it in client-side code, public repositories, or browser requests. The hash must be computed server-side.

Request Format

All requests follow the same envelope:

Response Format

All responses follow a consistent envelope:

Identifiers

Every payment uses three identifiers that appear in the identifiers object: When the route reports one, responses also carry identifiers.utr — a bank tracking reference for reconciliation.
Use c_id as your primary reference for tracking payments. It is the key you control and should map to your internal order or transaction ID. Send c_id and h_id as JSON strings; numeric values are rejected with 1005.

Creating a Deposit (payment.in)

Use payment.in to create a deposit where a customer pays you.
1

Build the request body

Include the payment amount, currency, customer (payer) details, and your unique c_id.
2

Compute the authentication hash

Compute sha512(requestBody + secretKey) and set it in the X-Data-Hash header.
3

Send the request

POST to /public/api/multihub/v1 and handle the response.
4

Redirect the customer

If the response includes a redirect.to URL, redirect the customer to complete payment.

Request

Deposit Request Fields

For payment.in, payer is required and must be included under params.payment.payer. Unknown fields anywhere in the request are rejected with 9000.
Names. Payment routes receive the first and last name as separate fields, plus a combined full name. Put only the first name in person.first_name and only the last name in person.last_name; routes that need both parts can reject a full name packed into one field. If you send no name at all, the payment is recorded with the name Unknown. In payment.status and webhooks, person is rebuilt from the stored full name: the first word becomes first_name, the rest becomes last_name.
payer.custom_fields accepts at most 20 entries. Keys must start with an ASCII letter, contain only letters, digits, _ or -, and be at most 64 characters; values must be strings up to 255 characters, and the whole object is limited to 8 KiB. Credential-like keys, control characters and oversized payloads are rejected with 9000. Send only fields documented for the selected route. Custom fields are used for provider request construction and are not returned in API responses or merchant webhooks. On payment.in, receiver.custom_fields is rejected; use payer.custom_fields.

Country-Specific Fields

Some countries need extra payer data — a document number, the payer’s own bank account, a bank code. Each country page lists exactly what its routes need.
An amount outside the limits of your route is rejected with 9000 Payment request validation failed and no details. Check the minimum and maximum for every service_id with your account manager and validate amounts before sending. Such a rejected request still uses up its c_id — see Idempotency.

Response

For UPI payments (India), the response may include a redirect object with UPI deep-link URLs in the redirect.to field. For other payment methods, redirect may not be present in the initial response.

Full Deposit Response Example

An India UPI deposit. Every country page shows real responses for its own methods.

Creating a Withdrawal (payment.out)

Use payment.out to send money to a recipient (payout).
Withdrawals require sufficient available balance and must fit the merchant payout limits configured for the requested currency. The API returns 6004 when balance is too low, 6006 for daily limit breaches, 6005 for monthly limit breaches, and 6035 for other payout-limit rules such as since-last-settlement limits.
Use params.payment.identifiers.c_id as your own payout identifier and idempotency key. The same c_id is returned in the create response, payment.status, and payout webhooks under data.result.payment.identifiers.c_id.

Request

Country-Specific Withdrawal Fields

receiver.bank and receiver.custom_fields depend on the country — IFSC in India, CLABE in Mexico, a wallet number and code in Pakistan, a PIX key in Brazil. See the Withdrawal section of your country page.

Withdrawal Request Fields

receiver.custom_fields has the same bounds as the deposit namespace: at most 20 safe ASCII-named fields (keys up to 64 characters), string values up to 255 characters, and an 8 KiB serialized limit. Credential-like keys and control characters are rejected. Send only fields documented for the selected route; they are not returned in API responses or merchant webhooks. On payment.out, payer.custom_fields is rejected; use receiver.custom_fields.
How withdrawals are validated. The route — including its method — comes from the service_id; you never send a method. Before the request reaches the provider the API checks: receiver.bank.account.id is present (otherwise 1005), MXN withdrawals carry an 18-digit CLABE with a valid checksum, and bank-transfer routes get an account of at least 10 characters (otherwise 9000). A 9000 here is recorded as a failed withdrawal under your c_id, so send the corrected withdrawal with a new c_id. Everything else — IFSC, bank codes, names, documents — is checked by the provider, and a mistake there ends the withdrawal with an error status.
Deposits use payer, withdrawals use receiver. The payer object describes who is sending the money (deposit), while the receiver object describes who is receiving the money (withdrawal). Both contain contact information and, for receiver, bank account details.

Tracking Withdrawal Completion

The initial payment.out response usually has status.status: "processing". Wait for a webhook or poll payment.status with your c_id or the returned h_id. Payout lifecycle webhooks use the same payment envelope as deposits. Read the business identifier from data.result.payment.identifiers.c_id; do not depend on provider-only callback fields such as order_id, transaction_id, session_token, or user_id.

Full Withdrawal Response Example

An Argentina bank-transfer withdrawal. Country pages show the withdrawal responses for their routes.

Checking Payment Status (payment.status)

Use payment.status to query the current state of a payment. You can look up a payment by either c_id (your reference) or h_id (system-assigned ID).

Query by c_id

Query by h_id

You can also look up a payment using the system-assigned h_id. payment.status never requires service_id. If you send both c_id and h_id, the lookup uses h_id:

Response

The response contains the full payment object with its current status:

Re-sending Webhook (payment.notification)

Use payment.notification to trigger a webhook re-delivery for a specific payment. The request format is identical to payment.status, and the response returns the full payment object:
Provide either c_id or h_id. This method triggers a new webhook delivery to your active webhook endpoints with the current payment state. Use it only as a recovery action when your webhook handler missed or failed to process a notification. For read-only checks or polling, use payment.status with backoff instead. The method is limited to 10 requests per minute. Without operation_id, compatibility idempotency is scoped to the canonical request and current minute.

Payment Statuses

Each payment has a status object with the current status name, and boolean flags indicating whether it is final and whether it represents a success.
Terminal statuses are indicated by final: true. A terminal status is the current completed outcome for integration handling, but reconciliation, refunds, or provider corrections can publish a later status update. Always process webhooks idempotently by payment id and status timestamp.

Status Object Structure

Every payment includes a status object with the following fields:
The history array contains every status transition the payment has gone through, in chronological order. This is useful for debugging and auditing.

Handling Status Changes


Redirect URLs

For deposit payments (payment.in), the response may include a redirect object. For UPI payments (India), this contains deep-link URLs for mobile payment apps:
redirect.on_success and redirect.on_fail in your request are currently not passed to the payment page — they are only echoed in the create response. Do not rely on them to bring the payer back to your site; agree the return behaviour for your routes with your account manager.
The redirect.to field can contain UPI deep-link URLs, a provider HTTPS payment page URL, or another provider-specific redirect target. The redirect field may be absent if no redirect URL is available for the payment method.
If a provider returns only a valid generic upi://pay?<query> link, the API fills the missing Paytm, Google Pay, and PhonePe links in that order. Existing provider-specific links are preserved. The same representation is used in the payment creation response, payment status response, and merchant webhook.

Deposit Flow Types

What a payment.in response gives you depends on the route behind your service_id. There are five shapes; your country page says which ones its methods use. A bank-details response with every field the API can return (each one appears only when the route provides it):
The same receiver fields are returned by payment.status and in webhooks.

Customer Data

Deposits: the payer Object

For payment.in requests, the payer object describes the customer making the payment:

Withdrawals: the receiver Object

For payment.out requests, the receiver object describes who receives the payout, including their bank details:
The receiver.bank object contains the banking details required to execute the transfer. Which fields are needed depends on the country — see the Withdrawal section of your country page.

Additional Response Fields

Operations

Every payment response includes an operations array and an operation shortcut:

Identifier Formats

The h_id is assigned by 123hub, not by the provider. Treat it as an opaque string:
  • New payments get a UUID (e.g., "b8adedc9-c245-4fa2-8f26-095e8117d11a")
  • Older payments may carry other formats, such as numeric strings (e.g., "1774892151645"); these are still accepted for lookups

status.error Field

The status.error field inside the payment status object can be:
  • null — no error
  • integer — error code (e.g., 7001)
  • string — error message from provider (e.g., "Sum 150000 is lower than 200000")
Do not confuse result.payment.status.error (integer/string/null inside the payment status) with the top-level error object in error API responses (which has code, message, details, context fields).

Bank Details in payment.status

For withdrawals, only the create response echoes the receiver.bank you sent. payment.status and webhooks return the recipient’s name, email, phone and customer_account, but not receiver.bank (account, IFSC, code) or receiver.custom_fields. Store the full recipient details when you create the withdrawal.

Idempotency

The c_id (Client ID) serves as your idempotency key. If you send a payment.in or payment.out request with a c_id that was already used, the API will return error code 6009 (Payment already exists) instead of creating a duplicate.
Always use a unique c_id for each payment. If you receive a 6009 error, it means a payment with that c_id already exists. Use payment.status to retrieve its current state rather than creating a new one.
When is a c_id used up?
  • Requests rejected before processing starts — authentication errors (3xxx), a missing or invalid field (1005), request-shape validation (9000 with field details), 6001, 6002, 2002 for an unknown service_id — do not create a payment. Fix the request and resend it with the same c_id.
  • Requests rejected during processing — for example an amount outside the route limits or invalid withdrawal data (9000 without details), insufficient balance or payout limits (6004, 6005, 6006, 6035), a provider error (7001) or an internal error (2001) — are stored as a failed payment under that c_id. Resending the same c_id returns 6009, and payment.status with that c_id shows status error. Send the corrected request with a new c_id.
  • A second create with the same c_id while the first is still being processed returns 2002 (HTTP 503). Wait and query payment.status instead of creating again.

Error Handling

When a request fails, the response has success: false and includes an error object. Business and validation errors return HTTP 400; dependency and internal failures use the corresponding 5xx status:
Successful responses return HTTP 200. Handle HTTP 400, 403, 404, 409, and 429 as non-retryable unless the error-specific guidance says otherwise. HTTP 500, 502, 503, and 504 (and network timeouts) are transient candidates. For payment.in and payment.out, first query payment.status with the same c_id: if it returns 6010, retry the create with bounded backoff and the same c_id and payload; if it returns a payment, use that result. Always inspect both the HTTP status and the structured error.code.

Error Codes

Error Handling Example


Best Practices

Use Unique c_id Values

Always assign a unique c_id to each payment. This serves as your idempotency key and prevents duplicate payments.

Compute Hashes Server-Side

Never expose your secret key to the client. Always compute the X-Data-Hash on your server.

Check success Field

Always check the success boolean in the response body to determine the outcome. Success returns HTTP 200; errors usually return HTTP 400.

Store All Identifiers

Save c_id, h_id, and p_id from the response for reconciliation, debugging, and support inquiries.

Handle Redirects

For deposits, always check for a redirect.to URL and redirect the customer to complete their payment.

Use Status History

The status.history array provides a complete audit trail. Use it for debugging and tracking payment lifecycle.