🚀 Store API
Complete REST API documentation for integrating with our store platform
v1.0https://mousa-card.com/wp-json/mps/v1
🔐 Authentication
All API requests require authentication using a Bearer token. Include your API token in the Authorization header:
Required Headers
| Header | Value | Description |
|---|---|---|
Authorization | Bearer {token} | Your API authentication token |
Content-Type | application/json | Required for POST requests |
📦 Get Products
Retrieve all available products. Returns a flat list where each variation is a separate product item.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
category |
string | Optional | Filter by category slug (e.g., games, subscriptions) |
Example Request
curl -X GET "https://mousa-card.com/wp-json/mps/v1/products?category=games" \ -H "Authorization: Bearer YOUR_API_TOKEN"
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique product/variation ID (use this for orders) |
name | string | Product or variation name |
price | string | Price in user's currency (formatted number) |
currency_name | string | Currency name (e.g., USD, USDT) |
currency_symbol | string | Currency symbol (e.g., $) |
available | boolean | Whether product is available for purchase |
min_quantity | integer | Minimum order quantity |
max_quantity | integer | Maximum order quantity |
categories | array | List of category names |
custom_fields | array | Required fields for order (see below) |
thumbnail | string|null | Product image URL |
Custom Fields Structure
| Field | Type | Description |
|---|---|---|
key | string | Field identifier (use in order request) |
label | string | Display label |
type | string | text | number | dropdown |
required | boolean | Whether field is required |
options | array|null | Options list (for dropdown type only) |
Example Response
{
"success": true,
"data": {
"products": [
{
"id": "12310",
"name": "100 Credits",
"price": "5",
"currency_name": "USD",
"currency_symbol": "$",
"available": true,
"min_quantity": 1,
"max_quantity": 1,
"categories": ["Games"],
"custom_fields": [
{
"key": "playerid",
"label": "Player ID",
"type": "text",
"required": true,
"options": null
}
],
"thumbnail": "https://example.com/image.png"
},
{
"id": "12311",
"name": "500 Credits",
"price": "20",
"currency_name": "USD",
"currency_symbol": "$",
"available": true,
"min_quantity": 1,
"max_quantity": 1,
"categories": ["Games"],
"custom_fields": [...],
"thumbnail": "https://example.com/image.png"
}
],
"total": 25
}
}
key (identifier) may vary between products.Always check each product's
custom_fields array to see required fields and their keys before creating orders.
📋 Get Single Product
Retrieve detailed information about a specific product including all its variations.
URL Parameters
| Parameter | Type | Description |
|---|---|---|
id |
string | Product ID from the products list |
Example Request
curl -X GET "https://mousa-card.com/wp-json/mps/v1/products/123" \ -H "Authorization: Bearer YOUR_API_TOKEN"
Example Response
{
"success": true,
"data": {
"id": "123",
"type": "variable",
"name": "Game Credits Pack",
"description": "Buy game credits...",
"price": "5",
"currency_name": "USD",
"currency_symbol": "$",
"available": true,
"min_quantity": 1,
"max_quantity": 100,
"custom_fields": [...],
"thumbnail": "https://example.com/image.png",
"variations": [
{
"id": 12310,
"name": "100 Credits",
"price": "5",
"available": true
},
{
"id": 12311,
"name": "500 Credits",
"price": "20",
"available": true
}
]
}
}
Product Types
| Type | Description |
|---|---|
simple | Single product without variations |
variable | Product with multiple variations (e.g., different amounts) |
subscription | Subscription product (returns account details when completed) |
codes | Digital codes product (returns codes when completed) |
🛒 Create Order
Create a new purchase order. Balance will be deducted automatically from your account.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
product_id |
integer | Required | Product/Variation ID from products list |
quantity |
integer | Optional | Quantity (default: 1, check min/max_quantity) |
custom_fields |
object | If Required | Custom field values (check product's custom_fields) |
Example Request
curl -X POST "https://mousa-card.com/wp-json/mps/v1/orders" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"product_id": 12310,
"quantity": 1,
"custom_fields": {
"playerid": "12345678"
}
}'
application/jsoncustom_fields: Use keys from product's
custom_fields array
Response Fields
| Field | Type | Description |
|---|---|---|
order_id | integer | Created order ID (save this to check status) |
product_id | integer | Purchased product ID |
quantity | integer | Purchased quantity |
total | string | Total cost deducted |
status | string | processing or completed |
new_balance | string | Your new balance after purchase |
codes | array | Codes (only for codes products) |
currency_name | string | Currency name |
currency_symbol | string | Currency symbol |
Example Response (Codes Product)
status: "processing" initially. You must poll GET /orders/{id} until status becomes completed to retrieve the codes.
Scenario 1: Instant Fulfillment (codes available immediately)
{
"success": true,
"data": {
"order_id": 456,
"product_id": 12330,
"quantity": 2,
"total": "10",
"currency_name": "USD",
"currency_symbol": "$",
"status": "completed",
"codes": ["ABC123-XYZ", "DEF456-XYZ"],
"new_balance": "90"
}
}
Scenario 2: Pending Fulfillment (requires polling)
Initial response - codes not yet available:
{
"success": true,
"data": {
"order_id": 456,
"product_id": 12330,
"quantity": 2,
"total": "10",
"currency_name": "USD",
"currency_symbol": "$",
"status": "processing",
"codes": [],
"new_balance": "90"
}
}
➡️ Poll GET /orders/456 until status is completed, then codes will be available.
Example Response (Other Products - Processing)
{
"success": true,
"data": {
"order_id": 457,
"product_id": 12310,
"quantity": 1,
"total": "5",
"currency_name": "USD",
"currency_symbol": "$",
"status": "processing",
"new_balance": "95"
}
}
completed = Order fulfilled, codes/data availableprocessing = Order pending fulfillmentRecommended Polling Strategy:
1. Save the
order_id from the response2. If status is
processing, poll GET /orders/{order_id}3. Wait 2-5 seconds between requests
4. Continue until status becomes
completed or rejected
📊 Get Order Status
Retrieve the current status and details of a specific order. Use this to check if processing orders are completed.
URL Parameters
| Parameter | Type | Description |
|---|---|---|
id | integer | Order ID from create order response |
Example Request
curl -X GET "https://mousa-card.com/wp-json/mps/v1/orders/242859" \ -H "Authorization: Bearer YOUR_API_TOKEN"
Response Fields
| Field | Type | Description |
|---|---|---|
order_id | integer | Order identifier |
status | string | Order status (see status values below) |
product_id | string | Product identifier |
product_name | string | Product name |
quantity | integer | Ordered quantity |
total | string | Total cost |
currency_name | string | Currency name |
currency_symbol | string | Currency symbol |
created_at | string | Order date (Y-m-d H:i:s) |
variation | string | Variation name (if applicable) |
codes | array | Codes array (codes products only) |
subscription_details | object | Account details (subscription only) |
Status Values
| Status | Description |
|---|---|
processing | Order is being processed |
completed | Order fulfilled successfully |
rejected | Order was rejected |
cancelled | Order was cancelled |
pending | Order is pending |
Example Response (Processing)
{
"success": true,
"data": {
"order_id": 242859,
"status": "processing",
"product_id": "12310",
"product_name": "100 Credits",
"quantity": 1,
"total": "5",
"currency_name": "USD",
"currency_symbol": "$",
"created_at": "2024-01-15 14:30:00"
}
}
Example Response (Completed - Codes Product)
{
"success": true,
"data": {
"order_id": 242860,
"status": "completed",
"product_id": "12330",
"product_name": "Gift Card",
"quantity": 1,
"total": "10",
"currency_name": "USD",
"currency_symbol": "$",
"created_at": "2024-01-15 14:35:00",
"codes": ["ABCD-1234-EFGH"]
}
}
Example Response (Completed - Subscription)
{
"success": true,
"data": {
"order_id": 242861,
"status": "completed",
"product_id": "12420",
"product_name": "Netflix 1 Month",
"quantity": 1,
"total": "15",
"currency_name": "USD",
"currency_symbol": "$",
"created_at": "2024-01-15 14:40:00",
"subscription_details": {
"email": "[email protected]",
"password": "pass123",
"url": "https://netflix.com",
"notes": "Valid for 30 days"
}
}
}
📋 Get Multiple Orders Status
Check the status of multiple orders in a single request. Useful for batch status checking.
Request Body
| Parameter | Type | Description |
|---|---|---|
order_ids | array | Array of order IDs to check (max 50) |
Example Request
curl -X POST "https://mousa-card.com/wp-json/mps/v1/orders/status" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"order_ids": [242859, 242850, 242849]
}'
not_found status.
Example Response
{
"success": true,
"data": {
"orders": [
{
"order_id": 242859,
"status": "processing",
"product_id": "12310",
"quantity": 1,
"total": "5",
"currency_name": "USD",
"currency_symbol": "$"
},
{
"order_id": 242850,
"status": "completed",
"product_id": "12330",
"quantity": 1,
"total": "10",
"currency_name": "USD",
"currency_symbol": "$",
"codes": ["ABCD-1234-EFGH"]
},
{
"order_id": 242849,
"status": "not_found",
"error": "Order not found or access denied"
}
]
}
}
💰 Check Balance
Get the current balance of the authenticated user. Check this before creating orders.
Example Request
curl -X GET "https://mousa-card.com/wp-json/mps/v1/balance" \ -H "Authorization: Bearer YOUR_API_TOKEN"
Response Fields
| Field | Type | Description |
|---|---|---|
balance | string | Current balance amount |
currency_name | string | Currency name (e.g., USD, USDT) |
currency_symbol | string | Currency symbol (e.g., $) |
Example Response
{
"success": true,
"data": {
"balance": "150.5",
"currency_name": "USD",
"currency_symbol": "$"
}
}
❌ Error Codes
All errors follow a consistent format with appropriate HTTP status codes.
| Code | HTTP | Description |
|---|---|---|
unauthorized | 401 | Missing or invalid API token |
forbidden | 403 | Access denied to resource |
not_found | 404 | Resource not found |
invalid_request | 400 | Missing or invalid parameters |
insufficient_balance | 400 | Not enough balance for purchase |
unavailable | 400 | Product or variation not available |
insufficient_stock | 400 | Not enough stock (codes products) |
store_closed | 503 | Store is under maintenance |
purchase_disabled | 403 | Account purchase disabled |
system_error | 500 | Internal server error |
Error Response Format
{
"success": false,
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance",
"required": 50.000,
"available": 30.000,
"currency": "$"
}
}
processing - Order is being processedcompleted - Order fulfilled successfullycancelled - Order was cancelled
Response Fields by Product Type
| Product Type | Extra Fields (when completed) |
|---|---|
| Codes Product | codes - Array of code strings |
| Subscription Product | subscription_details - Object with email, password, url, notes |
| Simple/Variable | No extra fields |