HBank merchant API
Take payments on your website, in your shop or at a terminal. Version 1.
Getting started
- Open Business in online banking and choose your business. No business yet? Write to business@bank.thehsi.cloud.
- Under API keys, create a key. It's shown once: store it on your server, never in a web page or app.
- Under Callback URLs, add the HTTPS address HBank asks to approve your payments (see Callbacks). The hosted checkout needs one; QR code payments use it when you set one.
- Choose where payouts go: the business's own card, or one of your cards.
Clients for Python, TypeScript, .NET, Java, PHP, Go and Ruby: SDK downloads.
All endpoints below are relative to
https://bank.thehsi.cloud/api/v1
Authentication
Send your API key as a bearer token with every request. The key identifies your business; there's no separate merchant id.
Authorization: Bearer YOUR_API_KEY
| Status | Body (text/plain) | Meaning |
|---|---|---|
| 401 | API key is missing | No Authorization: Bearer … header. |
| 403 | Invalid API key | The key doesn't exist, was revoked, or the business is inactive. |
Responses and errors
Requests and responses are JSON (Content-Type: application/json). Successful responses have "success": true;
failures have "success": false and a machine-readable error, with a 4xx/5xx status.
{ "success": false, "error": "invalid_amount" }
| Error | Status | Meaning |
|---|---|---|
| invalid_request | 400 | The body isn't a JSON object. |
| missing_parameters | 400 | A required field is missing. |
| invalid_amount | 400 | Not a number, not above 0, or 0 after rounding to the currency. |
| unknown_currency | 400 | Not a supported ISO currency code. |
| transaction_not_found | 404 | No such payment, or it belongs to another business. |
| transaction_not_payable | 404 | The payment is no longer pending, or isn't yours. |
| conversion_unavailable | 503 | Exchange rates can't be fetched right now. Try again later. |
Amounts are decimal numbers in the currency's major unit (12.5 = 12.50). They may also be sent as strings ("12.50").
Taking a payment
- Create a payment request on your server with the amount and currency. You get a
transaction_id: a random string liketx_8fK2mQ7xRb4Tn9WcYz3LpH6v. Store it as text (up to 40 characters), not as a number. - Let the customer pay, in one of three ways:
- show a QR code or link: HBank customers pay it in online banking (or with card and PIN on the page);
- open the hosted checkout (card number and PIN), for example with the pay button.
- Approve it when HBank calls your callback URL (if the payment has one).
- Confirm it with payment details:
statusiscompletedand there's areference. Always check on your server before handing out goods.
A pending request stays payable for one hour; after that it's removed. If the customer's card refuses the payment, the request stays
pending and they can pay with another card.
POST /payment/request
Creates a pending payment request.
| Field | Type | |
|---|---|---|
| amount | number | Required. Above 0, rounded to the currency's decimals. |
| currency | string | Required. ISO code, e.g. EUR. |
| description | string | Shown to the customer when they pay, and in their history. |
| callback_url | string | Where HBank asks you to approve the payment. Must lie under one of your callback URLs. Required for the hosted checkout. |
curl -X POST https://bank.thehsi.cloud/api/v1/payment/request \
-H "Authorization: Bearer $HBANK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 24.90, "currency": "EUR", "description": "Order 1042",
"callback_url": "https://shop.example.com/hbank/callback"}'
{ "success": true, "transaction_id": "tx_8fK2mQ7xRb4Tn9WcYz3LpH6v" }
POST /payment/code
Gives a pending request a QR code. Put url in a QR code (or use the ready-made qr_svg), print it on a receipt or
send it as a link. Scanning it with any phone camera opens the payment page; HBank customers pay in online banking.
Calling it again for the same request returns the same code.
curl -X POST https://bank.thehsi.cloud/api/v1/payment/code \
-H "Authorization: Bearer $HBANK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"transaction_id": "tx_8fK2mQ7xRb4Tn9WcYz3LpH6v"}'
{
"success": true,
"code": "q3V0b2tlbl9hYmNk",
"url": "https://bank.thehsi.cloud/p/q3V0b2tlbl9hYmNk",
"qr_svg": "https://bank.thehsi.cloud/p/q3V0b2tlbl9hYmNk/qr.svg"
}
The page at url also offers /status (JSON) for showing progress on a screen next to the QR code.
POST /payment/details
The current state of one of your payments.
curl -X POST https://bank.thehsi.cloud/api/v1/payment/details \
-H "Authorization: Bearer $HBANK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"transaction_id": "tx_8fK2mQ7xRb4Tn9WcYz3LpH6v"}'
{
"success": true,
"transaction": {
"id": "tx_8fK2mQ7xRb4Tn9WcYz3LpH6v",
"type": "payment",
"amount": 24.90,
"currency": "EUR",
"status": "completed",
"description": "Order 1042",
"reference": "HB20261021AB123456",
"payment_code": "q3V0b2tlbl9hYmNk",
"refunded": 0.00,
"refundable": 24.90,
"refund_of": null,
"subscription_id": null,
"subscription_ids": []
}
}
reference is set once the payment is completed; payment_code once a QR code was issued.
refunded is what you've refunded so far, refundable what you still can. A refund is a transaction too
(type refund), with refund_of pointing to the payment. A
subscription's payment has its subscription_id; subscription_ids lists
every subscription the payment belongs to (several for a checkout of several).
POST /payment/refund
Gives money back for a completed payment: all of it, or part of it, as often as you like up to the amount paid.
The customer gets it back on the card and account they paid with, right away, and sees it in their history
(with your reason, if you give one). The fee they paid isn't refunded.
| Field | Type | |
|---|---|---|
| transaction_id | string | Required. One of your completed payments. |
| amount | number | In the payment's currency. Left out: everything that's left. |
| reason | string | Up to 200 characters, shown to the customer. |
curl -X POST https://bank.thehsi.cloud/api/v1/payment/refund \
-H "Authorization: Bearer $HBANK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"transaction_id": "tx_8fK2mQ7xRb4Tn9WcYz3LpH6v", "amount": 10.00, "reason": "Returned one item"}'
{
"success": true,
"refund": { "id": "tx_Qn4Wc8TzLp2JrXv6AhYe3MsB", "amount": 10.00, "currency": "EUR", "reference": "HB20261103KQ482913", "reason": "Returned one item" },
"transaction": { "id": "tx_8fK2mQ7xRb4Tn9WcYz3LpH6v", "amount": 24.90, "refunded": 10.00, "refundable": 14.90, … }
}
The money comes from the account the payment was paid into, as the same share of what you received for it, so a currency conversion back then doesn't cost you anything now. If the customer's account uses another currency, they get the amount converted at today's rate. You can also refund from the merchant portal: the button next to a payment under Recent activity.
| Error | Status | Meaning |
|---|---|---|
| transaction_not_found | 404 | No such payment, or it's another merchant's. |
| not_refundable | 409 | Not a completed card payment, or already refunded in full. |
| insufficient_funds | 409 | The account the payment went to doesn't have enough money. Nothing was refunded. |
| invalid_amount | 400 | Not above 0, or more decimals than the currency has. |
| amount_too_high | 400 | More than what can still be refunded. |
| invalid_reason | 400 | The reason is longer than 200 characters. |
| conversion_unavailable | 503 | Exchange rates can't be fetched right now. Try again later. |
Failed refunds also carry a readable message. Refunds are safe to retry after a timeout: check
refunded with payment details first, so you don't refund twice.
POST /subscriptions
Charges a customer automatically every period. You offer a subscription; the customer opens its link (or scans its
QR code), or clicks your pay button, and subscribes in HBank's checkout, paying
the first period right away. In the checkout they choose whether it ends by itself (after a number of periods or
years; customers on Basic and up). After that
HBank charges every period on its own, until the customer or you cancel. Each charge is an ordinary payment to you
(with the usual fee, paid by the customer, and refundable), carrying subscription_id in
payment details. You can also offer and cancel subscriptions in the merchant portal.
| Field | Type | |
|---|---|---|
| amount | number | Required. Per period. |
| currency | string | Required. ISO code, e.g. EUR. |
| interval | string | Required. day, week, month or year. |
| interval_count | number | Every how many intervals, 1 to 120. Default 1. |
| description | string | Up to 200 characters, shown to the customer. |
curl -X POST https://bank.thehsi.cloud/api/v1/subscriptions \
-H "Authorization: Bearer $HBANK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 9.99, "currency": "EUR", "interval": "month", "description": "Pro plan"}'
Every subscription answer (here, from GET /subscriptions/{id}, GET /subscriptions and
POST /subscriptions/{id}/cancel) looks like this:
{
"success": true,
"subscription": {
"id": "sub_Hk3Rt9WzQe5NcXa2LpVb7YdF",
"status": "active", // offered, active or canceled
"active_period": true, // within a period that's been paid for
"amount": 9.99, "currency": "EUR", "interval": "month", "interval_count": 1,
"description": "Pro plan",
"url": "https://bank.thehsi.cloud/s/Xk2dP0q_l3ZtY8rA", // send this to the customer
"qr_svg": "https://bank.thehsi.cloud/s/Xk2dP0q_l3ZtY8rA/qr.svg",
"subscribed_at": "2026-10-03T09:12:44Z", // when the customer first subscribed
"subscribed_for_days": 31, // how long it's been going (until now, or until it ended)
"subscribed_for_seconds": 2698211,
"canceled": false, "canceled_at": null, "canceled_by": null, // customer, merchant or bank
"current_period_start": "2026-11-03T09:12:44Z",
"current_period_end": "2026-12-03T09:12:44Z",
"next_charge_at": "2026-12-03T09:12:44Z", // null once canceled, or when the customer's chosen end comes first
"ends_at": null, // the customer's automatic end: no renewal from then on (null = until canceled)
"last_day": null, // with an end: the day the last paid period ends
"charges": 2,
"last_error": null, // why the last renewal was refused, while it's retried
"customer": { "name": "Ada Lovelace" }
}
}
- Canceled subscriptions aren't charged again, but stay in their
active_perioduntilcurrent_period_end: give access until then. - Renewals are charged like any payment with the customer's card: they only take the account below 0 when
the customer allowed that for the card. If the card refuses one (balance too low, blocked, over a spending limit), it's
retried for 3 days and then canceled (
canceled_by:bank). - Ending by itself: customers can choose (and later change, under Subscriptions in online banking)
when a subscription ends. It's then canceled at
last_daywithcanceled_by:schedule. - Errors:
invalid_amount,unknown_currency,invalid_interval,invalid_description(400),subscription_not_found(404),already_canceled(409).
POST /subscriptions/checkout
Lets customers subscribe with the pay button, like a payment: create the subscription and its first
payment in one call (same fields as POST /subscriptions, plus callback_url), then hand the
transaction_id to the button the way you would for /payment/request. The checkout tells the
customer they're subscribing, shows how often it's charged and lets them choose when it ends. Paying starts the
subscription. Your callback_url is asked before the first charge, like for any payment.
curl -X POST https://bank.thehsi.cloud/api/v1/subscriptions/checkout -H "Authorization: Bearer $HBANK_API_KEY" -H "Content-Type: application/json" -d '{"amount": 9.99, "currency": "EUR", "interval": "month", "description": "Pro plan",
"callback_url": "https://shop.example/hbank/callback"}'
{ "success": true, "transaction_id": "tx_Vd5sA1nXq8ZrJ2uGk7Ee0CwM", "subscription": { "id": "sub_Hk3Rt9WzQe5NcXa2LpVb7YdF", "status": "offered", ... } }
For a subscription you've already offered, POST /subscriptions/{id}/checkout (optional
callback_url) returns a new transaction_id for it. Once someone has subscribed, the answer is
not_open (409). The paid message the button sends carries the transaction_id;
its payment details have the subscription_id.
Several subscriptions in one checkout
Send subscriptions, a list of up to 20, instead of the offer's fields. Each entry is the id of a subscription
you've offered ("sub_…", or {"id": "sub_…"}) or a new offer's fields (amount,
currency, interval, interval_count, description). Optional:
description for the payment (left out, the subscriptions' descriptions) and callback_url.
All of them have to be in the same currency. One payment charges the first period of each (their sum) and starts them
all, with the end the customer chooses in the checkout; after that every subscription renews, ends and is canceled
on its own.
curl -X POST https://bank.thehsi.cloud/api/v1/subscriptions/checkout -H "Authorization: Bearer $HBANK_API_KEY" -H "Content-Type: application/json" -d '{"subscriptions": ["sub_Hk3Rt9WzQe5NcXa2LpVb7YdF", {"amount": 2.50, "currency": "EUR", "interval": "week", "description": "Support"}],
"callback_url": "https://shop.example/hbank/callback"}'
{ "success": true, "transaction_id": "tx_Vd5sA1nXq8ZrJ2uGk7Ee0CwM", "subscriptions": [ { "id": "sub_Hk3Rt9WzQe5NcXa2LpVb7YdF", "status": "offered", ... }, { "id": "sub_…", ... } ] }
- The subscriptions come back in the order you listed them. When one is refused, nothing is offered and the answer
says which (
"Subscription 2: …"). - If one of them gets subscribed to some other way before this payment, the payment can no longer be made and none of them start.
- The payment's details list every subscription it started in
subscription_ids(subscription_idstays for payments of one subscription). - Errors:
invalid_subscriptions,duplicate_subscription,mixed_currencies, an offer's errors (400),subscription_not_found(404),not_open(409).
Hosted checkout
For customers paying with card number and PIN. After creating the request, open this page in a popup (the pay button
does it, or window.open() from your page: the checkout reports to the window that opened it, and closes itself without one):
https://bank.thehsi.cloud/api/payment?tid=TRANSACTION_ID
The customer sees your business name, the description and the amount, signs in with their card and PIN, and confirms.
The request needs an authorized callback_url; HBank calls it before charging the card.
Closing the pay button's popup without paying marks the payment aborted.
What /api/payment?tid=… answers, and to whom
| Request | Answer |
|---|---|
A page load: the popup, a tab, a link (Sec-Fetch-Mode: navigate, or anything that isn't the lookup below) |
302 to /pay/request, the checkout page, with a cookie for this payment. Errors (missing, malformed or
unknown tid) get a small HTML error page with status 400 / 404. |
The pay button's lookup: a script's fetch(), recognized by Sec-Fetch-Mode: cors with
Sec-Fetch-Dest: empty (browsers without fetch metadata: an Origin header) |
An empty 204 with Access-Control-Allow-Origin: * and Cache-Control: no-store
(400 / 404, also empty, when the tid is missing, malformed or unknown). No cookie,
no redirect: it only tells the SDK that this is HBank's checkout. |
Until 9 November 2026 the lookup got {"success": true, "transaction_id": …}; nothing read it. When in doubt HBank
treats a request as a page load, so a window never shows that answer.
How long a checkout link works
- The link (
/api/payment?tid=…) works as long as the payment ispending: up to one hour, then the request is removed. - Once opened, the checkout must be finished within 5 minutes: the cookie for the payment lasts that long. After that, the next step ends on error page 1000. Opening the link again starts over.
The checkout's error pages:
| Page | Shows | Why |
|---|---|---|
| /error/0 | Unknown Error | The checkout has no window that opened it (a link opened in a tab, noopener), or its page data is missing. |
| /error/1000 | Invalid Transaction ID | No payment cookie: the checkout wasn't opened through /api/payment, or its 5 minutes are up. |
| /error/1001 | Transaction Not Found | The payment doesn't exist (any more): removed after an hour, or never created. |
| /error/1002 | Transaction isn't Pending | It's already paid, aborted or declined; or a subscription's offer that's no longer open. |
| /error/1003 | Redirect URL Invalid | The request has no callback_url, or it isn't under one of your authorized callback URLs. |
| /error/1004 | Transaction Currency Invalid | The payment's currency isn't supported. |
Callbacks
If a payment has a callback_url, HBank asks it to approve the payment right before charging the customer:
POST https://shop.example.com/hbank/callback
Content-Type: application/json
HBank-Event: payment.approval
HBank-Signature: t=1700000000,v1=ecafa4f7ee46afc951d376d4086a6200c3e600d87a3414b53c8141b75fc2403f
{"id":"tx_8fK2mQ7xRb4Tn9WcYz3LpH6v","amount":24.9,"currency":"EUR","status":"awaiting_approval","description":"Order 1042"}
status is always awaiting_approval: nothing is charged yet. (Until 9 November 2026 it said completed.)
Answer with status 200 and JSON within 10 seconds:
{ "resume": true } // charge the customer
{ "resume": false, "error": "Out of stock" } // refuse; the customer sees the error
Anything else (another status, no JSON, a timeout) refuses the payment. Callback URLs must use HTTPS, and lie under
one of the callback URLs in your business settings: same host and port, and the same path or one below it.
https://shop.example.com/hbank allows https://shop.example.com/hbank/callback, but not
https://shop.example.com/hbankfoo.
Checking the signature
Every callback is signed with your business's signing secret (Business → your business → Callback URLs; you can replace it there).
v1 is the hex HMAC-SHA256 of "<t>.<raw body>" with the secret, t the time in Unix seconds, like
webhooks (the example above is signed with the secret hbcb_example). Refuse a callback whose signature doesn't match or whose t is more than 5 minutes off.
Check it on the raw body, before parsing it.
import { createHmac, timingSafeEqual } from "node:crypto";
app.post("/hbank/callback", express.raw({ type: "application/json" }), (req, res) => {
const sig = Object.fromEntries((req.get("HBank-Signature") ?? "").split(",").map((p) => p.split("=")));
const expected = createHmac("sha256", process.env.HBANK_CALLBACK_SECRET).update(`${sig.t}.`).update(req.body).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(sig.t)) <= 300;
if (!fresh || !sig.v1 || sig.v1.length !== expected.length || !timingSafeEqual(Buffer.from(sig.v1), Buffer.from(expected)))
return res.json({ resume: false, error: "Invalid callback" });
const cb = JSON.parse(req.body);
res.json(orders.matches(cb.id, cb.amount) ? { resume: true } : { resume: false, error: "Out of stock" });
});
The SDKs do this for you (verify_signature /
verifySignature / VerifySignature). Also check that id and amount match an order you created,
and confirm with payment details before handing out goods.
GET /currency/convert GET /currency/rate
Exchange rates as HBank uses them. Parameters go in the query string (or a JSON body).
curl "https://bank.thehsi.cloud/api/v1/currency/convert?amount=100¤cy_from=EUR¤cy_to=USD" \
-H "Authorization: Bearer $HBANK_API_KEY"
{ "success": true, "amount": 108.37 }
curl "https://bank.thehsi.cloud/api/v1/currency/rate?currency_from=EUR¤cy_to=USD" \
-H "Authorization: Bearer $HBANK_API_KEY"
{ "success": true, "from_rate": 0.9228, "to_rate": 1.0837 }
to_rate converts currency_from into currency_to; from_rate the other way. Rates aren't rounded.
GET /currencies
Every currency HBank supports: the codes accepted wherever an endpoint takes a currency.
curl https://bank.thehsi.cloud/api/v1/currencies \
-H "Authorization: Bearer $HBANK_API_KEY"
{ "success": true, "currencies": [
{ "code": "USD", "name": "United States Dollar", "symbol": "$", "decimal_places": 2 },
{ "code": "EUR", "name": "Euro", "symbol": "€", "decimal_places": 2 },
{ "code": "CHF", "name": "Swiss franc", "symbol": "CHF", "decimal_places": 2 }
] }
Statuses
| pending | Created, waiting to be paid. |
| completed | Paid. reference is set. Final. |
| aborted | The customer closed the checkout without paying. Final. |
| declined | An app the customer let into the checkout declined it (see Apps in the checkout). Final. |
Fees
Payments of 100 or more (in the payment's currency) carry a 2% fee, paid by the customer on top of the amount; smaller payments are free. You receive the full amount, converted into your payout account's currency.
SDK changelog
Each build of hbank.js has its own address and never changes once published, so you can pin it with its integrity hash.
Newest first. Moving to a newer build is a matter of replacing the script tag; the migration notes say what else, if anything.
Support: every build listed here is still served and works. A build that has to stop working is announced here at least 6 months before. The button frame and the checkout run on HBank's side, so changes there reach every build, pinned or not; they're listed below with their date.
v26w45.94828a9 9 November 2026 latest
Errors from your endpoint, a readable build.
- An endpoint that can't create a payment can say so: a
4xx/5xxanswer (with JSON{"error": "…"}) ends the payment asfailed,reasonendpoint_error,messageyour text. Before, the popup opened your error page and closed after 5 seconds withcheckout_timeout. - A checkout HBank doesn't know (a wrong or deleted
tid) fails withcheckout_not_found. - In both cases your endpoint isn't called a second time.
- Status objects have
message. - Not obfuscated any more: minified with a source map, and a readable copy (links below).
Migrating: Optional: answer errors with a 4xx and JSON {"error": "…"} (see When the endpoint can't create a payment). Endpoints that only redirect need nothing.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w45.94828a9"
integrity="sha384-/61FBwv6TvRqKv9idlAtgXLSgOLmbLdWpI/2Pg2IrdhQ6axQ+FfNcOjkofiZzS+n" crossorigin="anonymous" defer></script>
Readable: /assets/hbank.src.js?v=v26w45.94828a9 · source map: /assets/hbank.js.map?v=v26w45.94828a9
v26w45.0675797 9 November 2026
The popup only shows HBank's pages.
- On a click, the SDK requests your endpoint itself with
fetch()and opens the checkout it redirects to; the popup shows HBank's loading page meanwhile, never your site. - If the lookup doesn't work (no redirect to the checkout, a CORS or network failure, a CSP without
connect-srcfor HBank), it opens your endpoint in the popup like before.
Migrating: Allow HBank in your Content Security Policy's connect-src, and make sure your endpoint answers a plain GET (with your cookies) with a redirect to the checkout. See the contract.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w45.0675797"
integrity="sha384-G8d+C5/XhvSdng41aPTvNhmJs8J7HkPfj7dSm2a9iZ9LEspm8roQvH0tfbsIFYfH" crossorigin="anonymous" defer></script>
Obfuscated; no readable copy was kept for this build.
v26w44.0314dd3 2 November 2026
Your own endpoint, events, and waiting for the result.
- The
endpointattribute: any path on your page's host (before: always/pay). It may change at any time. - The
dataattribute, passed to the endpoint as?data=. - The
hbank-paymentevent andwaitForPayment(); statusesstarted,pending,paid,aborted,failed.
Migrating: Nothing required. Set endpoint to use another address than /pay.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w44.0314dd3"
integrity="sha384-VF4QDnjs8pWleXdzC25mHMFBPojhLCmvuyAcEMojH9aZ7nfux9C4e+bi5aV2+l3q" crossorigin="anonymous" defer></script>
Obfuscated; no readable copy was kept for this build.
v26w30.3a64958 2 August 2026
Maintenance build.
- Same behaviour as
v26w08for your page.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w30.3a64958"
integrity="sha384-rnZvpL+XbXuwKgvLN3fQqb2VCuiX6lva5Zarf+o87cy+BE0NgEg2lkynCggo3pG3" crossorigin="anonymous" defer></script>
Obfuscated; no readable copy was kept for this build.
v26w30.db9b50e 2 August 2026
Maintenance build.
- Same behaviour as
v26w08for your page.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w30.db9b50e"
integrity="sha384-9He5irMfZfZaXCHDHeH89eIMumCWLM6xfUi2s7ZfHDnCEsT/y0ScqJvzgwHCdCVx" crossorigin="anonymous" defer></script>
Obfuscated; no readable copy was kept for this build.
v26w13.47871e8 4 April 2026
Maintenance build.
- Same behaviour as
v26w08for your page: always opens/pay.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w13.47871e8"
integrity="sha384-Vi/dkp7AbqndUB90WJD+BMtpJs7gX6lDTwQZCrOtfhGVD6qYQzHuhPADUixbBsFf" crossorigin="anonymous" defer></script>
Obfuscated; no readable copy was kept for this build.
v26w08.6e1b21f 28 February 2026
The first published build.
<hbank-pay-button>andgetPaymentStatus(). A click opens/payon your site in the checkout popup.- No detailed notes were kept for builds before
v26w44; they behave alike.
<script src="https://bank.thehsi.cloud/assets/hbank.js?v=v26w08.6e1b21f"
integrity="sha384-QvZIm4SrsWXPjRGSlZINYr/CH7bJU507v56cj/wWr6j92Er+qosz0NLRN/f51Tb6" crossorigin="anonymous" defer></script>
Obfuscated; no readable copy was kept for this build.
Changes on HBank's side (all builds)
11 November 2026: Transaction ids are random strings (all builds)
transaction_idis no longer a number that counts up but a random string liketx_8fK2mQ7xRb4Tn9WcYz3LpH6v: in the API's answers, in/api/payment?tid=…, in the callback'sid, and in what the button reports. Store it as text (up to 40 characters)./api/payment?tid=…only accepts the new id.payment/details,payment/codeandpayment/refundstill accept the number of a payment made before, with your API key.- Nothing changes in the button itself: every build passes the id through as it is.
- Subscriptions, accounts, cards and customers get random ids too:
sub_…,acc_…,card_…andcus_…(strings, up to 40 characters). A subscription'sidand thesubscription_idin a payment's details aresub_…;GET /subscriptions/{id},/canceland/checkouttake it; the number of a subscription isn't accepted any more. The same goes for the user API (/me, accounts, cards,from_account_idandto_account_idof a transfer), the webhooks'account_id,card_idandsubscription_id, and what apps in the checkout are sent.
9 November 2026: Checkout lookups get an empty answer; callbacks are signed
/api/payment?tid=…answers a script'sfetch()(and only that) with an empty204instead of JSON; page loads get the checkout. See the checkout entry.- Payment approval callbacks carry
HBank-Signature, and"status": "awaiting_approval"instead of"completed". See Callbacks. - A payment an app of the customer's declines in the checkout (see Apps in the checkout) ends as
failedwithreasondeclinedright away, instead of onlyabortedonce the popup is closed.
9 November 2026: The checkout popup only ever shows HBank's pages (all builds)
- Builds before
v26w45still open your endpoint in the popup, but it must now reach HBank's checkout within 5 seconds, or the button closes it and the payment fails withcheckout_timeout. Before, there was no limit. - A popup that leaves HBank once it's there is closed at once:
failed,left_checkout. - For
v26w45and newer: your endpoint gets 15 seconds to answer the lookup; the loading page says it's taking longer than usual after 5.
User API
Customers can use their own account from scripts and apps: their balances, history and subscriptions, and sending money. We don't recommend it to most customers: a token works without the password, two-factor sign-in and payment codes.
Every token has only the permissions it was given, so one can read the history while another only sends money. Each permission
is a bit; a set of permissions is one number, the sum of their bits, and that number is the scope of
the authorize link (names, space- or plus-separated, still work). The bits never change. Tick what you need, or type a number to see
what it holds:
| Permission | What it allows | Bit | |
|---|---|---|---|
| profile:read | See your name and email address | 1 | |
| accounts:read | See your accounts, balances and cards | 2 | |
| transactions:read | See your transaction history | 4 | |
| subscriptions:read | See your subscriptions | 8 | |
| subscriptions:cancel | End your subscriptions | 16 | |
| transfers:send | Send money from your accounts, without a payment code | 32 | |
| checkout:hook | Hear about your payments in the checkout as they happen (the amount) | 64 | |
| checkout:card | See which card you pay with in the checkout · needs checkout:hook | 128 | |
| checkout:merchant | See which shop you pay in the checkout, and its account · needs checkout:hook | 256 | |
| checkout:user | See your name and email address when you pay · needs checkout:hook | 512 | |
| checkout:page | Show its own page while you pay, before the payment can go on · needs checkout:hook | 1024 | |
| checkout:decline | Decline your payments in the checkout · needs checkout:hook | 2048 |
accounts:read transactions:read
https://bank.thehsi.cloud/authorize?client_id=app_…&redirect_uri=https://your.app/callback&scope=6&state=RANDOM
Any checkout:… permission brings checkout:hook along. Checkout permissions are only for registered apps
(with a checkout address), not personal tokens. Tokens and GET /me carry both forms: scope/permissions
(names) and scope_bits/permission_bits (the number).
A personal token: Profile → Advanced → Create a personal token. Name it, pick its permissions, wait out the
warning, confirm with the code from the email, and copy the token (it starts with hbu_ and is shown once). Send it like an API key:
Authorization: Bearer hbu_…
Cards. When a permission reaches cards or accounts (all but profile:read), the customer either
allows all cards (including ones added later) or selects cards, and can change it at any time in
Profile → Advanced. With selected cards, a token sees only those cards, the accounts they belong to, the transactions that went through
them (or through no card on such an account) and the subscriptions paid with them; it can only send money from (and between) those
accounts. Anything else answers as if it didn't exist. GET /me says which: "card_access": "all" or "selected".
An endpoint the token has no permission for answers 403 with {"success": false, "error": "missing_permission", "permission": "…"};
a missing, unknown or revoked token 401.
Registering an app
An app other customers can let in needs registering first, like a GitHub OAuth app: Profile → Advanced → Your apps (for developers) (/profile/apps). Give it a name (customers see it), optionally a description and homepage, and the redirect addresses customers may be sent back to (HTTPS, exact match, up to 5). You get
- a client ID (
app_…): public, it goes in the link; - a client secret (
hbs_…): shown once, kept on your server. You can make a new one at any time.
If you own a business, you can publish the app under it (Published by, when registering or in the app's settings): customers then see the business as its developer, on the consent page and in their settings, and the business's page lists it. You keep managing the app.
The app's page shows how many customers use it and how old it is; customers see the same on the consent page, and a warning while the app is less than 30 days old. Deleting the app revokes everyone's access.
User endpoints
| Endpoint | Permission | |
|---|---|---|
| GET /me | any | The customer's id, the token's permissions and card_access;
name, email and plan with profile:read (else null). |
| GET /me/accounts | accounts:read | Accounts with balance and cards. |
| GET /me/transactions | transactions:read | Newest first. account_id (an account's id), limit (up to 100), before (the next_before of the last page, a transaction id).
direction is out (amount with fees) or in (what arrived, in the receiving account's currency). |
| GET /me/subscriptions | subscriptions:read | All subscriptions. |
| POST /me/subscriptions/{id}/cancel | subscriptions:cancel | Ends it; it runs until the paid period ends. |
| POST /me/transfers | transfers:send | JSON from_account_id (an account's id, like acc_…), amount, note, and
to_card_number (anyone's card) or to_account_id (an own account's id). Returns the reference. |
Apps in the checkout
An app with checkout permissions takes part in the payments of the customers who let it in: a budget guard can stop a payment, a parental-control app can ask first, a loyalty app can show something. It works for every payment in HBank's checkout, a subscription's first payment included (not for automatic renewals, which have nobody to show a page to). Set your app's checkout address on its page (Settings); a signing secret appears under Checkout.
1. HBank asks your server
After the customer entered card and PIN (and the code from the email, if they ask for one), and before they confirm, HBank POSTs to your checkout address, once per payment and app. Only payments with a card the customer let your app see (all cards, or the selected ones) are sent. With several apps, they're asked in the order they were let in.
POST https://your.app/hbank/checkout
HBank-Event: checkout
HBank-Signature: t=1700000000,v1=HMAC-SHA256(signing secret, "1700000000.<body>")
{
"type": "checkout",
"step_id": "cs_…",
"payment": {"amount": 12.5, "currency": "EUR", "subscription": null},
"card": {"id": "card_8fK2…", "number": "DE •••• •••• 01", "label": "Main card", "account_id": "acc_Zq7…"}, // checkout:card
"merchant": {"id": 2, "name": "Test Shop", "account_id": "acc_Vd5…", "card_number": "DE •••• •••• 99"}, // checkout:merchant
"user": {"id": "cus_Xe0…", "name": "Ada Lovelace", "email": "ada@example.com"}, // checkout:user
"permissions": ["checkout:hook", "checkout:card", …],
"permission_bits": 1216
}
subscription is {"interval": "month", "interval_count": 1} for a subscription's first payment.
subscriptions lists every subscription the payment starts (amount, currency,
interval, interval_count, description): one, or several when a merchant puts more
than one in a checkout (subscription is then null); null for an ordinary payment. Check the
signature (and that t is recent) like a webhook's.
2. You answer, within 5 seconds
| {"action": "continue"} | Nothing to add: the payment goes on. |
| {"action": "decline", "reason": "Over your weekly budget"} | Needs checkout:decline. The payment is declined;
the customer sees "Your App declined this payment: …" (the reason, up to 200 characters, is optional). |
| {"action": "page", "url": "https://your.app/hbank/ask?step=cs_…", "continue_button": true, "resume": "page"} | Needs checkout:page. Your page is shown as a step of the checkout (below). url must be on your checkout address's
scheme, host and port. continue_button (default true): the customer also gets HBank's Continue button; false:
only you can let the payment go on (the customer can still cancel it). resume: page (default; your page or your
server can resume) or server (only your server). |
No answer in time, an error status, unknown JSON, or an action you don't have the permission for: your app is passed over and the payment
goes on. A decision that must hold (a parent's approval) belongs on your server: "continue_button": false, "resume": "server".
3. Your page in the checkout
HBank fetches your page and shows it in the checkout in an iframe, under a banner of its own that names your app and says the step isn't
HBank's. /checkout/frame/cs_…/p/<path> is <path> on your host, so relative links, your page's own
files and forms (GET and POST) work; root-relative (/…) and other hosts' addresses don't. Your server sees neither the customer's
cookies nor IP: requests come from HBank with HBank-Checkout-Step: cs_… and HBank-Signature: t=…,v1=HMAC(secret, "t.cs_…").
Cookies you set aren't passed on; carry what you need in the address. The page is sandboxed (scripts and forms run, with no access to HBank's
page) and works for 30 minutes. Redirects stay within your host. HTML, CSS, JavaScript, JSON, images and fonts up to 2 MB.
Your page gets a small API:
HBank.checkout.step // "cs_…"
HBank.checkout.resume() // let the payment go on (with "resume": "page")
HBank.checkout.decline(reason) // decline it (checkout:decline)
These run in the customer's browser. From your server, with the customer's token:
| Endpoint | Permission | |
|---|---|---|
| GET /checkout/steps/{step_id} | checkout:hook | status (continued, page,
resumed, declined, failed), resolved_by, payment_status. |
| POST /checkout/steps/{step_id}/resume | checkout:page | Lets the payment go on; the checkout notices within seconds. |
| POST /checkout/steps/{step_id}/decline | checkout:decline | JSON reason (optional). Declines the payment. |
A step that's already resumed or declined answers 409 step_closed. A declined payment can't be paid any more and shows in the
customer's history as declined by your app.
Webhooks
Customers add up to five webhooks in Profile → Advanced, each with the events it gets:
| transaction.created | A payment or transfer from one of their accounts (card payments, sent money, paid requests, subscription renewals). |
| money.received | Money arrived from someone else. |
| subscription.created | They subscribed to something. |
| settings.changed | A setting changed: data.setting says which (profile, password, two_factor, banking, webhook.created…). |
| login.new | A sign-in to online banking, with IP, location and whether it's a new place. |
| ping | The Send test button. |
Each is a POST with a JSON body {"id": "evt_…", "type": "…", "created_at": "…", "data": {…}} and the headers
HBank-Event, HBank-Delivery (the id) and
HBank-Signature: t=UNIX_TIME,v1=HEX
where v1 is HMAC-SHA256 with the webhook's signing secret over t + "." + body. Check it, and reject old ts.
Answer with a 2xx; anything else is tried again after 10 seconds and after a minute.