Skip to main content
Create a checkout session for a critical escrow action. The session allows you to redirect a specific user to dhmad.tn to perform the action (e.g., sign contract, accept & pay, complete, dispute, handle cancellation, add funds, or refund funds). The user is redirected back to your redirectUrl after completing or abandoning the flow. The API validates that the action is still needed before creating a session. If the action is already done (e.g. the target user has already signed the contract, or payment is already completed), the request returns 400 with a structured error (error.code, error.user_message). Use these to show a clear message in your app instead of redirecting to checkout.
Configure allowed redirect URLs in your Developer Dashboard settings before creating checkout sessions. If no redirect URLs are configured, or if the redirectUrl does not match any allowed URL, the request will fail with a 400 error.

Path Parameters

string
required
Escrow ID

Request Body

string
required
The action the user will perform. Must be one of: sign_contract, accept_pay, complete, dispute, request_cancellation, reject_cancellation, accept_cancellation, cancel_escrow, submit_proof, review_proof, add_funds, refund_funds, approve_release, reject_release. If the action is already done (e.g. contract already signed, payment already made), the API returns 400 with a business rule error—see Error Responses below.Cancellation actions (paid or delivered escrows):
  • request_cancellationBuyer only. Target the buyer’s email. The buyer cannot cancel unilaterally after payment; they request cancellation and the seller must accept or reject.
  • cancel_escrowSeller only. Target the seller’s email. Cancels immediately and refunds the buyer when applicable.
  • reject_cancellation / accept_cancellation — Target the seller’s email (counterparty of the buyer who requested). Create these only after a pending cancellation request exists.
  • Targeting the wrong party returns 400 (CANCELLATION_REQUEST_BUYER_ONLY, CANCEL_ESCROW_SELLER_ONLY, or CHECKOUT_TARGET_NOT_BUYER / CHECKOUT_TARGET_NOT_SELLER).
Funds adjustment actions (paid or delivered escrows):
  • add_fundsBuyer only. Target the buyer’s email. The buyer adds more money from their DHMAD wallet into the escrow. Fees apply to the added amount only. Requires action step-up on checkout. Not supported for escrows paid via guest checkout.
  • refund_fundsSeller only. Target the seller’s email. The seller refunds part or all of the remaining ledger balance to the buyer’s wallet. Refunding the full remaining balance cancels the escrow. Requires action step-up on checkout. Not supported for guest-checkout escrows.
  • Targeting the wrong party returns 400 (CHECKOUT_TARGET_NOT_BUYER / CHECKOUT_TARGET_NOT_SELLER).
Progressive release actions (hourly contracts, paid escrows):
  • approve_releaseClient only. Target the buyer’s email and pass the payout request in metadata.requestId. Releases that period to the seller immediately. Requires action step-up on checkout.
  • reject_releaseClient only. Same targeting and metadata.requestId. Opens a dispute scoped to that period; the amount stays reserved and later periods keep running. No step-up (no money moves).
  • Both require a progressive-release escrow (created with a progressiveRelease object) and a pending payout request. The seller never acts on these — payout requests are created by your backend, optionally on the seller’s behalf.
By escrow mode:
  • standard — all actions apply when status allows (except proof actions). complete works from paid or delivered; seller deliver is optional. add_funds / refund_funds apply when paid or delivered.
  • quick — no contract; sign_contract returns 400 (QUICK_ESCROW_NO_CONTRACT). Typical flow: accept_pay, then buyer complete. Seller may call Deliver Escrow first, but the buyer can complete directly from paid without deliver. With Quick Escrow with Proof, use submit_proof (seller) and review_proof (buyer) while proofInfo.phase requires them; early release from paid is blocked until proof is accepted. add_funds / refund_funds apply when paid or delivered.
  • instant — only accept_pay (and dispute/cancellation actions) are valid; sign_contract, complete, proof actions, and funds adjustments return 400.
complete action: Buyer releases funds. Valid when escrow status is paid or delivered. Does not require the seller to call deliver first — the buyer can release early from paid if they are satisfied. Returns 409 (PROOF_NOT_ACCEPTED) for Quick Escrow with Proof when proof is not yet accepted.
string
required
Email of the user who will perform the action. Only this user can complete the session.
string
required
URL to redirect the user after they complete or abandon the flow. Must match one of your allowed redirect URLs configured in the developer dashboard. Must use HTTPS (except http://localhost for development).
object
Optional key-value pairs (strings only). Useful for tracking orders or internal references. Values must be 500 characters or less.

Response Fields

No KYC check is performed when creating a checkout session. You can create an accept_pay session regardless of the buyer’s KYC status. If the buyer does not have approved KYC, they will be prompted to complete identity verification inside the DHMAD checkout flow (inline Verify KYC) before they can complete Accept & Pay. You do not receive a separate error code for KYC at session creation time.

Error Responses

When a request is rejected because of a business rule (e.g. the action is already done, or redirect URL is invalid), the API returns 400 Bad Request with an error object. Use error.code to branch in your app and error.user_message to show a clear message to the end user; error.message is for developers and logging. The table below lists all error codes returned by this endpoint. Business rule error shape (400)
Example: contract already signed
Example: payment already done
Handle these in your app by checking response.error?.code and displaying response.error?.user_message to the user instead of redirecting to checkout.

401 Unauthorized

403 Forbidden

404 Not Found

Escrow Not Found
Developer Not Found

Sessions expire 30 minutes after creation. Ensure users complete the flow within this window, or create a new session if needed.
For escrows created with mode: "instant", only the accept_pay action (and dispute/cancellation actions) is valid. Do not use sign_contract or complete; they will return 400. After the buyer pays, deliver the digital goods and call Deliver Escrow to auto-complete and release funds.