JS button guide
The hosted script /js/cxpay-button.js (versioned, no dependencies) mounts buttons that call POST /public/checkout-sessions and open hosted checkout. Amount, currency, description, and success/cancel URLs are configured on the dashboard payment button — the browser never chooses the price. Secret API keys never appear in page source.
- In /install, create a publishable key (
cxpay_pk_test_/cxpay_pk_live_). When logged in, snippets are pre-filled with your key. - Create a payment button with a fixed USD amount and optional success/cancel URLs.
- Paste the snippet below.
data-amount/data-currency/data-descriptionare for your page label; checkout uses the button config.data-order-refis sent asorderReference(and order number metadata). Optionaldata-customer-emailis stored on the invoice/intent.
<script src="https://cxpay.cash/js/cxpay-button.js"></script>
<button
type="button"
class="cxpay-pay"
data-key="cxpay_pk_live_YOUR_PUBLISHABLE_KEY"
data-button="btn_YOUR_BUTTON_ID"
data-amount="10.00"
data-currency="USD"
data-description="Order #1001"
data-order-ref="1001"
data-customer-email="[email protected]"
>
Pay with CX Pay
</button>Optional: data-api to override the API base. Call CxPay.mount() if you inject buttons after load. Legacy alias: /js/cxpay.js loads the same script.
No JavaScript? Use the hosted checkout snippet.