Skip to main content
This recipe asks for a withdrawal with POST /api/v1/withdrawals and your own idempotency_key, sending the same body on every retry, so a retry never asks twice. After no answer, a 429 or a 5xx, it waits Retry-After, or 1, 2, 4, then 8 seconds with jitter, at most five times. Those numbers are the recipe’s choice: keep a limit and a pause.

Prerequisites

  • MART_API_KEY: your API key, with the withdrawals:write scope.
  • MART_API_BASE: https://sandbox.mart.ps while you build, https://mart.ps when you go live.
  • A saved payout method, in the panel or with PUT /api/v1/payout-method: cash at the office, or bank transfer where Mart offers it. Withdrawals must also be enabled for your account.
  • MART_WITHDRAW_AMOUNT: shekels, at most two decimals, no more than available. It is sent as a decimal string, never rounded.
  • MART_IDEMPOTENCY_KEY: your own name for this one request, up to 64 letters, digits, dots, underscores or hyphens.
One runtime: cURL 7.84 or later with jq; Node 22.18 or later, which runs the .ts file as it is; Python 3.9 or later with httpx; PHP 7.4 or later with its curl extension; Go 1.22 or later; or Java 17 or later with Jackson (jackson-databind). Each file reads its variables from the environment and sets a timeout on every call. Run it on your own server: a browser or an app never holds the key.

Run the recipe

Verify the result

Run it twice with the same key and amount:
The second run prints the same with replay: true: the same request, not a second one. Mart reviews it before paying: see Payout and withdrawals.

Troubleshooting

Every other code is in the error catalog.