Skip to content
Meem Payment

Get started

Authentication

Server-to-server calls use the OAuth 2.0 client-credentials grant. You exchange your API key for a short-lived bearer token scoped to your merchant, then send it as Authorization: Bearer <token>.

How it works

  1. Generate an API key pair in the console (API Credentials): a client id pk_… and a client secret sk_…. The secret is shown once and stored only as a hash.
  2. Call POST /api/v1/auth/token with grant_type=client_credentials.
  3. Send the returned access_token on every API call until it expires, then request a new one. There is no refresh token for this grant.
POST/api/v1/auth/token
Client credentials

Request a token

The endpoint accepts the credentials as an application/x-www-form-urlencoded body (the OAuth 2.0 standard), as a JSON body, or as HTTP Basic authentication. grant_type must be client_credentials.

curl -X POST "https://api.sandbox.meem-dev.example/api/v1/auth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=client_credentials" \
  --data-urlencode "client_id=$MEEM_CLIENT_ID" \
  --data-urlencode "client_secret=$MEEM_CLIENT_SECRET"

JSON and HTTP Basic

# client_id and client_secret in the Authorization header; grant_type in the body.
curl -X POST "https://api.sandbox.meem-dev.example/api/v1/auth/token" \
  -u "$MEEM_CLIENT_ID:$MEEM_CLIENT_SECRET" \
  -d "grant_type=client_credentials"

Response

access_tokenstringrequired
A signed JWT. Treat it as opaque.
token_typestringrequired
Always Bearer.
expires_inintegerrequired
Seconds until expiry. Client tokens live at most 15 minutes.
scopestringrequired
Space-separated permissions carried by the token (see below).
{
  "access_token": "<jwt>",
  "token_type": "Bearer",
  "expires_in": 900,
  "scope": "payments.authorize payments.capture payments.void payments.refund payments.read checkout_sessions.manage payment_links.read payment_links.manage webhooks.read webhooks.manage"
}

Responses carry Cache-Control: no-store. Errors follow RFC 6749: 400 unsupported_grant_type for a wrong grant, 400 invalid_request for an unreadable body, and 401 invalid_client for unknown, wrong, revoked or locked credentials, or when the merchant is not active.

{
  "error": "invalid_client",
  "error_description": "Client authentication failed."
}

Call the API

GET /api/v1/payments/<payment_id> HTTP/1.1
Host: api.sandbox.meem-dev.example
Authorization: Bearer <access_token>
X-Correlation-Id: 0b8e5f8a-2f4c-4d6e-8a1b-3c9d7e6f5a21
  • A missing or expired token returns 401. Request a new token and retry.
  • A valid token without the needed permission returns 403.
  • The merchant comes from the token, never from the request body. Resources of another merchant return 404, exactly like resources that don't exist.

Token scope

A client-credentials token carries the integration permissions only. It can never manage users, gateway credentials, routing, checkout profiles or API keys; those stay in the console.

PermissionAllows
payments.authorizeCreate payments (POST /payments) and hosted-fields sessions.
payments.captureCapture authorized payments.
payments.voidVoid authorized payments.
payments.refundRefund captured payments.
payments.readRetrieve and search payments, timelines, routing traces and API-call logs.
checkout_sessions.manageCreate hosted checkout sessions.
payment_links.read · payment_links.manageRead, create, cancel, regenerate and share payment links.
webhooks.read · webhooks.manageList and register webhook endpoints; list and replay failed deliveries.

Rate limits and lockout

  • Lockout: 5 failed secrets for the same client id within 15 minutes lock that key for 15 minutes. While locked, the endpoint returns 401 invalid_client with a Retry-After header. Only wrong secrets count; a revoked key isn't being guessed.
  • Rate limits: the auth endpoints have a stricter per-IP limit than the rest of the API, and every caller has a global per-minute limit. Exceeding either returns 429 with Retry-After. Limits are set per deployment.
  • Every token issue, failure and lockout is written to the append-only audit log.

Acting for a sub-account

A parent merchant can act as one of its own sub-accounts by adding X-Merchant-Context: <sub_account_merchant_id>. The server verifies the parent–child relationship; anything else returns 403 with merchant_context.forbidden, and a malformed id returns 400. The header can only narrow access, never widen it.

Console users and operator headers

People sign in to the console with a username, password and TOTP code (POST /api/v1/auth/login) and receive a JWT plus a refresh token. Privileged users can be required to enrol MFA. These endpoints serve the console; integrations should use client credentials.

On /api/v1/payments an already-authenticated operator can narrow a request to one merchant with X-Merchant-Id, optionally proving it with that merchant's X-Client-Id and X-Client-Secret. Mismatched or inactive credentials return 403 with payment.invalid_credentials. These headers are not a way to authenticate on their own: a bearer token is still required.

{
  "code": "payment.invalid_credentials",
  "message": "Provide active client credentials belonging to the selected merchant."
}

Documentation reflects the platform as verified on 3 December 2026. Placeholder hosts and credentials are used throughout; your real sandbox host and keys are provided at onboarding.