A lightweight, dependency-free script for adding a Payracle checkout popup to any website — no build step, no framework required.
Installation
Add the script tag anywhere on your page:
Usage
Only ever use your public key (pk_live_... / pk_test_...) in this widget — it runs entirely in the browser, visible to anyone who views your page source. Your secret key must never appear in client-side code.
Options reference
How it works
Calling .open() does three things:
- Shows a loading overlay while it calls
POST /api/v1/checkout/initialize with your public key.
- Opens a centered modal with a blurred backdrop, loading the returned
checkout_url in an iframe — this is a dynamic virtual account generated for this exact payment.
- Listens for a
postMessage event from the checkout page when payment succeeds, fires onSuccess, then auto-closes the modal after a short delay.
The widget resolves its own API base URL from the <script> tag’s own src, so it works identically whether loaded from api.payracle.com or a self-hosted mirror.