Credits & Billing
Megomi is credit-metered: each resolved video job spends 1 credit. Credit is held and spent through Mayar, our payment provider — this API never touches your card, VA, or QRIS details directly.
Buy credit
Section titled “Buy credit”POST/api/credits/checkout
Returns a Mayar-hosted checkout link. On your key’s first checkout this also registers you as a Mayar customer — email is required then, and reused automatically on every later checkout. name and mobile are required on every call.
Request body
Section titled “Request body”| Name | Type | Required | Description |
|---|---|---|---|
creditAmount |
number | Yes | Number of credits to buy, must be positive |
email |
string | Only on first checkout | Reused from your first call on every later one |
name |
string | Yes | Min 3 characters |
mobile |
string | Yes | Min 10 characters |
Response body
Section titled “Response body”| Field | Type | Description |
|---|---|---|
checkoutUrl |
string | Mayar-hosted checkout page — redirect the customer here |
After payment, credit becomes available on your key’s balance; check it with GET /api/credits/balance below.
curl -X POST "https://api.megomi.com/api/credits/checkout" \ -H "x-api-key: YOUR_API_KEY" \ -H "content-type: application/json" \ -d '{"creditAmount": 100, "email": "you@example.com", "name": "Jane Doe", "mobile": "081234567890"}'const res = await fetch("https://api.megomi.com/api/credits/checkout", { method: "POST", headers: { "x-api-key": process.env.MEGOMI_API_KEY, "content-type": "application/json", }, body: JSON.stringify({ creditAmount: 100, email: "you@example.com", name: "Jane Doe", mobile: "081234567890", }),});const data = await res.json();import requests
res = requests.post( "https://api.megomi.com/api/credits/checkout", json={ "creditAmount": 100, "email": "you@example.com", "name": "Jane Doe", "mobile": "081234567890", }, headers={"x-api-key": "YOUR_API_KEY"},)print(res.json()){ "checkoutUrl": "https://sandbox.mayar.id/checkout/abc123" }{ "status": 400, "title": "Bad Request", "detail": "name and mobile are required on every checkout" }{ "status": 503, "title": "Service Unavailable", "detail": "payment provider unavailable, try again shortly" }Check balance
Section titled “Check balance”GET /api/credits/balance — Free
Live-queries Mayar for your key’s current balance — never reads a locally cached value.
Response body
Section titled “Response body”| Field | Type | Description |
|---|---|---|
balance |
number | Current credit balance |
registered |
boolean | false if this key has never checked out yet — balance is always 0 in that case |
curl "https://api.megomi.com/api/credits/balance" \ -H "x-api-key: YOUR_API_KEY"const res = await fetch("https://api.megomi.com/api/credits/balance", { headers: { "x-api-key": process.env.MEGOMI_API_KEY },});const data = await res.json();{ "balance": 84, "registered": true }{ "balance": 0, "registered": false }