Munim Technologies

Errors

Error types, HTTP status codes, and how the SDK reports them.

Error responses

Every error is JSON with a type, a readable message that says what to do, and param when one field is at fault. Messages are written to be shown to a developer or read by an agent as they are.

Response
{
  "error": {
    "type": "invalid_request",
    "message": "unit_amount must be at least 50.",
    "param": "unit_amount"
  }
}

Types and status codes

StatustypeMeans
400invalid_requestA field is missing or wrong. param names it.
401authenticationNo key, a revoked key, an expired sandbox, or a test key on the live API (or the other way round).
402processorStripe or PayPal refused or failed, for example on a refund. (402, not 502, so the body always reaches you.)
403forbiddenNot allowed: a read-only key making a change, view-only team access, Munim Autopilot Pricing not turned on, or a step only a person can do.
404not_foundNo such object, or no such endpoint. The message says which.
409conflictThe object's state doesn't allow it: refunding a disputed payment, claiming a sandbox twice, or connecting the same database again.
413too_largeAn export over 50,000 rows. Narrow the dates or make a report.
429rate_limitedToo many at once, for example sandboxes from one address, or five reports already building. Try again later.
500internalSomething broke on our side. Safe to retry reads; email [email protected] if it keeps happening.

In the SDK

Every failure throws a MunimBillingError with type, status (null when there was no response), param and message. Its type is one of invalid_request, authentication (also used for 403), not_found, conflict, processor, internal, connection (network failure or timeout; the default timeout is 30 seconds) and signature_verification (a webhook that didn’t verify).

Node
import { MunimBilling, MunimBillingError } from 'munim-billing'

try {
  await munim.transactions.refund('txn_…')
} catch (err) {
  if (err instanceof MunimBillingError) {
    console.log(err.type, err.status, err.param, err.message)
    if (err.type === 'processor') {
      // Stripe or PayPal said no: retry later or tell the person
    }
  }
  throw err
}

Common mistakes

MessageFix
Munim Billing secret keys start with mb_test_sk_ or mb_live_sk_You passed another key (perhaps a Stripe one). Create a key in the dashboard.
MunimBilling uses your secret key and must run on your serverYou created the client in a browser or an app. Create checkouts on your server and send only the url to the client.
Webhook signature does not matchVerify the raw request body, not JSON.stringify(req.body), with that endpoint's secret from the right mode.
Webhook timestamp is outside the toleranceYour server's clock is off, or you're replaying an old delivery.
Web Crypto (crypto.subtle) is not availableUse Node 20 or newer.
This sandbox expired because nobody claimed itMake a new sandbox, or sign in with an email.