SDK API Reference
Detailed reference for the browser SDK shipped at https://www.mimbla.com/js/sdk.js.
Initialization
const sdk = await Mimbla.init({
clientId: "YOUR_CLIENT_ID", // required
apiBase: "https://www.mimbla.com/api/v1/sdk", // optional override
});
All requests include MB-CLIENT-ID and default to Accept: application/json / Content-Type: application/json.
Mimbla.init preloads enabled cryptos and public rates so sdk.cryptos() and sdk.rates() are ready immediately. If you need a factory without preload, Mimbla.createClient(opts) returns the client without fetching cryptos/rates.
Data helpers
rates()
Returns the cached rates map (e.g., { BTC: { usd: 65998, eur: ... } }) fetched during init().
cryptos()
Returns the enabled cryptos list fetched during init().
Methods
createInvoice(payload)
POST /invoice
| Field | Type | Notes |
|---|---|---|
| amount | number | Required; must be >= 10 USD equivalent. |
| currency | string | Optional; default USD. Uses ISO code supported by platform. |
| crypto | string | Optional; ALL (default) or BTC, LTC, BCH, XMR. |
| due_date | string | Optional; m/d/Y, must be today or future. |
| close_url | string | Optional redirect target when user closes. |
| redirect_url | string | Optional success redirect target. |
| automatic_redirect | boolean | Auto-redirect after payment. |
| webhook_url | string | HTTPS URL to receive status updates. |
Response includes id (slug), invoice_url, amount, crypto, due_date.
note: popup helpers removed
The SDK no longer includes openInvoice or createInvoiceAndOpen. Use the returned invoice object and open invoice.invoice_url yourself if you need to show the hosted payment page in a new window.
getInvoice(slug)
GET /invoice/{slug}
Returns invoice details including status, amount, crypto, payment (if created), and URLs.
getInvoiceStatus(slug)
GET /invoice/status/{slug}
Returns a compact status payload for quick checks.
requestPayment(slug, body)
POST /invoice/rp/{slug}
| Field | Type | Notes |
|---|---|---|
| crypto | string | Required when invoice crypto = ALL (one of BTC, LTC, BCH, XMR). Omit when invoice has fixed crypto. |
Creates a payment address, amount in crypto, and exchange rates for the selected coin.
Error handling
Errors are thrown as Error with message and optional details (e.g., { status, payload }). Network failures throw Network error.
Environments
- Production default:
https://www.mimbla.com/api/v1/sdk - Override per-script with
data-api-baseor per-client withapiBaseincreateClient.
Headers used by the SDK
MB-CLIENT-ID: your client ID (required)Accept:application/jsonContent-Type:application/json
Rate limits & best practices
- Cache the
clientIdsecurely; do not expose any private API keys in the browser. - For fixed-crypto invoices, omit the
cryptofield onrequestPaymentto prevent mismatches. - Use
pollInvoicefor short-lived checkout sessions; for backoffice workflows prefer webhooks plus occasionalgetInvoiceStatusqueries. - For checkout flows prefer the hosted page and webhooks; avoid client-side polling in production.