Skip to content
HPay Developers
Français
Merchant API reference

Authentication

The merchant API is for your servers and approved payment terminals. To accept payments on a website or in an app, start with the payment gateway. See the gateway

Conventions

POSThttps://api.hpay.cash/…/

Common errors

These codes can be returned by every endpoint that uses a token (except refunds, which have their own numbering).

error_codeCauseWhat to do
5Wrong number of keys.Send exactly the listed keys.
10Unexpected key.Check key spelling.
20Required value empty.Fill in the value; message names the field.
30Unknown API key.Check api_key / main_api_key.
31Truncated or invalid token.Request a new token.
32Token expired.Request a new token.
41Mode differs from your keys.Align mode.
50Wrong secret or public key.Check your keys.
60Token issued for another action.Request a token with the right action.

Get a token

POSThttps://api.hpay.cash/token/

Every operation needs a recent token specific to its action. It is created with your three keys and stays valid for 5 minutes (15 minutes for reads). Request a new one before each operation.

Parameters (JSON)

api_keyrequiredstring Your API key.
api_secret_keyrequiredstring Your secret key.
api_public_keyrequiredstring Your public key.
moderequiredstring test or live, matching your keys.
actionrequiredstring The target operation, stated on each endpoint: payment, refund, history, get_balance, submarchant, newaccount, deposit, withdraw, check-card, transfert, withdraw-code, addBank, list-banks, delete-bank, add-withdraw, all-withdraw, cancel-withdraw.
curl -X POST https://api.hpay.cash/token/ \
  -H "Content-Type: application/json" \
  -d '{
  "api_key": "YOUR_API_KEY",
  "api_secret_key": "YOUR_SECRET_KEY",
  "api_public_key": "YOUR_PUBLIC_KEY",
  "mode": "test",
  "action": "payment"
}'
Response
{
  "success": true,
  "message": "Token generated",
  "token": "TVlYb2ZhZ0x…",
  "livetime": "3mn",
  "time_generated": 1763474820,
  "error_code": 0
}

Errors specific to this endpoint

error_codeHTTPCause
30200Unknown API key.
40200Mode does not match your keys.
50200Wrong secret or public key.
60200Unknown action.

Next : Payments →