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
Create a new merchant account. Users can only create one merchant account. The user becomes the Owner with full access. Request BodyBusiness website URLExample: “https://acme.com”
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
Get all merchants where the authenticated user is a team member (including owned merchants). Example RequestMulti-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
Get basic information about a specific merchant. Path Parameters Required Permission:read in the merchant
Example Request
Error Responses
Error Responses
403 Forbidden - Access Denied404 Not Found
Get Merchant Details
Get comprehensive merchant information including settings, business info, branding, and verification status. Path Parameters Required Permission:read in the merchant
Example Request
Update Merchant
Update merchant information. Only specified fields will be updated. Path Parameters Required Permission:update (Owner or Admin)
Request Body
Example Request
Error Responses
Error Responses
403 Forbidden - Insufficient Permissions400 Bad Request - Invalid Email
Delete Merchant
Soft delete a merchant account. This action can only be performed by the Owner. Path Parameters Required Permission:delete (Owner only)
Example Request
Error Responses
Error Responses
403 Forbidden - Only Owner Can Delete
Team Management Endpoints
Get Team Members
List all team members in a merchant with their roles and status. Path Parameters Required Permission: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
Send an invitation to join the merchant team. The invitee receives an email with an invitation token. Path Parameters Required Permission:create (Owner, Admin, or Manager)
Request Body
Example Request
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
Accept a team invitation using the invitation token received via email. Path Parameters Example RequestError Responses
Error Responses
400 Bad Request - Invalid Token400 Bad Request - Email Mismatch409 Conflict - Already Accepted
Update Team Member Role
Change a team member’s role. Cannot modify the Owner’s role. Path Parameters Required Permission:update (Owner or Admin)
Request Body
Example Request
Error Responses
Error Responses
400 Bad Request - Cannot Modify Owner403 Forbidden - Insufficient Permissions
Remove Team Member
Remove a team member from the merchant. Cannot remove the Owner. Path Parameters Required Permission:delete (Owner only)
Example Request
Error Responses
Error Responses
400 Bad Request - Cannot Remove Owner403 Forbidden - Only Owner Can Remove
Get Pending Invitations
List all pending (not yet accepted) invitations for a merchant. Path Parameters Required Permission:read in the merchant
Example Request
Cancel Invitation
Cancel a pending invitation before it’s accepted. Path Parameters Required Permission:delete (Owner) or invitation creator
Example Request
Error Responses
Error Responses
400 Bad Request - Already Accepted403 Forbidden
Settings Endpoints
Get Settings
Get merchant settings including payment configuration, webhooks, and preferences. Path Parameters Required Permission:read in the merchant
Example Request
Update Settings
Update merchant settings. Only specified fields will be updated. Path Parameters Required Permission:update (Owner or Admin)
Request Body
Default currency for transactionsFormat: ISO 4217 currency code (3 letters)Example: “USD”, “EUR”, “MAD”
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
Generate a new API key for payment processing. Requires Owner permissions. Request Body Example RequestList Merchant API Keys
List all API keys for a merchant (without revealing actual key values). Path Parameters Required Permission: Owner Example RequestDeactivate API Key
Deactivate an API key without deleting it. Deactivated keys cannot be used but remain visible. Path Parameters Required Permission: Owner Example RequestDelete API Key
Permanently delete an API key. This action cannot be undone. Path Parameters Required Permission: Owner Example RequestPermission 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
Invalid request format or validation errorsCommon causes:
- Invalid UUID format
- Missing required fields
- Invalid email format
- Invalid business_type value
Missing or invalid authentication tokenSolution: Include valid JWT token in Authorization header
Authenticated but lacks required permissionsCommon causes:
- Insufficient role permissions
- Not a member of the merchant
- Trying to perform owner-only actions
Requested resource doesn’t existCommon causes:
- Invalid merchant ID
- User not found
- Invitation doesn’t exist
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]