Quickstart

Go from zero to a paid invoice in a few minutes. This walks through getting a key, making your first call, and taking a real payment.

1. Get an API key

Sign in to your MG Crypto dashboard, open Business → Developers, and create an API key. Keys look like sk_live_… and are shown once at creation — store them somewhere safe.

Keep keys secret

API keys grant full access to your account's payments. Never expose them in client-side code, mobile apps, or public repositories. Use them only from your server.

2. Make your first request

Verify your key by reading your balance. Export it as an environment variable so it never lands in your shell history:

export MG_API_KEY="sk_live_your_key_here"

curl "https://markgroup.app/api/v1/balance" \
  -H "Authorization: Bearer $MG_API_KEY"

A successful response returns your balance in satoshis:

application/json
{
  "object": "balance",
  "asset": "BTC",
  "confirmed_sats": 0,
  "total_sats": 0,
  "confirmed_usd": 0
}

3. Create an invoice

Create an invoice for a USD amount. We convert it to BTC at the live rate and mint a dedicated deposit address. Pass an Idempotency-Key so a retry never double-creates it.

curl -X POST "https://markgroup.app/api/v1/invoices" \
  -H "Authorization: Bearer $MG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "amount_usd": 100, "description": "Order #1001" }'

4. Collect the payment

The invoice response includes a hosted pay_url. Redirect your customer there — it shows the amount, a QR code, and the deposit address, and updates itself when the payment confirms. You don't need to build a checkout UI.

5. Confirm and fulfil

Poll the invoice (or list payments) until status is paid, then fulfil the order:

curl "https://markgroup.app/api/v1/invoices/inv_3n8Kd0Qz" \
  -H "Authorization: Bearer $MG_API_KEY"

Webhooks are coming

Polling works well today. Outbound webhooks that push a notification the moment an invoice is paid are on the roadmap.