Prerequisites
- A DHMAD developer account with an approved application
- An API key (see Getting Started)
- Your developer account associated with a user account
- The associated user account must have email verification completed (phone verification is only required when the buyer accepts and pays, not at escrow creation)
- Basic knowledge of REST APIs
Step 1: Check Your Balance
First, let’s verify your account and check your balance:Response
Response
Step 2: Create an Escrow
Now let’s create an escrow transaction. This represents a secure transaction between a buyer and seller:Response
Response
If the buyer email corresponds to an existing user, they will receive a notification. If not, they will receive an invitation email with a registration link.
mode: "quick". For in-app digital goods where you are the seller, use mode: "instant". See Escrow Modes.
Step 3: Get Escrow Details
Retrieve the details of the escrow you just created:Response
Response
Step 4: List Your Escrows
Get a list of all your escrows with optional filters:Complete Example
Here’s a complete JavaScript example:Step 5: Set Up Webhooks (Optional)
To receive real-time notifications when escrow status changes, set up a webhook:- Go to the Developer Dashboard
- Navigate to the “Webhooks” section
- Create a webhook with your endpoint URL
- Verify webhook signatures in your handler
Next Steps
- API Reference - Explore all available endpoints
- Webhooks Guide - Set up real-time notifications
- Error Handling - Learn about error responses
- Best Practices - Production-ready tips
All amounts are in TND (Tunisian Dinar). The escrow fee is automatically calculated based on the transaction amount.