Skip to main content
Embed checkout in your website. Customers fund payments themselves, or your application handles funding through a signed transfer callback.
Your backend creates the signed link. The Onstacks widget sends funding instructions to your frontend; your backend verifies them before your wallet transfers funds.
1

Create your widget

In the dashboard, select Sandbox → Settings → Ramps → Website widget. Create a widget and allow your website’s exact origin, such as http://localhost:3000.Choose how the payment is funded:
  • Customer sends the crypto: use the standard embed below.
  • Your app sends the crypto: also enable Allow partner transfer delegation, copy the widget signing secret, and follow the partner setup on this page.
Sandbox and Live have separate widget settings and secrets. Keep all signing secrets on your server.
2

Load the SDK and open checkout

Create src/lib/onstacks.js in your frontend. The same loader works across frameworks and waits for the SDK before opening checkout.The SDK loads from the hosted script; no npm install is required.
src/lib/onstacks.js · Frontend
In your frontend checkout component, import the loader and call openCheckout from your button. Adjust the import path to your project:
Checkout component · Frontend
Connect openCheckout to your frontend button. Use the same loader and checkout function above for every framework; handle loading and errors in your existing UI.
In your checkout component, call openCheckout from onClick. In Next.js App Router, add "use client" at the top of the component file. Keep SDK loading inside the click handler.
Checkout component · Frontend
The customer completes sign-in, verification and payment details inside the widget. Use type: "onramp" for buying crypto. For inline checkout, use sdk.mount(element, target, callbacks) after loading.
For a standard embed, setup is complete. View payments in Ramps → Widget payments. Continue below only if your application will send the crypto.
3

Partner funding: sign the link on your server

Use this instead of the options object above when your application will send the crypto. Load the order from your authenticated database; keep the same order.id when retrying it.In your backend, create services/onstacks.js. Call this helper from your authenticated order endpoint and return { signedUrl: widgetLink(order) } to your frontend.
services/onstacks.js · Backend
Server configuration: WIDGET_ID and WIDGET_SECRET come from your widget settings; APP_ORIGIN is your allowed website. Set WIDGET_ORIGIN to https://ramp-sandbox.onstacks.io for Sandbox or https://ramp.onstacks.io for Live. wallet is the sending wallet.
4

Receive the provider wallet and send the crypto

In your frontend checkout component, replace openCheckout with this handler. Your backend supplies signedUrl; orderId is your order reference:
Checkout component · Frontend

Expected payload

The Onstacks widget sends this instruction to your frontend callback. This shortened example uses placeholder addresses and credentials:
transfer.required · Widget payload
The full payload also includes tenantId, workspaceId, environment, customerId, organizationId, beneficiaryHash and issuedAt. Pass the original complete payload to your server. V2 omits requestedAmount and currency.Send amountRaw of tokenAddress from sender to address on chainId. amountRaw is a decimal token amount, including funding charges—not integer units or the fiat payout. With ethers, convert it using parseUnits(instruction.amountRaw, instruction.decimals). Sandbox can use mainnet assets: 8453 is Base mainnet.fundOrderOnce is a frontend orchestration helper you implement, not an SDK method. It calls your authenticated backend to verify/reserve the instruction, invokes your connected wallet for the swap/transfer, then calls your backend to durably save the hash and queue submission. Return { txHash } only after recording it. Your secret, signature verification and database operations stay on the backend. Never repeat a completed swap or resend after an uncertain broadcast. Copy the verifier and see the server contract.Return { outcome: "cancelled_before_broadcast" } only after your wallet confirms cancellation before any broadcast and your backend safely clears the funding reservation. This lets reply.rejected enable the widget’s retry action. A timeout, lost hash-recording response or generic wallet error is uncertain: reconcile it, keep the reservation and do not call reply.rejected or send again. A completed swap stays completed.
5

Submit and track from your server

Use the verified payment’s paymentRef, submissionToken and environment to submit through the public Onstacks API. Use environment=live for Live payments:Send this request from your backend submission worker to https://api.onstacks.io:
Submit funding · Backend
Read status with GET on the same URL and Authorization header. Your server should retry submission with the same hash and continue tracking after the widget closes. reply.sent reports the transfer; it does not send funds or confirm bank payout.

Response and payment states

POST and GET return the same public envelope (example; placeholders are not credentials):
Public API response
data.payoutStatus is the provider/local payment status and may be null. Use data.status for the overall delegated flow. HTTP 200 confirms the request was handled, not that funds reached the bank. An immediate POST can already return a later state if verification progressed.Other lifecycle states (creating, provider_requested, payout_claimed) mean work is underway: wait, do not fund again. retryable permits resuming intent preparation through the widget; first reconcile any wallet broadcast in your own ledger. HTTP 409 means a conflicting funding hash: reconcile rather than replace it. On transient server errors, retry the same saved hash or poll status.
Reuse the same reference and details to resume a payment. Changed details require a new reference, which does not cancel the old payment. Track funding in your database to prevent duplicates.

Troubleshooting

No funding callback? Complete checkout, load SDK 1.3.0, enable delegation and sign delegateTransfer=true. widget.ready does not contain a wallet address. Confirm payment through your server or dashboard; browser callbacks are not proof of payout. Keep signing secrets and submission tokens out of browser logs.