Skip to main content
All cart endpoints accept the X-Cart-Token header for guest carts. Authenticated customers should also include their Authorization: Bearer token.

GET /cart

Get the current cart contents.

Authentication

Optional. Use X-Cart-Token for guest carts or Authorization: Bearer for authenticated customers.

Headers

HeaderValueRequired
X-Cart-TokenYes (guest)
AuthorizationBearer No

Example Request

curl "https://front.rmz.gg/api/cart" \
  -H "X-Cart-Token: cart_abc123"

Response

Success (200)

{
  "success": true,
  "data": {
    "cart_token": "cart_abc123",
    "items": [
      {
        "id": 1,
        "product_id": 101,
        "name": "Premium Game Key",
        "slug": "premium-game-key",
        "image": {
          "url": "https://...",
          "full_link": "https://...",
          "alt_text": "Premium Game Key"
        },
        "quantity": 2,
        "unit_price": 199.99,
        "total_price": 399.98,
        "pricing": {
          "base_price": 199.99,
          "addons_price": 0,
          "subscription_price": 0,
          "unit_total": 199.99,
          "formatted": {
            "base_price": "199.99 ر.س",
            "addons_price": null,
            "subscription_price": null,
            "unit_total": "199.99 ر.س",
            "total_price": "399.98 ر.س"
          }
        },
        "custom_fields": [],
        "subscription_plan": null,
        "notice": null,
        "product": {
          "id": 101,
          "name": "Premium Game Key",
          "slug": "premium-game-key",
          "type": "code",
          "fields": null,
          "price": {
            "formatted": "199.99 ر.س"
          },
          "image": {
            "url": "https://...",
            "full_link": "https://...",
            "alt_text": "Premium Game Key"
          }
        }
      }
    ],
    "count": 2,
    "subtotal": 399.98,
    "discount_amount": 0,
    "total": 399.98,
    "total_before_tax": 399.98,
    "coupon": null,
    "currency": "SAR",
    "tax": {
      "enabled": false,
      "rate": 0,
      "rate_formatted": "0%",
      "amount": 0,
      "amount_formatted": "0.00 ر.س",
      "country_code": null,
      "country_name": null
    }
  }
}

POST /cart/add

Add a product to the cart.

Authentication

Optional. Use X-Cart-Token for guest carts.

Headers

HeaderValueRequired
X-Cart-TokenNo (created if absent)
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
product_idintegerYesProduct ID (must belong to the current store)
qtynumericYesQuantity to add (minimum 1)
fieldsarrayNoCustom field values (key-value pairs matching product fields)
subscription_planintegerNoSubscription variant ID (required for subscription/license products)
noticestringNoCustomer note for this item (max 800 characters)

Example Request

curl -X POST "https://front.rmz.gg/api/cart/add" \
  -H "Content-Type: application/json" \
  -H "X-Cart-Token: cart_abc123" \
  -d '{
    "product_id": 101,
    "qty": 2,
    "fields": {
      "platform": "PC"
    },
    "notice": "Please include receipt"
  }'

Response

Success (200)

Returns the full cart contents (same format as GET /cart).
{
  "success": true,
  "data": { ... },
  "message": "تم إضافة المنتج بنجاح إلى السلة"
}

Error Responses

StatusDescription
400Out of stock, product unavailable, required fields missing, subscription already in cart, below minimum quantity, or subscription plan not selected
422Validation error (invalid product_id, missing qty)
Subscription and license products can only have a quantity of 1 in the cart. Adding a subscription product that is already in the cart will return an error.

PATCH /cart/items/

Update the quantity of a cart item.

Authentication

Optional. Use X-Cart-Token for guest carts.

Path Parameters

ParameterTypeDescription
idintegerProduct ID of the cart item

Headers

HeaderValueRequired
X-Cart-TokenYes (guest)
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
quantityintegerYesNew quantity (set to 0 to remove)

Example Request

curl -X PATCH "https://front.rmz.gg/api/cart/items/101" \
  -H "Content-Type: application/json" \
  -H "X-Cart-Token: cart_abc123" \
  -d '{"quantity": 3}'

Response

Success (200)

Returns the full cart contents.
{
  "success": true,
  "data": { ... },
  "message": "Cart updated successfully"
}

Error Responses

StatusDescription
400Below minimum quantity, exceeds stock, or subscription max quantity exceeded
404Product not found

DELETE /cart/items/

Remove a specific item from the cart.

Path Parameters

ParameterTypeDescription
idintegerProduct ID of the cart item to remove

Example Request

curl -X DELETE "https://front.rmz.gg/api/cart/items/101" \
  -H "X-Cart-Token: cart_abc123"

Response

Success (200)

{
  "success": true,
  "data": { ... },
  "message": "Product removed from cart successfully"
}

DELETE /cart/clear

Remove all items from the cart.

Example Request

curl -X DELETE "https://front.rmz.gg/api/cart/clear" \
  -H "X-Cart-Token: cart_abc123"

Response

Success (200)

{
  "success": true,
  "data": { ... },
  "message": "Cart cleared successfully"
}

GET /cart/count

Get the number of items in the cart.

Example Request

curl "https://front.rmz.gg/api/cart/count" \
  -H "X-Cart-Token: cart_abc123"

Response

Success (200)

{
  "success": true,
  "data": {
    "count": 3,
    "cart_token": "cart_abc123"
  }
}

GET /cart/validate

Validate the cart before proceeding to checkout. Checks stock availability, product status, and other constraints.

Example Request

curl "https://front.rmz.gg/api/cart/validate" \
  -H "X-Cart-Token: cart_abc123"

Response

Valid Cart (200)

{
  "success": true,
  "data": { ... },
  "message": "Cart is valid"
}

Invalid Cart (400)

{
  "success": false,
  "message": "Cart validation failed",
  "data": {
    "errors": [
      "Product 'Game Key' is out of stock",
      "Product 'Software License' has been removed"
    ]
  }
}

GET /cart/summary

Get a cart summary including available payment methods and shipping information. Use this before displaying the checkout page.

Example Request

curl "https://front.rmz.gg/api/cart/summary" \
  -H "X-Cart-Token: cart_abc123"

Response

Success (200)

{
  "success": true,
  "data": {
    "cart_token": "cart_abc123",
    "items": [...],
    "count": 2,
    "subtotal": 399.98,
    "discount_amount": 0,
    "total": 399.98,
    "total_before_tax": 399.98,
    "coupon": null,
    "currency": "SAR",
    "tax": {
      "enabled": false,
      "rate": 0,
      "rate_formatted": "0%",
      "amount": 0,
      "amount_formatted": "0.00 ر.س",
      "country_code": null,
      "country_name": null
    },
    "payment_methods": { ... },
    "shipping": {
      "required": false,
      "cost": 0
    }
  }
}
RMZ is a digital products platform. Shipping is always required: false with cost: 0.