Orders

The order model contains all the information about order created by users.

Properties

Here are the properties for the orderSchema model:

  • Name
    buyer
    Type
    ObjectId
    Description

    Reference to the user who is buying the product.

  • Name
    seller
    Type
    ObjectId
    Description

    Reference to the user who is selling the product.

  • Name
    product
    Type
    object
    Description

    Information about the product.

    • Name
      title
      Type
      string
      Description

      The title of the product.

    • Name
      brand
      Type
      string
      Description

      The brand of the product.

    • Name
      sellPrice
      Type
      number
      Description

      The selling price of the product (required).

    • Name
      id
      Type
      ObjectId
      Description

      The ID of the product (required).

    • Name
      size
      Type
      string
      Description

      The size of the product (required).

  • Name
    dest
    Type
    AddressSchema
    Description

    The destination address for the order (required).

  • Name
    source
    Type
    AddressSchema
    Description

    The source address for the order.

  • Name
    actualPrice
    Type
    number
    Description

    The actual price of the order (required).

  • Name
    deliveryPrice
    Type
    number
    Description

    The delivery price for the order.

  • Name
    platformFee
    Type
    number
    Description

    The platform fee for the order.

  • Name
    bonusRedeemed
    Type
    number
    Description

    The bonus redeemed for the order.

  • Name
    totalPrice
    Type
    number
    Description

    The total price of the order.

  • Name
    offer
    Type
    ObjectId
    Description

    Reference to the offer associated with the order.

  • Name
    promocode_id
    Type
    ObjectId
    Description

    Reference to the promocode associated with the order.

  • Name
    state
    Type
    string
    Description

    The state of the order (required).

  • Name
    declined_reason
    Type
    string
    Description

    The reason the order was declined.

  • Name
    return_reason
    Type
    string
    Description

    The reason the order was returned.

  • Name
    delivery_reference
    Type
    string
    Description

    The delivery reference for the order.

  • Name
    comment
    Type
    string
    Description

    Comments related to the order.


GET/v1/orders/{orderID}

Get exact order

This endpoint retrieves details of a specific order.

Required attributes

  • Name
    orderID
    Type
    ObjectId
    Description

    The ID of the order to retrieve.

Request

GET
/v1/orders/{orderID}
curl -X GET https://api.thefashionpeople.com/v1/orders/{orderID} \
  -H "Authorization: Bearer {token}"

Response

{
  "id": "{orderID}",
  "prettyId": 12345,
  "buyer": "buyerID",
  "seller": "sellerID",
  "product": {
    "title": "Product Title",
    "brand": "Product Brand",
    "sellPrice": 100,
    "id": "productID",
    "size": "L"
  },
  "dest": {
    "address": "Destination Address"
  },
  "source": {
    "address": "Source Address"
  },
  "actualPrice": 100,
  "deliveryPrice": 10,
  "platformFee": 5,
  "bonusRedeemed": 2,
  "totalPrice": 113,
  "offer": "offerID",
  "promocode_id": "promocodeID",
  "state": "Order State",
  "declined_reason": "Declined Reason",
  "return_reason": "Return Reason",
  "delivery_reference": "Delivery Reference",
  "comment": "Order Comment"
}

POST/v1/orders/{orderID}/confirm

Confirm order by seller

This endpoint allows the seller to confirm an order.

Required attributes

  • Name
    orderID
    Type
    ObjectId
    Description

    The ID of the order to be confirmed.

Request

POST
/v1/orders/{orderID}/confirm
curl -X POST https://api.thefashionpeople.com/v1/orders/{orderID}/confirm \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Order has been confirmed by the seller.",
  "orderID": "{orderID}"
}

POST/v1/orders/{orderID}/cancel-by-buyer

Cancel order by buyer

This endpoint allows the buyer to cancel an order.

Required attributes

  • Name
    orderID
    Type
    ObjectId
    Description

    The ID of the order to be canceled.

Request

POST
/v1/orders/{orderID}/cancel-by-buyer
curl -X POST https://api.thefashionpeople.com/v1/orders/{orderID}/cancel-by-buyer \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Order has been canceled by the buyer.",
  "orderID": "{orderID}"
}

POST/v1/orders/{orderID}/decline

Decline order

This endpoint allows the seller to decline an order.

Required attributes

  • Name
    orderID
    Type
    ObjectId
    Description

    The ID of the order to be declined.

Request

POST
/v1/orders/{orderID}/decline
curl -X POST https://api.thefashionpeople.com/v1/orders/{orderID}/decline \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Order has been declined.",
  "orderID": "{orderID}"
}
POST/v1/orders/{orderID}/init-return

Initiate order return

This endpoint allows the initiation of a return for a specific order.

Required attributes

  • Name
    orderID
    Type
    ObjectId
    Description

    The ID of the order to be returned.

Request

POST
/v1/orders/{orderID}/init-return
curl -X POST https://api.thefashionpeople.com/v1/orders/{orderID}/init-return \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Order return has been initiated.",
  "orderID": "{orderID}"
}
GET/v1/orders/{orderID}/payment-url

Get payment URL for order

This endpoint retrieves the payment URL for a specific order.

Required attributes

  • Name
    orderID
    Type
    ObjectId
    Description

    The ID of the order to get the payment URL for.

Request

GET
/v1/orders/{orderID}/payment-url
curl -X GET https://api.thefashionpeople.com/v1/orders/{orderID}/payment-url \
  -H "Authorization: Bearer {token}"

Response

{
  "payment_url": "https://paymentgateway.com/pay?order_id={orderID}"
}
GET/v1/orders/delivery-departments

Get delivery departments

This endpoint retrieves a list of delivery departments.

Request

GET
/v1/orders/delivery-departments
curl -X GET https://api.thefashionpeople.com/v1/orders/delivery-departments \
  -H "Authorization: Bearer {token}"

Response

{
  "departments": [
    {
      "id": "department1",
      "name": "Department 1"
    },
    {
      "id": "department2",
      "name": "Department 2"
    }
  ]
}