Accept payments
Workflow selection
Routing workflows are built and published in Routing Studio. Your integration decides only which workflow runs, either explicitly with workflowId or implicitly through triggers.
Choose a workflow explicitly
Send workflowId (the workflow's id or code) on a payment, a checkout session or a payment link. Meem validates it and never substitutes another workflow: an unknown, unpublished, foreign or incompatible workflow fails the payment with 422.
| Where | Field |
|---|---|
POST /api/v1/payments | workflowId |
POST /api/v1/checkout/sessions | workflowId |
POST /api/v1/payment-links | workflowId |
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)" \
-d '{
"amount": 1200,
"currency": "SAR",
"cardToken": "4000001111112223",
"workflowId": "<workflow_id_or_code>",
"channel": "web"
}'| Code | Cause |
|---|---|
WORKFLOW_NOT_FOUND | No workflow with that id or code for your merchant. |
WORKFLOW_NOT_PUBLISHED | The workflow exists but has no live published version in this environment. |
WORKFLOW_PAYMENT_METHOD_MISMATCH | The workflow is bound to a different payment method. |
Resolution order
When you don't name a workflow, Meem resolves one in this order. The first match wins.
| Step | Source | Recorded as |
|---|---|---|
| 1 | Explicit workflowId | Explicit |
| 2 | A trigger the parent merchant set for this sub-account | SubAccountTrigger |
| 3 | The merchant's own triggers | MerchantTrigger (or PaymentMethodMapping for a method binding) |
| 4 | Lanes: a payment-method lane, then the merchant default | PaymentMethodMapping · Default |
| 5 | Inherited from the parent (only if the sub-account inherits configuration) | InheritedTrigger · InheritedPaymentMethodMapping · InheritedDefault |
| 6 | Nothing matched | 422 ROUTING_NOT_CONFIGURED. There's no cross-merchant fallback. |
Only triggers of published, non-archived workflows in the payment's environment take part. Gateway credentials are never inherited: an inherited workflow routes over the sub-account's own gateway accounts.
How triggers match
Triggers are configured in Routing Studio on each workflow. A trigger can constrain these dimensions; empty means any, except currency:
| Dimension | Values |
|---|---|
| Payment option / method | Known codes, e.g. card, mada, apple_pay. |
| Currency | ISO 4217. Empty on create means SAR, not any. |
| Operation | Authorize, Purchase or any. |
| Country | ISO 3166 alpha-2. |
| Channel | web, mobile, link, api, recovery. |
| Amount range | Inclusive minAmount–maxAmount. |
| Effective window | Optional [from, to). |
- Among matching triggers, the most specific wins (most constrained dimensions), then the lowest
priority(0–10000, default 100). - Two triggers of different workflows with equal specificity and priority that can match the same payment are rejected as ambiguous (
409) when saved or first published. - Send
channelon direct API payments if you want channel triggers to apply; without it the payment is recorded asapi. Hosted checkout setsweb, and payment links setlink.
What the payment records
GET /api/v1/payments/{id} returns workflowId, workflowVersion, workflowVersionId (the immutable published version that ran), workflowResolution and channel. The routing trace shows which rules were evaluated and why accounts were excluded.
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.