Browser SDK Overview
Use the Mimbla JavaScript SDK to create invoices from the browser and open the hosted payment page in a popup (PayPal-style). It talks to the /api/v1/sdk endpoints and authenticates with your MB-CLIENT-ID.
Quick start
<!-- Load the SDK -->
<script src="https://www.mimbla.com/js/sdk.js" data-api-base="https://www.mimbla.com/api/v1/sdk"></script>
<script>
(async () => {
const sdk = await Mimbla.init({ clientId: "YOUR_CLIENT_ID" });
// Preloaded data
const rates = sdk.rates();
const cryptos = sdk.cryptos();
// Create an invoice (amount in USD, accept any crypto)
const invoice = await sdk.createInvoice({ amount: 25.5, currency: "USD", crypto: "ALL" });
// The SDK no longer opens popups. Use `invoice.invoice_url` or `invoice.url_slug`
// to open the hosted page yourself, e.g. `window.open(invoice.invoice_url)`.
})();
</script>
Script tag options
src:https://www.mimbla.com/js/sdk.jsdata-api-base(optional): override the default API base. Defaults tohttps://www.mimbla.com/api/v1/sdk.
Authentication
Every request adds the header MB-CLIENT-ID: <your_client_id>. Generate and manage client IDs in your Mimbla dashboard.
Supported operations
init({ clientId, apiBase? })— initializes the client, preloads enabled cryptos and public rates.rates()— returns cached rates map (e.g.,{ BTC: { usd: 65998, eur: ... } }).cryptos()— returns enabled cryptos list.createInvoice(payload)— POST/invoicecreateInvoiceAndOpen(payload)— create invoice then open popup.openInvoice(invoice)— open hosted payment page in a popup.getInvoice(slug)— GET/invoice/{slug}getInvoiceStatus(slug)— GET/invoice/status/{slug}requestPayment(slug, { crypto })— POST/invoice/rp/{slug}
Payload basics
createInvoice
amount(number, required): minimum $10 USD (or equivalent).currency(string, optional): defaultUSD.crypto(string, optional):ALL(default) or a specific coin (BTC,LTC,BCH,XMR,USDT_ERC20,USDT_BEP20).due_date(string, optional):m/d/Yformat.close_url,redirect_url(string, optional): return URLs after payment.automatic_redirect(boolean, optional): auto-redirect on completion.webhook_url(string, optional): receive status updates.
requestPayment
- For invoices created with
crypto = ALL, pass{ crypto: "BTC" | "LTC" | "BCH" | "XMR" | "USDT_ERC20" | "USDT_BEP20" }. - For invoices created with a fixed crypto, omit the
cryptofield.
USDT Network Selection
- Use
USDT_ERC20for Ethereum (ERC-20). - Use
USDT_BEP20for BNB Smart Chain (BEP-20). - For fixed-crypto invoices, set the network-specific symbol in
createInvoice.
Styling
This SDK no longer renders a payment card. Use openInvoice to show the hosted payment page in a popup, or build your own UI and call the endpoints above.