Skip to main content

Flexy (Mobile Top-Up)

Mobile recharge for Mobilis, Ooredoo, and Djezzy.

1. Get Plansโ€‹

Get available mobile recharge plans for operators.

Endpoint: GET /api/flexy/plans/{operator}

Operators: mobilis, ooredoo, djezzy (optional - omit to get all)

Query Parameters: ?refresh=true to force refresh from provider

Response:

{
"success": true,
"data": {
"dynamicPlans": [
{
"code": "DYNAMIC_Mobilis",
"name": "Dynamic Mobilis",
"operator": "Mobilis",
"isEnabled": true,
"min_amount": 100,
"max_amount": 5000,
"finalCost": 0.0225
}
],
"fixedPlans": [
{
"code": "FIXED_100_Mobilis",
"name": "100 DA Mobilis",
"operator": "Mobilis",
"isEnabled": true,
"amount": 100,
"finalPrice": 102
}
],
"autoPlans": [
{
"code": "AUTO_Mobilis",
"name": "Auto Mobilis",
"operator": "Mobilis",
"isEnabled": true
}
]
}
}

Plan Types:

  • Dynamic: Flexible amount between min and max (calculated as amount * finalCost)
  • Fixed: Predefined amounts with fixed prices
  • Auto: Automatic detection of best plan for number

2. Place Orderโ€‹

Place a mobile recharge order.

Endpoint: POST /api/flexy/order

For Fixed Plans:

{
"MSSIDN": "0551234567",
"plan_code": "FIXED_100_Mobilis"
}

For Dynamic Plans:

{
"MSSIDN": "0551234567",
"plan_code": "DYNAMIC_Mobilis",
"amount": 500
}

Phone Format: 0[567][0-9]{8}

  • 06 prefix = Mobilis
  • 05 prefix = Ooredoo
  • 07 prefix = Djezzy

Response:

{
"success": true,
"message": "Topup request sent successfully",
"order_id": 123,
"data": {
"ref": "TOP67890abcdef1234567890",
"status": "PENDING"
}
}

3. Check Order Statusโ€‹

Check the status of a placed order.

Endpoint: GET /api/flexy/status/{orderId}

Response:

{
"success": true,
"status": "FULFILLED",
"status_message": "Top-up completed successfully",
"order_id": 123
}

Status Values:

  • PENDING: Order received, waiting for processing
  • HANDLING: Order is being processed
  • FULFILLED: Top-up completed successfully
  • FAILED: Top-up failed
  • REJECTED: Order rejected by provider
  • REFUNDED: Order refunded
  • UNKNOWN_ERROR: Unknown error occurred

4. Get Order Detailsโ€‹

Get detailed information about an order.

Endpoint: GET /api/flexy/order/{orderId}

5. Get Order Historyโ€‹

Get your Flexy order history.

Endpoint: GET /api/flexy/history

Example Workflowโ€‹

# 1. Get Mobilis plans
curl -X GET "https://gateway.wasmou.net/api/flexy/plans/mobilis" \
-H "X-Api-Key: your_api_key"

# 2. Place fixed plan order
curl -X POST "https://gateway.wasmou.net/api/flexy/order" \
-H "X-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"MSSIDN": "0661234567",
"plan_code": "FIXED_100_Mobilis"
}'

# 3. Place dynamic plan order
curl -X POST "https://gateway.wasmou.net/api/flexy/order" \
-H "X-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"MSSIDN": "0661234567",
"plan_code": "DYNAMIC_Mobilis",
"amount": 500
}'

# 4. Check status
curl -X GET "https://gateway.wasmou.net/api/flexy/status/123" \
-H "X-Api-Key: your_api_key"

Best Practicesโ€‹

  • Verify phone number format before ordering
  • Use ?refresh=true to get latest plan availability
  • For dynamic plans, ensure amount is between min and max
  • Save the ref for tracking
  • Poll status endpoint until status is final (FULFILLED, FAILED, REJECTED, or REFUNDED)