Skip to content

The whole flow, start to finish.

From a key to live payments, in .

1Get a key.

DevelopersAPI keysCreate a key

In Permissions: Read only, then Write on Payments. Create key, copy it from Copy your new API key (shown once) into HIDDEN_API_KEY. Needs a verified email.

2Create a test payment.

create.mjsshellcreate.pycreate.phptest: true"test": true"test": True"test" => true
const res = await fetch("https://api.sellhidden.com/v1/payments", {  method: "POST",  headers: { Authorization: `Bearer ${process.env.HIDDEN_API_KEY}`,    "Content-Type": "application/json" },  body: JSON.stringify({ amountUsd: 49,    reference: "order-1042", test: true }),});const { ok, payment, error } = await res.json();if (!ok) throw new Error(`${error.code}: ${error.message}`);console.log(payment.url); // send the buyer there
curl -X POST \  "https://api.sellhidden.com/v1/payments" \  -H "Authorization: Bearer $HIDDEN_API_KEY" \  -H "Content-Type: application/json" \  -d '{"amountUsd": 49, "reference": "order-1042", "test": true}'
import os, requests  # pip install requestsr = requests.post(    "https://api.sellhidden.com/v1/payments",    headers={"Authorization": f"Bearer {os.environ['HIDDEN_API_KEY']}"},    json={"amountUsd": 49, "reference": "order-1042", "test": True},    timeout=15)body = r.json()if not body["ok"]:    raise RuntimeError(f"{body['error']['code']}: "        f"{body['error']['message']}")print(body["payment"]["url"])  # send the buyer there
<?php$ch = curl_init("https://api.sellhidden.com/v1/payments");curl_setopt_array($ch, [    CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,    CURLOPT_HTTPHEADER => ["Authorization: Bearer "        . getenv("HIDDEN_API_KEY"), "Content-Type: application/json"],    CURLOPT_POSTFIELDS => json_encode(["amountUsd" => 49,        "reference" => "order-1042", "test" => true])]);$body = json_decode(curl_exec($ch), true);if (!$body["ok"]) throw new Exception($body["error"]["code"]    . ": " . $body["error"]["message"]);header("Location: " . $body["payment"]["url"], true, 303);

Response

201 Created
{ "ok": true, "payment": {
"id": "7K2Q-9XHD",
"url": "https://sellhidden.com/order/7K2Q-9XHD",
"status": "pending", "test": true } }

3Open the url. Press Mark as paid.Preview

Your buyer pays $49.00 here. Now you are the buyer.

Test mode
status"pending""paid""expired"GET /payments/7K2Q-9XHD

Test mode is one field: no test keys, no sandbox host, no money moves.Paid. No money moved. Now let your server hear itExpired. Nothing was paid, and the reference is free again.

What the buyer sees, what the API never returns, and what the samples run on.

  • The API never returns a deposit address, a coin amount or a QR code: the buyer picks a coin and pays on the Hidden page.
  • The page shows your store name, the amount and "Powered by Hidden" on every plan except Enterprise. It speaks 12 languages and works on phones.
  • The samples run on Node 18, Python 3.9 and PHP 8, or later.

4. Send the buyer, bring them back.

Your test payment works. Now send a buyer to the payment page, and bring them back after.

add to create.mjsadd to the requestadd to create.pyadd to create.php
// 1. add to the create requestbody: JSON.stringify({ amountUsd: 49, reference: "order-1042",  returnUrl: "https://shop.example.com/thanks?order=1042",  cancelUrl: "https://shop.example.com/cart", test: true }),// 2. in your route, send the buyer therereturn Response.redirect(payment.url, 303);
# 1. add to the create request-d '{"amountUsd": 49, "reference": "order-1042",  "returnUrl": "https://shop.example.com/thanks?order=1042",  "cancelUrl": "https://shop.example.com/cart", "test": true}'# 2. then open payment.url in a browser
# 1. add to the create requestjson={"amountUsd": 49, "reference": "order-1042",      "returnUrl": "https://shop.example.com/thanks?order=1042",      "cancelUrl": "https://shop.example.com/cart", "test": True},# 2. in your Flask route (from flask import redirect):return redirect(body["payment"]["url"], code=303)
// 1. add to the create requestCURLOPT_POSTFIELDS => json_encode(["amountUsd" => 49,    "reference" => "order-1042",    "returnUrl" => "https://shop.example.com/thanks?order=1042",    "cancelUrl" => "https://shop.example.com/cart", "test" => true]),// 2. then send the buyer to the payment pageheader("Location: " . $body["payment"]["url"], true, 303);

A 303 to payment.url, or a link: the payment page cannot be shown inside a frame. Both URLs: https, on one of your websites, same origin exactly. A test payment may also return to localhost.

Your return page

  • Thanks the buyer and shows the order as your webhook left it, or reads GET /payments/7K2Q-9XHD.
  • Never delivers: anyone can open that URL. Hidden adds nothing to it.

Paid while the page is open, or opened within 15 minutes: back to returnUrl after 5 seconds.

cancelUrl is the "Back to Nova Studio" link when a payment expires, is cancelled or is short.

5. Add your webhook endpoint.

Hidden tells your server when a payment changes. Give it an address to call.

DevelopersWebhooksAdd endpoint

Endpoint URL: your public https address. In Events, untick order.paid, tick the four under Payments:

  • payment.paid
  • payment.underpaid
  • payment.expired
  • payment.cancelled

Add endpoint shows the signing secret once: copy it into HIDDEN_WEBHOOK_SECRET.

6. Hidden tells your server, signed.

Every event is signed with your secret. Check the signature before you trust the event.

webhook.mjsread it backverify.pyverify.php

X-Hidden-Timestamp: <Unix seconds>X-Hidden-Signature: sha256=<hex>

import { createHmac, timingSafeEqual } from "node:crypto";export function verifyHidden(raw, timestamp, signature, secret) {  const age = Math.abs(Date.now() / 1000 - Number(timestamp));  // missing, or more than 5 minutes off  if (!timestamp || !(age <= 300)) return false;  const want = Buffer.from(createHmac("sha256", secret)    .update(`${timestamp}.${raw}`).digest("hex"));  const got = Buffer.from(    String(signature ?? "").replace(/^sha256=/, ""));  return got.length === want.length && timingSafeEqual(got, want);}export async function POST(req) {  // the body exactly as sent: never parse it first  const raw = await req.text();  const ok = verifyHidden(raw,    req.headers.get("x-hidden-timestamp"),    req.headers.get("x-hidden-signature"),    process.env.HIDDEN_WEBHOOK_SECRET);  if (!ok) return new Response("bad signature", { status: 401 });  const { event, data } = JSON.parse(raw);  if (event === "payment.paid" && !data.test)    await fulfilOnce(data.reference, data.id); // your code  return new Response("ok"); // any 2xx within 15 seconds}
# A shell cannot take a webhook.# Read the payment back instead:curl https://api.sellhidden.com/v1/payments/7K2Q-9XHD \  -H "Authorization: Bearer $HIDDEN_API_KEY"
import hashlib, hmac, timedef verify_hidden(raw: bytes, timestamp: str, signature: str,                  secret: str) -> bool:    timestamp, signature = timestamp or "", signature or ""    if (not timestamp.isascii() or not timestamp.isdigit()            or abs(time.time() - int(timestamp)) > 300):        return False  # missing, or more than 5 minutes off    want = hmac.new(secret.encode(), timestamp.encode() + b"." + raw,                    hashlib.sha256).hexdigest()    return hmac.compare_digest(want.encode(),        signature.removeprefix("sha256=").encode())
<?phpfunction verify_hidden(string $raw, string $timestamp,    string $signature, string $secret): bool {    if (!ctype_digit($timestamp)        || abs(time() - (int) $timestamp) > 300) return false;    $want = hash_hmac("sha256", $timestamp . "." . $raw, $secret);    return hash_equals($want,        preg_replace('/^sha256=/', '', $signature));}// $raw = file_get_contents("php://input");// the headers are HTTP_X_HIDDEN_TIMESTAMP and// HTTP_X_HIDDEN_SIGNATURE in $_SERVER

A shell cannot check a signature. Change the language to Node, Python or PHP.

HMAC-SHA256 of <timestamp>.<raw body>, keyed with the whole whsec_... secret in HIDDEN_WEBHOOK_SECRET.

Runs HMAC-SHA256 in this page.Signature validSame result as the signature below.No matchThis browser cannot run the check here.

Secretwhsec_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
Timestamp1794910361
Body{"id":"evt_0123456789abcdef","event":"payment.paid","createdAt":"2026-11-17T10:12:41.000Z","data":{"id":"7K2Q-9XHD","status":"paid","amountUsd":49}}
Signaturesha256=dc2d0686941478580ce6baf166d24016b291529e1c3cc72819295b2520171a08

The timestamp is old, so the 5-minute check refuses it: for this test, check the HMAC alone or set the clock to 1794910361.

7. Handle payment.paid, once.

When the payment is paid, deliver the order one time. Here is the whole webhook file.

Deliver only when all three are true:

  • data.status is paid
  • data.test is false
  • Once per data.id
  • Never on returnUrl: anyone can open that URL.
webhook.mjsread it backwebhook.pywebhook.php
import { createHmac, timingSafeEqual } from "node:crypto";export async function POST(req) {  const raw = await req.text(); // as sent: never parse it first  const ok = verifyHidden(raw, req.headers.get("x-hidden-timestamp"),    req.headers.get("x-hidden-signature"),    process.env.HIDDEN_WEBHOOK_SECRET);  if (!ok) return new Response("bad signature", { status: 401 });  const { event, data } = JSON.parse(raw);  if (event === "payment.paid" && data.status === "paid" && !data.test)    await fulfilOnce(data.reference, data.id); // once per payment  return new Response("ok"); // any 2xx within 15 seconds}// a retry repeats the event id: deliver onceconst delivered = new Set(); // your database in productionasync function fulfilOnce(reference, paymentId) {  if (delivered.has(paymentId)) return;  // your code: deliver order `reference` here  delivered.add(paymentId);}export function verifyHidden(raw, timestamp, signature, secret) {  const age = Math.abs(Date.now() / 1000 - Number(timestamp));  // missing, or more than 5 minutes off  if (!timestamp || !(age <= 300)) return false;  const want = Buffer.from(createHmac("sha256", secret)    .update(`${timestamp}.${raw}`).digest("hex"));  const got = Buffer.from(    String(signature ?? "").replace(/^sha256=/, ""));  return got.length === want.length && timingSafeEqual(got, want);}
# A shell cannot take a webhook.# Read the payment back instead:curl https://api.sellhidden.com/v1/payments/7K2Q-9XHD \  -H "Authorization: Bearer $HIDDEN_API_KEY"
import hashlib, hmac, json, os, timefrom flask import Flask, request  # pip install flaskapp = Flask(__name__)@app.post("/hidden/webhook")def hidden_webhook():    raw = request.get_data()  # as sent: never parse it first    ok = verify_hidden(        raw, request.headers.get("X-Hidden-Timestamp"),        request.headers.get("X-Hidden-Signature"),        os.environ["HIDDEN_WEBHOOK_SECRET"])    if not ok:        return "bad signature", 401    body = json.loads(raw)    data = body["data"]    if (body["event"] == "payment.paid" and data["status"] == "paid"            and not data["test"]):        fulfil_once(data.get("reference"), data["id"])    return "ok"  # any 2xx within 15 secondsdelivered = set()  # use your database in productiondef fulfil_once(reference, payment_id):    # a retry repeats the event id: deliver once    if payment_id in delivered:        return    # your code: deliver order `reference` here    delivered.add(payment_id)def verify_hidden(raw: bytes, timestamp: str, signature: str,                  secret: str) -> bool:    # a missing header arrives as None    timestamp, signature = timestamp or "", signature or ""    # refuse it when missing, malformed,    # or more than 5 minutes off    if (not timestamp.isascii() or not timestamp.isdigit()            or abs(time.time() - int(timestamp)) > 300):        return False    want = hmac.new(secret.encode(), timestamp.encode() + b"." + raw,                    hashlib.sha256).hexdigest()    return hmac.compare_digest(want.encode(),        signature.removeprefix("sha256=").encode())
<?php$raw = file_get_contents("php://input"); // the raw body$ok = verify_hidden($raw,    $_SERVER["HTTP_X_HIDDEN_TIMESTAMP"] ?? "",    $_SERVER["HTTP_X_HIDDEN_SIGNATURE"] ?? "",    (string) getenv("HIDDEN_WEBHOOK_SECRET"));if (!$ok) { http_response_code(401); exit("bad signature"); }$body = json_decode($raw, true);$data = $body["data"];if ($body["event"] === "payment.paid" && $data["status"] === "paid"    && !$data["test"]) {    fulfil_once($data["reference"] ?? "", $data["id"]);}echo "ok"; // any 2xx within 15 seconds// a retry repeats the event id: deliver oncefunction fulfil_once(string $reference, string $paymentId): void {    // use your database in production; a file marks it here    $mark = sys_get_temp_dir() . "/hidden-" . bin2hex($paymentId);    if (file_exists($mark)) return;    // your code: deliver order $reference here    touch($mark);}function verify_hidden(string $raw, string $timestamp,    string $signature, string $secret): bool {    if (!ctype_digit($timestamp)        || abs(time() - (int) $timestamp) > 300) return false;    $want = hash_hmac("sha256", $timestamp . "." . $raw, $secret);    return hash_equals($want,        preg_replace('/^sha256=/', '', $signature));}

The webhook handler is in Node, Python and PHP; this curl only reads the payment back.

  • Add your endpoint now, at a public https address: test events need it too (step 3).
  • Checks X-Hidden-Signature on the raw body with HIDDEN_WEBHOOK_SECRET. Bad: 401.
  • Delivers when data.status is paid and data.test is false, once per data.id.

Payment events

payment.paid

Deliver, once.

payment.underpaid

Short: the rest has 48 hours.

payment.expired

Not final: can still be paid.

payment.cancelled

Final.

Answer 2xx within 15 seconds, or Hidden tries 7 times over about 45 hours, same event id. Mark as paid sends a real event with "test": true: nothing is delivered.

8. Turn on live payments.

Everything works in test. These steps take real payments.

1Add your website.

DevelopersPaymentsAdd website

Under Your websites, fill Website address. "Payments" is a tab, not in the sidebar.

2Then turn on the switch. Store owner only.

Accept payments through the API

3Remove test from the create request.

Before your first live payment0 of 10

A payment arrives short.

  • Short by more than the store's tolerance: status underpaid, event payment.underpaid. Do not deliver yet.
  • The buyer has 48 hours to send the rest ("Send the rest" on the page). Then payment.paid comes.
  • Short within the tolerance counts as paid: shortUsd shows the gap.
  • To complete it on what arrived: POST /payments/{id}/accept. It cannot be undone.
  • A test payment cannot be short.

Expired, then paid.

  • expired is not final. A late transfer can still make it paid, or underpaid if it is short.
  • Keep the order open on payment.expired. Deliver on payment.paid, as always.
  • The API shows expired once expiresAt passes. The event follows within about 30 minutes.
  • expiresInMinutes: 15 to 1,440. Default 60.

A reference used twice.

  • Same reference, amount and test while open: 200, "existing": true, the same payment.
  • Another amount while open, or expired less than 2 hours ago after the buyer got an address: 409 reference_in_use.
  • Already paid: 409 reference_paid. Do not charge again.
  • Testing: a new reference each time, or press "Mark as expired" to free it.

The signature does not match.

  • Check the body exactly as it arrived. Express: express.raw({ type: "application/json" }) on this route, never express.json() first. Flask: request.get_data(). PHP: php://input.
  • Nothing in front of your server may rewrite the JSON.
  • Use this endpoint's whole whsec_ secret (the new one after a rotate), never the API key.
  • Your server clock must be within 5 minutes of the real time.

Refunds.

  • Crypto payments are final: Hidden does not send refunds for API payments.
  • To refund a buyer, send them the money yourself.

Errors.

Errors come as { "ok": false, "error": { "code", "message", "field" } } (responses).

400validation_error

A field breaks a rule. field names it.

Fix that field.

400site_not_allowed

returnUrl or cancelUrl is not on your websites.

Add the website. Match the origin exactly.

401unauthorized

Key missing or wrong. Also key_revoked, key_expired.

Use a valid key.

403insufficient_scope

The key lacks payments:write (scopes).

A new key with "Write" on "Payments".

403server_only

Created from a web page.

Call from your server.

403payments_off

A live payment, and the switch is off.

Add the website, then turn on the switch.

409reference_in_use

This reference is open with another amount, or expired a short while ago.

Cancel it, wait, or use a new reference.

409reference_paid

This reference is already paid.

Do not charge again.

429rate_limited

Too many requests. Also daily_limit, open_limit.

Wait Retry-After. Cancel unused payments.

Run your first paymentOne payment, part by part: request, page, webhook.Check the signatureDeliver once
API referencePayments: five calls, the payment object, statuses, events and errors.Create a paymentThe payment objectStatuses and eventsErrors