DigiPay embed demo

This page exercises digipay.js. It's not a merchant-facing page — just a harness.

1. Declarative checkout trigger

Any element with data-digipay-checkout + data-session-id opens the hosted checkout as an in-page modal on click.

<script src="/embed/digipay.js"></script>
<button data-digipay-checkout data-session-id="ses_...">Pay with DigiByte</button>

2. Programmatic API

DigiPay.checkout({ sessionId: 'ses_...' });
DigiPay.close();

2b. Match your shop's theme (optional)

Pass theme: 'light' or 'dark', or add data-theme to an auto-bound element. Without it, the checkout follows the shopper's own choice or device. Any other value is ignored.

DigiPay.checkout({ sessionId: 'ses_...', theme: 'light' });
<button data-digipay-checkout data-session-id="ses_..." data-theme="dark">Pay</button>

Tip buttons too:

Tip 1 DGB (light)

2c. Know when it's paid: onStatus and onSuccess

onStatus gets { sessionId, status } on every status change; onSuccess gets the same once, when the payment is confirmed. The modal closes closeDelay ms later (2500 by default). Fulfil orders from your webhook: a browser callback is a hint, not proof.

DigiPay.checkout({
    sessionId: 'ses_...',
    onStatus: function (e) { console.log(e.sessionId, e.status); },
    onSuccess: function (e) { showThankYou(e.sessionId); },
    closeDelay: 1500,
});
Callbacks appear here. Uses the session above, or creates a demo session.

3. Donation / tip button

DigiPay.button({ address: 'dgb1...', amount: 5, name: 'Creator' });

4. Declarative button

<span data-digipay-button data-address="dgb1..." data-amount="2.5">Tip</span>
Tip 2.5 DGB

With DigiDollar too: add your store id. The tip page offers DGB and DD while your store accepts DigiDollar.

<span data-digipay-button data-address="dgb1..." data-store="sto_..." data-currency="DD" data-dd-amount="5">Tip in DGB or DD</span>

5. Full lifecycle simulation live sandbox

Walks a fresh sandbox session through all its state transitions without needing a chain tx. Renders the checkout inline (not as a modal) so the Advance buttons stay reachable.

Not started. Click "Create session" to begin.

Each Advance click walks the session pending → detected → paid → confirmed. The status pill flips, QR / countdown stay live throughout.