JS library

<script src="https://pay.example/static/monokulo-client.js"></script> adds one global, window.Monokulo, with two functions. No build step, no dependencies. Monokulo's address is taken from the script's own URL unless you pass endpoint.

Monokulo.createOrder(params) → Promise<Order>

ParamTypeWhat it is
publicKeystring, requiredThe store's pk_….
amountnumber or string, requiredThe price, in currency.
currencystring, required"XMR", or a currency the store's exchange rate provider prices ("EUR").
merchantOrderIdstring, optionalYour own order or cart id, kept with the order and shown on its page in the dashboard.
endpointstring, optionalMonokulo's address, if it can't be read from the script tag.

Resolves to { orderId, address, xmrAmountPiconero, amount, currency, merchantOrderId, expiresAt, endpoint, publicKey }. Rejects with an Error carrying Monokulo's message. If Monokulo asks a busy visitor for a proof of work, the library solves it and tries again by itself.

Monokulo.mount(target, orderOrId, options?) → { iframe, destroy() }

target is a selector or an element; its content is replaced by the checkout's iframe. orderOrId is the object from createOrder, or an order id (then pass endpoint and publicKey in options, say after a reload). Mounting the same element again replaces the old checkout; destroy() removes it and stops listening.

OptionTypeWhat it does
onStatusChange(status, data) => voidEach new status, from the order's live updates (server-sent events, polling as a fallback).
onPaid(data) => voidThe status became paid or overpaid. A hint for the page: trust the webhook.
onExpired(data) => voidThe status became expired.
theme"light" or "dark"Pins the checkout's theme; left out, it follows the customer's device.
refundfalseHides the refund-address form.
width, heightCSS lengthThe iframe's size (420px × 900px unless set).
endpoint, publicKeystringOnly when mounting a bare order id.

Status values: pending, unconfirmed, confirming, partial, paid, overpaid, expired. Updates stop at paid, overpaid or expired.

When is an order really paid?