Embed, API & SDKs

One-line payment buttons, a drop-in Add Funds module, a REST API for everything, and official SDKs. Pick the lightest tool that does the job.

Payment button (one line)

The universal embed is a single script tag that renders a themed Pay with U.CASH button. It makes no client-side API calls - it is a plain link - so it works on any host, including BigCommerce, Wix, Squarespace, and hand-rolled HTML:

<script src="https://pay.u.cash/embed.js"
  data-cloud="YOUR_CLOUD_TOKEN"
  data-amount="5.00"
  data-currency="USD"
  data-title="My Product"
  data-redirect="https://shop.com/thanks"></script>

Attributes:

AttributeRequiredDescription
data-cloudYesYour store's Cloud Token (see below)
data-amountYesAmount, e.g. 5.00. Non-numeric values are rejected
data-currencyNoFiat currency, default USD
data-titleNoProduct name shown on the checkout
data-redirectNoWhere the buyer lands after paying
data-external-referenceNoYour order id; auto-set to embed_<hex> otherwise
data-button-textNoCustom label; defaults to a localized "Pay with U.CASH"
data-themeNodark (default) or light

Each click creates a fresh checkout - embeds are intentionally not idempotent.

What the buyer sees

The hosted checkout is a single focused flow: the amount (or pay-what-you-want input), tax line, any custom fields, and the method grid - coin tiles grouped by network, plus card, PayPal, Lightning, and one tile per bank rail. On paying, a QR code and the exact address/amount appear (with copy buttons and wallet-extension buttons like MetaMask, TronLink, Phantom, and TonKeeper where enabled); detection and confirmations tick live, then the receipt screen shows the transaction hash with an explorer link.

Buyers can retry a failed payment on the same link, and machine clients (AI agents) get an HTTP 402 payment manifest from the same URLs instead of HTML - see Agents & x402.

The Cloud Token

The Cloud Token identifies your store on public, buyer-facing surfaces. It is publishable: it goes in embed snippets and checkout links. Your API key is different - it is a server-side secret that can read transactions and change settings. Never put the API key in a snippet.

  • Find the Cloud Token in the console under Account → Stores (per-store).
  • Fetch it programmatically with function=get-cloud-token using your API key.

Add Funds module

If your product runs on U.CASH accounts (white-label partners, apps), one script gives every page a balance top-up widget:

<script src="https://pay.u.cash/topup.js" async></script>

It mounts a + action on the account balance widget and opens a themed modal with Credit (USD) and UCASH tabs - presets and minimums included, live UNITS conversion for UCASH, and theme-following via Shadow DOM (no style or CSP conflicts). On completion it fires a uxc:topup-complete event on document so your page can refresh balance displays.

Return URLs are allowlisted to *.u.cash hosts over HTTPS; the module never bounces users to third-party sites.

REST API

Everything the console does is available over HTTPS POST to https://pay.u.cash/api.php (form-encoded, function= dispatch). Authenticate with the X-Api-Key header - the header is preferred over a POST field because it stays out of access logs.

Common functions

FunctionKey parametersPurpose
create-transactionamount, cryptocurrency_codeCreate a checkout/invoice
invoice / payment-linktransaction_idGet a shareable payment URL
get-transaction / get-transactionstransaction_idStatus and history
check-transactionstransaction_idForce a re-scan of pending payments
get-fiat-valueamount, cryptocurrency_code, currency_codePrice a coin amount in fiat
get-exchange-ratescurrency_code, cryptocurrency_codeRate lookup
vat / vat-validationamount / vat_numberTax math and VAT number checks
save-checkout / get-checkoutscheckout / checkout_idManage saved payment links
get-cloud-token-Retrieve the publishable store token
test-connection-Authenticates with the Cloud Token and sends a signed test webhook to your webhook URL, reporting the HTTP status and whether the signature verified

Example

curl https://pay.u.cash/api.php \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d function=create-transaction \
  -d amount=25.00 \
  -d cryptocurrency_code=

Successful responses are {"success":true,"response":...}; errors are structured {"success":false,"error_code":...,"message":...} - parse error_code, not prose. Get your API key from Settings → API key.

Buyer-side creation (no API key)

Creating a buyer checkout with only a Cloud Token is public by design - that is what embeds use - via POST https://pay.u.cash/payment/ajax.php with function=create-transaction. The token is the credential; keep the API key server-side.

SDKs and plugins

The full catalog - 125+ open-source plugins, SDKs, and bots - lives at pay.u.cash/plugins and on GitHub under UdotCASH. Highlights:

  • E-commerce gateways: WooCommerce (wc-ucashpay), Magento 2, BigCommerce, PrestaShop, OpenCart, Shopify (see Shopify)
  • Frameworks: React, Vue, Svelte, Next.js, Flask, FastAPI, Django, Laravel, Rails, Go, .NET, Rust, and more
  • Agents: npm install @ucash/agents and pip install agents-u-cash for the x402 protocol (see Agents & x402)
  • Mobile & game: Flutter, React Native, Android, Unity, Godot