API referenceResponse codes
QRPay uses standard HTTP status codes, and repeats the code inside the response body. Successful requests return 200 OK; failures return a 4xx/5xx status with the reason in message.error.
The response envelope
Every endpoint — success or failure — wraps its payload in the same envelope, shown on the right:
message.codeintegerMirrors the HTTP status code, so the outcome survives proxies and logging that drop the status line.
message.success / message.errorarrayHuman-readable messages. Exactly one of the two keys is present, matching the outcome — e.g. ["CREATED"] or ["Invalid secret ID"].
dataobject | arrayThe payload. An object on success; an empty array [] on errors.
typestring"success" or "error" — the simplest branch condition for your client code.
Codes you’ll see
200 OKThe request succeeded. data carries the result — a token, a payment session, or a redirect payload.
400 Bad requestValidation failed or a credential is wrong — e.g. "The amount must be a string." or "Invalid secret ID". Fix the request before retrying; resending it unchanged will fail again.
403 Forbidden"Requested with invalid token!" — the Bearer access token is expired, malformed or missing. Request a fresh access token and retry. 404 Not foundThe path doesn’t exist — almost always a mistyped base URL. Check it ends in /pay/api/v1. 5xx Server errorSomething failed on the QRPay side. Safe to retry with backoff — see error handling. Branch on type
- Check type === "success" (or the HTTP status) before touching data — on errors it’s an empty array, not an object.
Envelope 200 · success
{
"message": {
"code": 200,
"success": ["CREATED"]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGX...",
"payment_url": "https://your-qrpay-domain.com/payment/checkout/2zMRmT3KeYT2..."
},
"type": "success"
}Envelope 4xx · error
{
"message": {
"code": 403,
"error": ["Requested with invalid token!"]
},
"data": [],
"type": "error"
}