BROWSER HELPER
Use PBE-PAY without exposing merchant secrets.
The bundled sdk/paybyte-pay.js helper builds payment requests, status URLs and wallet handoffs. It does not hold private keys and it does not expose webhook-management credentials.
Load the helper
HTML
<script src="/sdk/paybyte-pay.js"></script>Create a request
JavaScript
const payment = await Paybyte.createPayment({
nodeUrl: 'https://paybyte.org',
recipient: 'pbe1YOUR_MERCHANT_ADDRESS',
amount: '25',
reference: 'order_8f42d1',
label: 'Golden Sword',
confirmations: 12
});
window.open(Paybyte.walletLink(payment, 'https://paybyte.org/wallet/'), 'paybyte-wallet');Read payment status
JavaScript
const status = await Paybyte.paymentStatus({
nodeUrl: 'https://paybyte.org',
reference: 'order_8f42d1',
recipient: 'pbe1YOUR_MERCHANT_ADDRESS',
amount: '25',
confirmations: 12
});
if (status.state === 'confirmed' && status.canonical) {
// Ask your backend to fulfil; do not grant valuable goods solely in browser JS.
}Webhook registration is server-side onlyThe JavaScript helper intentionally has no API for registering Commerce webhooks. Registration requires a bearer management token that must remain on the merchant server.
Browser security
Treat merchant labels as display text only. The wallet shows the authoritative destination and amount before signing. A hostile script executing on the wallet origin would be a wallet-origin compromise, so deploy a strict Content Security Policy and keep third-party script dependencies out of sensitive wallet pages.
