Skip to content

Guides

Hosted checkout and pay.js

Send buyers to our checkout, or open it over your page with one script.

Every invoice has a page: pay.perly.io/i/{id}. It is phone-first, works without an account and speaks the buyer's language. You never build a payment form.

Redirect

Create an invoice on your server and send the buyer to its url. Pass return_url to bring them back when it's paid.

js
const invoice = await pay.invoices.create({
  amount: 4800,
  currency: "USD",
  description: "Pro, one month",
  return_url: "https://example.com/thanks?order=1042",
});
redirect(invoice.url);

Overlay with pay.js

First allow your site: Settings → Checkout → Sites that may embed the checkout, one origin per line (https://yourshop.com). The checkout opens over the sites listed there only; anywhere else the button opens it in a new tab.

Then add the script once. Any element with data-perly-pay opens that payment link over your page.

index.html
<script src="https://pay.perly.io/pay/v1.5bdf2776ee74.js"
  integrity="sha384-W98ndu50hymNVBtxKpwAcr3BxXUEFVzpxXZGF4AzqToIFMBPrQFVd4H60xXBzVJZ"
  crossorigin="anonymous" defer></script>

<button data-perly-pay="coffee-beans">Pay with crypto</button>

The value is a payment link's slug. The overlay closes itself when the invoice is paid; your webhook still decides what to ship.

pay.js never sees keys or money. It only opens our checkout in a frame.

Which to use

You wantUse
No code at allA payment link
A button on your sitepay.js
A cart with its own totalAn invoice from the API, then redirect