Skip to content

Crypto processing docs: an order per payment for website checkout - #106

Open
coolkonstantincool wants to merge 30 commits into
docs/crypto-processing-rewrite-20261125from
feat/crypto-orders-20261126
Open

coolkonstantincool wants to merge 30 commits into
docs/crypto-processing-rewrite-20261125from
feat/crypto-orders-20261126

Conversation

@coolkonstantincool

@coolkonstantincool coolkonstantincool commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What changes for the reader

The crypto processing guide describes the new website integration: the merchant adds checkout once, and for every payment the merchant's server creates an order with its API key. The pages no longer tell a website to use one payment link per order or to sign with the wallet key.

Note

Stacked on docs/crypto-processing-rewrite-20261125. Code: Unigox/account#880, Unigox/api#100, Unigox/unigox.com#1494 (the audits are attached there). Head: e10f39d.

Page Change
Get started, Website checkout, Confirm payments, Reference, Test and go live The order flow end to end: the API key created in step 3 of the portal's setup, the page code for each way, the server request, reading the order; every field, limit, status and error code; when a status is final; what happens to a transfer after an order's time; the rule for a repeated reference; one API key per account
Website checkout What the payer sees as the screens show it today: no cancel on the payment page, no hash entry while a payment is awaited
Deposit pages and signed links Kept for deposit pages and links a server signs itself; no longer presented as the way to integrate a website
openapi/swagger.yaml The five order and customer operations with the answer envelope, every error, and examples validated against real answers
Media 42 pictures and the setup GIF retaken on the current screens

Checked

CI: test runs node --test scripts/*.test.mjs on every pull request. Every check and flow of the feature: CI and acceptance report.

What Result
node --test scripts/*.test.mjs 38 of 38
Every fact about orders against the account code 64 facts; audit 1
The docs against the screens 10 differences with the screens and 7 with the code fixed; audit 2
Every order code sample run against a stand or parsed (21 samples)

🤖 Generated with Claude Code

coolkonstantincool and others added 25 commits November 26, 2026 16:35
…ount answers them

POST/GET /api/v1/partner/crypto/orders, POST .../{id}/close, PUT/GET .../customers/{external_id}
under a Crypto Processing tag: the {status, code, data} envelope, every field of the order and its
payments, the {status, code, details, field} error with each code and its HTTP status, the 401
bodies of the gateway and of account, and examples that validate against the schemas.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…the API key

Get started gains the website in four steps (API key, checkout.js with a token function, one
request on the server, read the order). Website checkout opens an order in all its ways; no link to
choose or paste. Confirm payments reads the order first: statuses, received, payments, the 15-minute
margin, repeats by reference, closing. Links from your server becomes Deposit pages and signed links,
scoped to what an order does not do; its shop server example is cut. The reference gains the Orders
API, its limits and errors. checkout-integration.md is rebuilt.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…g entry

The test pinned the links page's former title in the changelog; it now pins the new one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
merchantName in every order answer, currency (USD only, else 400 currency), description at most 140
characters, the character rules of the texts the payer reads. Statuses: an unpaid order ends as
expired 15 minutes after its time whatever came; a transfer sent inside the window counts when it is
credited later; when a status is final. A closed or expired order that turns paid holds its reference
again; closing an order paid at that moment answers order_already_paid. Only the account whose wallet
receives the payments keeps addresses ready. checkout-integration.md rebuilt.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…follow the new setup screen

Retaken on the build where the setup has no order to choose: the way, the code for the site, the request for the
server, the check. Checked frame by frame.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… samples table carries its marks

The portal shows this code and its rule is no "credit" in what a merchant reads; the web copy is made from here
now, so the wording lives here. The marks let the web repo check the table against the samples it is generated from.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s invoiceId; the checkout's statuses are not the order's

- The Node.js route of Website checkout sent `customer: {}` for a cart without a customer, which the API refuses
  (400, field customer.id), so the route answered 502 to every guest. It sends `customer` only with an id.
- The payload's `invoiceId` is the order's id (`ord_…`) for an order; the reference text only for a payment link.
- Payment statuses: said once that they are the checkout's, not the order's (`underpaid` vs `partly_paid`,
  `underpaid_closed` vs `expired`/`closed`), and that the server ships by the order's status.
- An order that has already ended when the checkout loads sends no status; only a paid one calls onComplete.
- A repeated create changes nothing in the order.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- closedAt of a paid order is when Unigox found it paid, and the payment window ends 15 minutes after closedAt.
- 15 minutes after expiresAt only an order still open or partly_paid ends as expired; a closed one stays closed.
- In the 15 minutes after expiresAt an open or partly_paid order still holds its reference (200 on a repeat).
- Customers: "" clears a name or email; a request without a body is 400 body; refusals name customer.id,
  customer.name, customer.email; an id with "/" cannot be used in the path, even encoded.
- Errors: the 401 body carries the reason as text; 403 for a suspended partner; which wrong types are field body;
  a repeat of an existing order still answers 200 past the limit before verification.
- Get started: until the portal has reserved addresses, a create answers 409 no_free_addresses.
- The confirm job reads every order whose status is not final, not only open ones.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…eceived and a customer id with "/"

- 401: `error` is a text in both cases; the spec described an object {code, message} without a key, which account
  never sends ("missing API key. Provide X-API-Key header or Authorization: Bearer token").
- 403 `partner access is suspended` named in the tag's description.
- closedAt of a paid order: when Unigox found it paid; received: credited to the order (inside its window).
- 15 minutes after expiresAt only an open or partly_paid order ends as expired.
- 400 `body` examples; the customer id in the path cannot hold "/".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…er is refused

The page's order request rejects on an answer that is not ok or has no token and payUrl; the button comes back and a
visible sentence says the payment could not be started (payment button, embedded checkout, own frame, the fallback
without checkout.js, onError TOKEN_MISSING / TOKEN_TIMEOUT). The own frame makes its order on the press, not on load.
The payment page way has its full server route: the order's page on success, a plain sentence on a refusal, never the
API's JSON. The Node route says a new attempt needs a new reference; the repeated-reference bullet states the
15 minutes after expiresAt. Get started carries the same button and route as Website checkout.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…expiresAt, the API key only, the CSV source values

A repeat of a reference returns the same order also in the 15 minutes after its expiresAt; an order that is not paid
frees its reference after them or when it is closed (Confirm payments, Reference, Test and go live, swagger). The
order and customer routes take the API key only: a portal sign-in answers 403. The payments file's source column
lists its values, website_checkout among them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…hen the order is refused

As the HTML examples: the order request rejects on an answer that is not ok or has no token and payUrl, the button
comes back and the payer reads "The payment could not be started. Please try again."; onError TOKEN_MISSING /
TOKEN_TIMEOUT does the same; nothing opens or mounts an undefined token or URL. The order is made on the press:
React's and Vue's checkouts inside the page are now a button that creates the order and mounts the checkout in its
place (they took a token made elsewhere). PHP answers a refusal, or an answer without the order's page, with a plain
sentence and logs the API's code.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…to the portal

account refuses a portal session token on the five order and customer routes with
{"status":"order_failed","code":403,"details":"api_key_required"} (cryptoCheckoutAPIKeyOnly). Reference: a row in the
error table and the sentence under Orders API. swagger: the tag's description, both 403s of the create operation as
named examples, a 403 response on the read, the close and both customer operations, and the code in
CryptoCheckoutError.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nd does not wrap mid-word

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…up, step 3

The pages sent the reader to a partner page with a Generate button; the key is now made under the server's request
(Create API key, confirm, shown once), and a new key replaces the one before at once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ount's key, the strict amount and body, the one API key, the reference's 15 minutes in the spec, names as on screen

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d in step 3

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The status table and the sample states said the payer can cancel on the page. No screen has that control (the list
under the payment step was removed); the status stays in the protocol for older integrations and is described as that.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… now

The payment page has no hash entry while a payment is awaited, and an expired or closed order takes none: the merchant
finds the transfer in Payments. A payment link has no pay-by field; an invoice has a due date.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…gainst the code

Read as a backend developer who has never seen the product, job by job (get a key, put the checkout on the site,
create an order, say who the customer is, repeat an order, handle what goes wrong, know it is paid, close, every
refusal, test, go live, reconcile), then every fact against the account service, the gateway and checkout.js.

What changed for the reader:
- A payer who comes back after the order's time: the server routes (Node, Next.js, PHP) close the expired order and
  create it again; a page that keeps its checkout object drops it on `expired` or `closed`. Proven on the stand:
  the status reaches the page when the time runs out; an order opened after it sends none.
- The address pool said plainly: 10 free addresses of each type, added only while the portal is open; with it closed
  the server can create 10 orders, then `409 no_free_addresses`.
- Customers: what a customer is for, where it shows, who reads the name and e-mail (only the merchant: the payment
  page never shows them), what a guest order looks like, that `customer.id` is required.
- Refusals as the gateway answers them: the body of a request with no key, an unknown key, `502`, and that these
  requests have no request limit of their own today.
- The limit before verification is a limit on creating, checked at creation; payments to what exists still arrive.
- The span of time in which a transfer counts is the "payment period" on every page ("window" stays the checkout
  over the page); when a status is final is one testable rule.
- Content-Security-Policy: inline scripts need a nonce or a hash; the page sends no cart id or amount.
- The export's columns in full; a test payment is real coins; who may create the key and what it looks like.
- Fifteen sentences that said little or said it three ways are rewritten or cut.

Tests: node --test scripts/*.test.mjs, 38 of 38.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d a still

Get started now has a section of its own for the partner API key: where the
button is (Checkout, any way, step 3; or Developers, Website checkout), the
confirmation the portal asks for, the key shown once (64 characters, 0-9 and
a-f), keeping it on the server as UNIGOX_API_KEY, a one-request check (404 =
the key works, 401 = it does not, 403 = suspended or a session token),
keeping it secret, replacing it (one key at a time, so a short window of 401
and how to keep it short), and what to do if it leaks. Checked against
account CreateAPIKey / ReissueAPIKey and the partner auth middleware, and
the 404/401 answers on the stand.

The other pages (website checkout, reference, testing) link to the section
instead of repeating it; the reference's troubleshooting gains a 401 row.
checkout-integration.md rebuilt with scripts/build-checkout-one-page.mjs.

Pictures from the portal's sample mode (made-up merchant and key):
api-key.gif (the docs GIF settings, 880 wide, 76 frames) and api-key.png
(step 3 with the new key).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Confirm payments: a TON hash a customer gives is their own sending transaction; Unigox records the payment under
  the transaction in which the payment address received the coins (found 404 from_tx_not_found with the sender's
  hash on the real run). Say which hash to use and how to find it.
- Deposit pages and signed links: "Close a link" now has endReservation() (signed Unlock); the guide had no code
  for it. The run executed it as written: ended, a second call 409 memo_lock_not_active, the link check UNLOCKED.
- Customers: the Orders API customers and the portal's customers (Deposit addresses, the invoice form) are two
  separate lists; the reference and the invoice steps say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…step height (1160 px), so it does not jump

The partner run measured a 592 px jump of the frame when the checkout reported its height (560 px start).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (Open a business account)

Found by the onboarding end-to-end run of 2026-11-27: signed in, the page's button reads Open a business account and
leads to the same onboarding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he merchant sees what is left to do

The portal's limit band now says each verification stage's own next step (start or continue the verification,
answer the reviewer, wait for the review, see the decision), so the table no longer tells everyone to press
"Verify business". Same words in checkout-integration.md, checkout-quickstart.md and checkout-reference.md; the
web's copies follow through crypto-checkout-guide-sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coolkonstantincool

Copy link
Copy Markdown
Contributor Author

2026-11-28 63ba28c: the 403 merchant_unverified_limit row says where the merchant sees what is left to do (the portal band now names each verification stage's next step) in checkout-integration, quickstart and reference. node --test: 38/38. Context: https://github.com/Unigox/unigox.com/pull/1494#issuecomment-7244488231

coolkonstantincool and others added 2 commits November 29, 2026 06:48
…words

"Until your business is verified, it can receive up to 1,000 USD in total" read as a cap on receiving. The line
now says what the guides say: orders, payment links, invoices and deposit addresses can be created while the
business has received less than 1,000 USD; after that new ones are refused with 403 merchant_unverified_limit
until it is verified, and payments to what exists keep arriving. node --test: 38/38.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hallstain
hallstain marked this pull request as ready for review December 2, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants