Skip to content
Auto

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.

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.

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
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.

Terminal window
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"}'
{ "checkoutUrl": "https://sandbox.mayar.id/checkout/abc123" }

GET /api/credits/balanceFree

Live-queries Mayar for your key’s current balance — never reads a locally cached value.

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
Terminal window
curl "https://api.megomi.com/api/credits/balance" \
-H "x-api-key: YOUR_API_KEY"
{ "balance": 84, "registered": true }