unifi-pay-widget entry point has no React dependency. Use it when your application owns
all presentation or uses another framework.
Create a payment
createUniFiPayment validates and normalizes the input, generates a cryptographically random
32-byte session ID encoded as 64 hexadecimal characters, and returns the hosted checkout URL.
Input
Do not encode customer names, email addresses, order details, or other private data into a custom
session ID.
Check payment status
The client requests the same-origin/api/unifi proxy by default:
pending; a non-empty value maps to paid with the receipt ID.
Network errors, non-success responses, and invalid response bodies map to failed.
The paid state is the historical name for receipt detected. Check the receipt before confirming
the order:
Processing or Confirmed, wait 15
minutes before the next automatic check to conserve API credits. A user-triggered refresh may check
immediately. Stop automatic checks after Finalized, Failed, or Reorged.
Build a receipt link
Runtime requirements
Core helpers use Web Crypto, Fetch, URL, Request, and Response APIs. Modern browsers, Node.js 20+, Cloudflare Workers/Pages, Deno, and Bun provide these primitives. You can supply a customfetch
implementation to UniFiClient for another compatible runtime or for tests.
Add the protected status route
The browser client intentionally talks to your server, never directly to the secret-bearing API.