Ecommerce API

Use these APIs to build a customer-facing ecommerce frontend (mobile app / SPA). This includes authentication, checkout, and orders.

Base URL

All ecommerce API endpoints are under:

https://{client_slug}.shrigo.com/api
1. Catalog
GET /categories
GET /products
GET /products/{product}
GET /products/hot-sales
GET /products/new-arrivals

Authentication

Protected endpoints require a Bearer token. Obtain it via login.

2. Login
POST /login
Field Type Required Description
login string Yes Email or phone
password string Yes Password
device_name string No Optional device identifier (max 100)

Success response: contains access_token.

Send token on protected endpoints:

Authorization: Bearer <access_token>
2.1 Register
POST /register

Create a new customer account. After registration, user must verify email before logging in.

Field Type Required Description
name string Yes Full name
email string Yes Email address
phone string No 10 Digits Phone number
password string Yes Minimum 8 characters
password_confirmation string Yes Must match password
2.2 Sign in with Google
POST /auth/google

Sign in using a Google ID token. If the customer does not exist, it is created automatically.

Field Type Required Description
id_token string Yes Google Sign-In ID token from client
device_name string No Optional device identifier (max 100)
2.3 Forgot Password
POST /forgot-password

Sends a password reset email if the account exists. Always returns a generic success message.

Field Type Required Description
email string Yes Registered email address
2.4 Resend Verification Email
POST /resend-verification

Re-sends the email verification link for an unverified customer. Always returns a generic success message.

Field Type Required Description
email string Yes Customer email address
3. Logout/Me
POST /logout
GET /me

4. Checkout flow

  • Fetch payment options.
  • Fetch delivery locations (for physical delivery vendors).
  • Submit checkout.
  • If response contains payment_url, redirect user there.
  • User returns to your return_url with status.
  • If status=pending, poll payment status until final.
4.1 Payment Options
GET /payment-options

Returns enabled gateways for this vendor (example keys: COD, Fonepay, Khalti, eSewa).

4.1.1 Delivery Locations
GET /delivery-locations

Returns delivery locations configured by the vendor (used for checkout address selection). For digital delivery vendors, you can skip this.

Example response:

{
  "success": true,
  "message": "Delivery locations.",
  "data": [
    { "location": "Kathmandu", "price": 100, "cod_available": true, "is_district": false },
    { "location": "Lalitpur", "price": 120, "cod_available": false, "is_district": false }
  ]
}
4.2 Checkout
POST /checkout

Important: return_url is required so the backend can redirect users back after payment.

Field Required Description
products Yes Cart lines (array or JSON string). Each line must include productId and quantity.



Optional keys per line:
  • size, color, type — send only if the product has variants/attributes and the user selected one.
  • customFieldValue — send when the product requires a custom text/value (e.g. engraving/name/notes). If required and missing, checkout will fail.
  • design — multipart file.
payment_option Yes Gateway key from payment-options
name Depends Required for physical delivery vendors. Not required for digital delivery.
phone Depends Required for physical delivery vendors (10 digits).
location Depends Required for physical delivery vendors (delivery location).
street Depends Required for physical delivery vendors.
i_agree Yes Must be accepted
return_url Yes Where to send the user after payment
coupon No Coupon code
order_note No Max 500 chars

Tip: The easiest way to ensure you send the correct payload is to use the interactive docs at /docs/api and copy the example request.

Products line item format

Each object inside products can include the following keys:

Key Type Required When to send
productId number Yes Product ID from catalog APIs.
quantity number Yes Quantity to order (must be ≤ available stock).
size string No Only if the product has size variants and user selected a size.
color string No Only if the product has color variants and user selected a color.
type string No Only if the product uses a third variant dimension (e.g. material/type).
customFieldValue string No Send when product requires a custom field (label configured by vendor). Example: “Happy Birthday”.
design (multipart) file When is_custom=true Required for custom products as a multipart part (not base64 in JSON). Field name: designs[{lineIndex}][0], where lineIndex is the zero-based index of that line in the products array. Slots [1], [2], … reserved for future multi-image support. Do not include a design key inside each product object. JPG, PNG, or WebP; max 5MB.

Example request (JSON):

{
  "products": [
    { "productId": 123, "quantity": 2, "size": "M", "color": "Black" }
  ],
  "payment_option": "Fonepay",
  "name": "John Doe",
  "phone": "9812345678",
  "location": "Kathmandu",
  "street": "New Road",
  "coupon": null,
  "order_note": "Please call before delivery",
  "i_agree": true,
  "return_url": "https://your-frontend.com/payment/result"
}

Example response (online payment):

{
  "success": true,
  "message": "Validation successful. Proceed to payment.",
  "data": {
    "amount": 200,
    "payment_url": "https://gateway.example/...",
    "payment_reference": "ABC123..."
  }
}

Example response (COD/no online payment):

{
  "success": true,
  "message": "Order placed successfully.",
  "data": {
    "amount": 200,
    "payment_url": null
  }
}
Return URL query params

Backend redirects the user back to your return_url with:

  • transaction_id (payment reference)
  • status: success, failed, or pending
4.3 Payment Status (when status=pending)
GET /checkout/payment-status/{transactionId}

Response status values: pending, success, failed, expired.

Example response:

{
  "success": true,
  "message": "Payment status.",
  "data": {
    "transaction_id": "ABC123...",
    "status": "pending",
    "order_id": null
  }
}

5. Orders

GET /orders
GET /orders/{order}
POST/orders/{order}/cancel
Chat with us