Help Center

Developers: the API and webhooks

For developers: the payment API, webhooks and their signatures, retries that never pay twice, API keys and testing in test mode.

283 answers across 14 topics

Every answer, by topic

Pick a topic or search. Open a question to read its answer, then go to the page behind it.

Developers26

Can I use my own button instead?

Yes. Any element on your page can open the checkout: call NuxoPay.open with the link, and the customer’s language if you know it. Buttons you add after the page has loaded are drawn with NuxoPay.init().

Read more on Payment Button

How does my page know the payment went through?

The checkout runs inside the modal, on our domain, and posts a message to your page when the payment confirms, so the page can move on without a reload. nuxo:payment_confirmed arrives once the payment is paid, or paid with more than was due, with its status. Check the origin before you act on it, and treat it as a hint for your screen only: fulfil the order from the signed webhook on your server, never from this message.

Read more on Widgets

Should I fulfil the order from that message?

No. The message is for the page. Fulfil the order from the signed webhook on your server.

Read more on Widgets

Does the modal close by itself?

If the payment names a success page, the modal closes itself a moment later with nuxo:close, after the customer has seen it confirm. Otherwise the customer reads the confirmation inside it and closes it when they like, with its close button, the Escape key or a click outside.

Read more on Widgets

Can I create and send invoices from my own system?

Yes. Create the invoice with POST /v1/invoices, send it with one more call, and hear back when it is paid. It is the same invoice, email and page as one made in the console, and invoice.sent, invoice.reminder_sent, invoice.overdue, invoice.paid, invoice.voided and credit_note.issued reach your server as they happen.

Read more on Invoices

How does a payment work through the API?

Your server creates the payment with POST /v1/payments, and the answer carries a payment_url. Send the customer there; your endpoint hears payment.pending and payment.paid, and the customer is sent back to your success_url. Or take the address, the amount and the QR code from the same answer and draw the screen yourself.

Read more on API Integration

What do I need to draw my own payment screen?

The answer carries the exact amount, a QR code as a base64 PNG of payment_uri, the address and expires_at. Show the amount to the last decimal and never round it, since a payment that arrives short waits as underpaid. On XRP Ledger, Stellar and Hedera the answer adds a destination_tag: show it beside the address, or the money cannot be matched to the payment.

Read more on API Integration

Can I price a payment in my own currency?

Yes. Send a currency and the amount is your price, in any of 150 currencies. It converts at a locked rate, and the answer shows both.

Read more on API Integration

What if the amount is too small to accept?

Each coin has a minimum payment, because a payment smaller than what it costs to collect is not worth taking. POST /v1/payments refuses an amount below it with a 400, and the answer carries min_amount, with min_amount_usd beside it when the coin has a price. GET /v1/network-coins gives each coin’s minimum as min_amount, so you can check before you ask. The create call has the last word, and a minimum moves with network costs, so read it from the API and never copy a figure into your code.

Read more on API Integration

What if the customer pays too little or too much?

If less arrives, the customer can send the rest to the same address and the payment moves to paid when it lands, or you accept what came with complete-underpayment. If more arrives, it is marked overpaid (payment.overpaid) and counts as paid, and the excess is held for the customer for 7 days: they claim it with the link we email them, or, for a payment shown on your own page, with the one-time claim link you pass on (it comes with the payment and its webhook). A refund from you in that time covers only the price. Your tolerance covers short payments only, and an excess that would cost as much to send back as it is worth stays paid, with nothing to ask for. A short payment nobody settles within 7 days goes back to the customer automatically, less the network fee.

Read more on API Integration

Is it safe to retry a request?

Yes. Send an Idempotency-Key and a repeat of the same request returns the first answer, marked Idempotent-Replayed. The same key with another body is refused.

Read more on API Integration

Can I build and test before taking real money?

Yes. A test key works only on testnets and sees only test data. You can create payments, hear the events, and move a test payment to paid, underpaid or expired yourself, then swap in a live key.

Read more on API Integration

Which events can my endpoint receive?

Every change in your account, in groups: payments, payouts, conversions, refunds, invoices, credit notes, subscriptions, customers, chain, balances, coupons, disputes, tax rates, support tickets, payroll, automatic withdrawals, approvals, compliance, stray deposits and earn. The chain group is for a network undoing a block that held a payment. An endpoint takes only the events you tick for it, a whole group or single events. Test mode has its own endpoints, and they hear test mode’s events only.

Read more on Webhooks

How many endpoints can I add?

Up to 16 in live mode and 16 in test mode, each with its own URL, events and secret. An event goes to every endpoint that asked for it.

Read more on Webhooks

What happens if my server is down when an event is sent?

The delivery is tried again, several times over about a day, until your server answers with a 2xx. If deliveries keep failing, the endpoint is paused and you are told by email and in the console; turn it back on once it is fixed, and send again anything it missed.

Read more on Webhooks

How quickly must my server answer a delivery?

Within 5 seconds. A slower answer is still delivered, but ten slow or failed deliveries in a row pause the endpoint, and with no answer within 8 seconds the delivery is tried again. Check the signature, answer with a 2xx once you have the event, then do the work after.

Read more on Webhooks

How do I check a delivery really came from Nuxo?

Each delivery carries a timestamp and a signature over the timestamp and the body, made with your endpoint’s own secret, in the X-Nuxo-Signature header. Check it on your server before you act on it, so neither can be changed or replayed later. The secret is shown once, when you create the endpoint or rotate it.

Read more on Webhooks

Can I change an endpoint’s secret without missing events?

Yes. Rotate it, and for 7 days each delivery is signed with both secrets, one signature for each, so your server can move to the new one in its own time. Revoke the old one sooner if you need to.

Read more on Webhooks

Can the same event reach my server twice?

Yes: any event can be sent again from the console to every endpoint that takes it, and it comes with the same event_id, so act on each event_id once. You can also send an endpoint a signed test event whenever you like, to see your server answer.

Read more on Webhooks

What if the network undoes the block that held a payment?

A blockchain can, rarely, replace its latest blocks. If that happens to the block that held a payment, the payment goes back to pending, waiting for confirmations, and we look for it again on the new chain. Your endpoint receives chain.reorg with the payment ID, the network and whether it is recovering by itself or needs our review. Fulfil an order only from the signed payment.paid, and treat chain.reorg as the reason a payment you saw paid is not any more.

Read more on Webhooks

Do I need to install an SDK?

No. Nuxo is plain HTTPS and JSON with your key in a header, so the HTTP client your stack already has is the SDK, in any language. Every answer comes in the same envelope: code, data and output.

Read more on SDKs

How does my server sign in to the API?

Your key goes in the header as Authorization: Bearer $NUXO_API_KEY, read from your environment and never written into your code. Its secret is shown once, when it is made, and a key can be revoked at any time.

Read more on SDKs

Can I limit what a key can do?

Yes. Each key acts as one role, in live or test mode, and a role is a list of permissions, the same ones your team’s roles are made of. A call the role does not allow is answered 403, and nothing is done.

Read more on SDKs

Where can API calls come from?

Only from the addresses on your IP whitelist, single addresses or ranges. Until the list has an entry, every call is refused.

Read more on SDKs

Could sending a request again make a second payment?

Not with the same Idempotency-Key: you get the first answer back, marked Idempotent-Replayed, not a second payment. The same key while the first request still runs is answered 409, to send again shortly, and the same key with another request is refused with a 409. A key is kept per mode for 24 hours. If a payout, refund, transfer or conversion request died without an answer, its key is held for 24 hours and answers 409 unresolved: check what it created before you send anything again.

Read more on SDKs

Can I build the whole integration in test mode first?

Yes. A test key reaches only test mode, on testnets, with its own books. When it all works, a live key takes the same code live.

Read more on SDKs

Try it before you pay anything

Test mode costs nothing and keeps its own balance, apart from your live one.