Help Center Developer Docs Checkout Embed (checkout.js)

Checkout Embed (checkout.js)

Overview

checkout.js is a drop-in script that renders a Brykto payment button on your page. When clicked, it opens a payment modal. No redirects. No iframes.

Basic usage

<script src="https://bryktopay.com/checkout.js"></script>
<button data-button-id="bky_btn_xxxxxxxxxx">Pay now</button>

The data-button-id maps to a Checkout Button you create in your dashboard. The amount, currency, and success URL are stored server-side.

Creating a checkout button

  1. Go to Checkout Buttons in your dashboard.
  2. Click New button, fill in the details, click Create.
  3. Click Get snippet to copy your embed code.

Button attributes

Attribute Description
data-button-id Required. The bky_btn_... ID from your dashboard.

Events

The script dispatches a brykto:paid event on the window when payment is confirmed:

window.addEventListener('brykto:paid', function(e) {
  console.log('Payment confirmed:', e.detail);
});

Success redirect

Set a success_url when creating your checkout button. The customer is redirected there after payment confirmation. Leave it empty to stay on the same page.