Skip to content
Meem Payment

Quickstart

Your first sandbox payment

Six steps from credentials to a captured payment and a verified webhook. Everything runs in the sandbox against the built-in mock gateways, so no real money moves.

Before you start

Meem onboards each merchant in the console. To transact in the sandbox your merchant needs three things, which we set up with you at onboarding (or which your console administrator configures):

  1. An active merchant. A suspended or inactive merchant can't create payments.
  2. At least one active Sandbox gateway account: in the sandbox, Mock 1 and/or Mock 2 (Merchants → your merchant → Payment Gateways).
  3. A published routing workflow for the Sandbox environment (Routing Studio). Without one, payments return 422 with ROUTING_NOT_CONFIGURED.

1. Create API credentials

In the console, open API Credentials and generate a key pair. You get a public client id (pk_…) and a client secret (sk_…). The secret is shown once; store it in your secrets manager.

  • Rotate by generating a new pair, deploying it, then revoking the old one.
  • Never ship the secret to a browser or mobile app. Token requests belong on your server.
MEEM_CLIENT_ID=<client_id>
MEEM_CLIENT_SECRET=<client_secret>

2. Get an access token

POST/api/v1/auth/token
Client credentials

Exchange the credentials for a bearer token with the OAuth 2.0 client-credentials grant. Tokens are short-lived (at most 15 minutes) and carry only the integration permissions, so cache the token and request a new one shortly before expires_in runs out.

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"
{
  "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"
}

Export the token for the cURL samples that follow: export MEEM_ACCESS_TOKEN=<access_token>. More options (JSON, HTTP Basic, lockout) are on Authentication.

3. Authorize a payment

POST/api/v1/payments
Bearer tokenPermission: payments.authorize

Send the amount, the ISO 4217 currency and a card token. In the sandbox the mock gateways read the first six digits of cardToken, so the test number 4000001111112223 always approves. Add an Idempotency-Key so a network retry can never create a second payment.

curl -X POST "https://api.sandbox.meem-dev.example/api/v1/payments" \
  -H "Authorization: Bearer $MEEM_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "X-Correlation-Id: $(uuidgen)" \
  -d '{
    "amount": 150,
    "currency": "SAR",
    "cardToken": "4000001111112223",
    "cvv": "123",
    "customerCountry": "SA",
    "metadata": {
      "orderRef": "ORDER-1001"
    }
  }'
{
  "paymentId": "6f1c2a9e-4b7d-4c1e-9a53-0d2b8f7e1c44",
  "status": "Authorized",
  "code": null,
  "normalizedCode": null,
  "declineCategory": null,
  "message": null,
  "redirectUrl": null,
  "correlationId": "0b8e5f8a-2f4c-4d6e-8a1b-3c9d7e6f5a21"
}

4. Check the status

GET/api/v1/payments/{id}
Bearer tokenPermission: payments.read

Retrieve the payment to see its lifecycle status, captured and refunded totals, the workflow that ran, and every gateway attempt with its normalized outcome.

paymentId="<payment_id>"

curl -X GET "https://api.sandbox.meem-dev.example/api/v1/payments/$paymentId" \
  -H "Authorization: Bearer $MEEM_ACCESS_TOKEN"
{
  "paymentId": "6f1c2a9e-4b7d-4c1e-9a53-0d2b8f7e1c44",
  "merchantId": "<merchant_id>",
  "status": "PartiallyRefunded",
  "amount": 150,
  "currency": "SAR",
  "capturedAmount": 100,
  "refundedAmount": 25,
  "createdAt": "2026-12-03T09:15:02+00:00",
  "updatedAt": "2026-12-03T09:21:40+00:00",
  "requestedOperation": "Authorize",
  "paymentMethod": "card",
  "workflowId": "<workflow_id>",
  "workflowVersion": 3,
  "workflowResolution": "Default",
  "channel": "api",
  "attempts": [
    {
      "attemptNumber": 1,
      "gatewayName": "Mock",
      "gatewayTransactionReference": "<gateway_reference>",
      "requestedAt": "2026-12-03T09:15:02+00:00",
      "respondedAt": "2026-12-03T09:15:02+00:00",
      "status": "Succeeded",
      "normalizedOutcome": "Success",
      "nextAction": "Complete",
      "durationMs": 41
    }
  ]
}

5. Capture it

POST/api/v1/payments/{id}/capture
Bearer tokenPermission: payments.capture

Capture the full amount, or less for a partial capture (status PartiallyCaptured). amount and currency are required.

paymentId="<payment_id>"

curl -X POST "https://api.sandbox.meem-dev.example/api/v1/payments/$paymentId/capture" \
  -H "Authorization: Bearer $MEEM_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "amount": 100,
    "currency": "SAR"
  }'

6. Receive webhooks

POST/api/v1/webhook-endpoints
Bearer tokenPermission: webhooks.manage

Register an HTTPS endpoint and keep the signingSecret from the response; it's shown once. Meem then POSTs a signed JSON event on each payment state change. Verify X-Webhook-Signature before trusting the body: see Webhooks for the verification code in five languages.

curl -X POST "https://api.sandbox.meem-dev.example/api/v1/webhook-endpoints" \
  -H "Authorization: Bearer $MEEM_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example.com/webhooks/meem",
    "eventTypes": [
      "payment.authorized",
      "payment.captured",
      "payment.declined",
      "payment.refunded"
    ]
  }'

Next steps

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.