Merchant Service API
The Merchant Service manages business accounts, team members, and merchant configurations. It provides multi-merchant support, role-based team management, and centralized settings control.Base URL:
https://paymentgateway.redahaloubi.com/api/v1All endpoints require JWT authentication unless noted otherwise.Authentication
All Merchant API endpoints require authentication via JWT Bearer token:Rate Limits
Standard Endpoints
100 requests per second per userApplied to most merchant operations
Team Management
20 requests per second per merchantInvitation and team modification endpoints
Merchant Endpoints
Create Merchant
endpoint
/merchantsstring
required
Public-facing business nameExample: “Acme Corporation”
string
Legal business name (if different from business name)Example: “Acme Corp LLC”
string
required
Business contact emailFormat: Valid email address
string
Business phone numberExample: “+1-555-123-4567”
string
Business website URLExample: “https://acme.com”
string
required
Type of business entityOptions:
individual, sole_proprietor, partnership, corporation, non_profitError Responses
Error Responses
409 Conflict - User Already Has Merchant400 Bad Request - Invalid Business Type400 Bad Request - Invalid Email
Merchant Status:
pending_review: Newly created, awaiting verificationactive: Verified and can process paymentssuspended: Temporarily disabledclosed: Permanently deactivated
List User Merchants
endpoint
/merchantsMulti-Merchant Support: Users can be members of multiple merchants with different roles. The response includes all merchants where the user has any level of access.
Get Merchant
endpoint
/merchants/:idstring
required
Merchant ID (UUID)
read in the merchant
Example Request
Error Responses
Error Responses
403 Forbidden - Access Denied404 Not Found
Get Merchant Details
endpoint
/merchants/:id/detailsstring
required
Merchant ID (UUID)
read in the merchant
Example Request
Update Merchant
endpoint
/merchants/:idstring
required
Merchant ID (UUID)
update (Owner or Admin)
Request Body
string
Updated business name
string
Updated business emailFormat: Valid email address
string
Updated phone number
string
Updated website URL
Error Responses
Error Responses
403 Forbidden - Insufficient Permissions400 Bad Request - Invalid Email
Delete Merchant
endpoint
/merchants/:idstring
required
Merchant ID (UUID)
delete (Owner only)
Example Request
Error Responses
Error Responses
403 Forbidden - Only Owner Can Delete
Team Management Endpoints
Get Team Members
endpoint
/merchants/:id/teamstring
required
Merchant ID (UUID)
read in the merchant
Example Request
Team Member Status:
active: User has accepted invitation and has accesspending: Invitation sent but not yet acceptedsuspended: Access temporarily revoked
Invite Team Member
endpoint
/merchants/:id/team/invitestring
required
Merchant ID (UUID)
create (Owner, Admin, or Manager)
Request Body
string
required
Email address of the person to inviteFormat: Valid email address
string
required
Role ID to assign (from Auth Service roles)Format: UUID
string
required
Role name for displayOptions: Owner, Admin, Manager, Staff
Error Responses
Error Responses
400 Bad Request - User Already in Team400 Bad Request - Pending Invitation Exists403 Forbidden - Insufficient Permissions
Invitation Lifecycle:
- Invitations expire after 7 days
- User must have an account to accept (or register first)
- One invitation per email per merchant at a time
- Invitation token is single-use
Accept Invitation
endpoint
/invitations/:token/acceptstring
required
Invitation token from emailExample:
inv_abc123def456ghi789jkl012Error Responses
Error Responses
400 Bad Request - Invalid Token400 Bad Request - Email Mismatch409 Conflict - Already Accepted
Update Team Member Role
endpoint
/merchants/:id/team/:user_idstring
required
Merchant ID (UUID)
string
required
User ID of the team member to update (UUID)
update (Owner or Admin)
Request Body
string
required
New role ID (UUID)
string
required
New role nameOptions: Admin, Manager, Staff
Error Responses
Error Responses
400 Bad Request - Cannot Modify Owner403 Forbidden - Insufficient Permissions
Remove Team Member
endpoint
/merchants/:id/team/:user_idstring
required
Merchant ID (UUID)
string
required
User ID of the team member to remove (UUID)
delete (Owner only)
Example Request
Error Responses
Error Responses
400 Bad Request - Cannot Remove Owner403 Forbidden - Only Owner Can Remove
Get Pending Invitations
endpoint
/merchants/:id/invitationsstring
required
Merchant ID (UUID)
read in the merchant
Example Request
Cancel Invitation
endpoint
/invitations/:idstring
required
Invitation ID (UUID)
delete (Owner) or invitation creator
Example Request
Error Responses
Error Responses
400 Bad Request - Already Accepted403 Forbidden
Settings Endpoints
Get Settings
endpoint
/merchants/:id/settingsstring
required
Merchant ID (UUID)
read in the merchant
Example Request
Update Settings
endpoint
/merchants/:id/settingsstring
required
Merchant ID (UUID)
update (Owner or Admin)
Request Body
string
Default currency for transactionsFormat: ISO 4217 currency code (3 letters)Example: “USD”, “EUR”, “MAD”
boolean
Enable automatic settlementDefault: true
string
Settlement frequencyOptions:
daily, weekly, monthlystring
URL to receive webhook notificationsFormat: Valid HTTPS URL
string
Email for important notificationsFormat: Valid email address
boolean
Send email receipts to customersDefault: true
Error Responses
Error Responses
400 Bad Request - Invalid Currency400 Bad Request - Invalid Webhook URL400 Bad Request - Invalid Schedule
Webhook Configuration:When setting a webhook URL, the system will:
- Automatically generate a webhook secret (
whsec_...) - Send a test webhook to verify the endpoint
- Store the secret for HMAC signature verification
API Key Endpoints
API Key Management:These endpoints are in the Merchant Service but communicate with the Auth Service for actual key creation and storage. They require Owner permissions.
Create API Key
endpoint
/merchants/api-keysstring
required
Merchant ID for which to create the API key (UUID)
string
required
Descriptive name for the API keyExample: “Production Server”, “Staging Environment”
List Merchant API Keys
endpoint
/merchants/api-keys/merchant/:merchant_idstring
required
Merchant ID (UUID)
Deactivate API Key
endpoint
/merchants/api-keys/:merchant_id/:id/deactivatestring
required
Merchant ID (UUID)
string
required
API Key ID (UUID)
Delete API Key
endpoint
/merchants/api-keys/:merchant_id/:idstring
required
Merchant ID (UUID)
string
required
API Key ID (UUID)
Permission Requirements Summary
Read Operations (All Roles)
Read Operations (All Roles)
Endpoints:
- GET /merchants/:id
- GET /merchants/:id/details
- GET /merchants/:id/team
- GET /merchants/:id/invitations
- GET /merchants/:id/settings
Create Operations (Owner, Admin, Manager)
Create Operations (Owner, Admin, Manager)
Endpoints:
- POST /merchants/:id/team/invite
Update Operations (Owner, Admin)
Update Operations (Owner, Admin)
Endpoints:
- PATCH /merchants/:id
- PATCH /merchants/:id/settings
- PATCH /merchants/:id/team/:user_id
Delete Operations (Owner Only)
Delete Operations (Owner Only)
Endpoints:
- DELETE /merchants/:id
- DELETE /merchants/:id/team/:user_id
- POST /merchants/api-keys (Create requires Owner)
- All API key operations
Common Workflows
Workflow 1: Setting Up a New Merchant
1
Create Merchant Account
2
Configure Settings
3
Generate API Key
4
Invite Team Members
Workflow 2: Managing Team Members
1
Send Invitation
2
User Accepts Invitation
3
Update Role (if needed)
4
Remove Member (if needed)
Error Reference
Bad Request
Invalid request format or validation errorsCommon causes:
- Invalid UUID format
- Missing required fields
- Invalid email format
- Invalid business_type value
Unauthorized
Missing or invalid authentication tokenSolution: Include valid JWT token in Authorization header
Forbidden
Authenticated but lacks required permissionsCommon causes:
- Insufficient role permissions
- Not a member of the merchant
- Trying to perform owner-only actions
Not Found
Requested resource doesn’t existCommon causes:
- Invalid merchant ID
- User not found
- Invitation doesn’t exist
Conflict
Request conflicts with current stateCommon causes:
- User already has a merchant
- Email already invited
- User already in team
Next Steps
Payment API
Process payments and manage transactions
Auth API
User authentication and authorization
Quick Start
Create your first payment intent
CLI Tool
Command-line interface for testing
Questions? Contact support at [email protected]