Introduction
Customer portal is a self-service option, which provides customers with a single point of access to company/product information. Users can access the functionality of different modules such as orders, payments, etc., depending on the privileges assigned to their role.
BASE URL: https://customer-portal-alpha.vercel.app/api
We have language bindings in Shell, Ruby, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
This example API documentation page was created with Greenboard. Feel free to edit it and use it as a base for your own API's documentation.
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each requestcurl "api_endpoint_here"-H "Authorization: secretToken"
Make sure to replace
secretToken
with your API key.
Customer portal API uses a JWT token to allow access to the API. You can login in our signin API at our developer portal, if you're already registered and get a token.
Customer portal API expects for the token to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer secretToken
Auth
User registration
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/signup' \--header 'Content-Type: application/json' \--data-raw '{"name": "user","email": "user@gmail.com","password": "pass","phoneNumber": "090078601","address": "Abc","courier": "Aliexpress","trackingNumber": "51651681"}'
The above command returns JSON structured like this:
{"status": "PENDING","message": "Verification otp email sent","data": {"email": "user@gmail.com","_id": "6391c49ca8e6c7ca3df21b33"}}
This endpoint creates a user and assigns customer role to it.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/signup
User Sign In
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/signin' \--header 'Content-Type: application/json' \--data-raw '{"email": "user@gmail.com","password": "pass"}'
The above command returns JSON structured like this:
{"accessToken": "accessToken","refreshToken": "refreshToken"}
This endpoint is used to log in to the portal and get jwt token.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/signin
Verify OTP
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/verifyOTP' \--header 'Content-Type: application/json' \--data-raw '{"email": "user@gmail.com","otp": "8213"}'
The above command returns JSON structured like this:
{"status": "Verified","message": "Email verified successfully "}
This endpoint verifies the user via OTP.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/verifyOTP
Resend OTP
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/resendOTP' \--header 'Content-Type: application/json' \--data-raw '{"email": "user@gmail.com"}'
The above command returns JSON structured like this:
{"status": "PENDING","message": "Verification otp email sent","data": {"email": "user@gmail.com","_id": "6391c49ca8e6c7ca3df21b33"}}
This endpoint resends the OTP if it is expired.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/resendOTP
Token Creation
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/token' \--header 'token: refreshToken'
The above command returns JSON structured like this:
{"accessToken": "accessToken"}
This endpoint creates the access token from the refresh token
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/token
Forgot password
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/forgot-password' \--header 'Content-Type: application/json' \--data-raw '{"email": "user@gmail.com"}'
The above command returns JSON structured like this:
PWD sent link has been sent to email
This endpoint sends a reset password link to the email defined
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/forgot-password
Reset password
curl --location --request GET 'http://customer-portal-alpha.vercel.app/api/reset-password/:userId/:token' \--header 'Content-Type: application/json' \--data-raw '{"email": "user@gmail.com"}'
The above command returns JSON structured like this:
{"email": "user@gmail.com","message": "Enter your new pwd in reset pwd post route",}
This endpoint verifies if the forgot password link is valid or not
HTTP Request
GET http://customer-portal-alpha.vercel.app/api/reset-password/<userId>/<token>
URL Parameters
Parameter | Description |
---|---|
userId | The ID of the user who wants to change the password |
token | The unique token generated which consists the details of the user |
Change password
curl --location --request POST 'http://customer-portal-alpha.vercel.app/api/reset-password/:userId/:token' \--header 'Content-Type: application/json' \--data-raw '{"password": "newpassword"}'
The above command returns JSON structured like this:
{"userId": "Id of user","password": "Hashed password",}
This endpoint changes the password
HTTP Request
POST http://customer-portal-alpha.vercel.app/api/reset-password/<userId>/<token>
URL Parameters
Parameter | Description |
---|---|
userId | The ID of the user who wants to change the password |
token | The unique token generated which consists the details of the user |
Users
Get all users
curl --location --request GET 'http://customer-portal-alpha.vercel.app/api/users' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"docs": [{"_id": "63527a5555dfc7a8079a5e4e","name": "user","email": "user@gmail.com","password": "$jhbasd$jabhjads","phoneNumber": "090078601","address": "Address of user","verified": true,"deleteStatus": false,"role": "role","createdAt": "2022-10-21T10:54:13.112Z","updatedAt": "2022-10-21T10:54:13.112Z","__v": 0,"userId": "UID","shippingInfo": {"courier": "courier name","trackingNumber": "090078601","address": "Address of user"}}]}
This endpoint fetches all the user profiles
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/users
Create user
curl --location --request POST 'https://customer-portal-kaispe.herokuapp.com//users' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"name": "user","email": "user@gmail.com","password": "password","phoneNumber": "0165161","address": "address","courier": "courier","trackingNumber": "651650161"}'
The above command returns JSON structured like this:
{"status": "PENDING","message": "Verification otp email sent","data": {"email": "user@gmail.com","_id": "6391c49ca8e6c7ca3df21b33"}}
This endpoint creates a user
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/users
Get a specific user
curl --location --request GET 'http://customer-portal-alpha.vercel.app/api/users/:id' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"_id": "63527a5555dfc7a8079a5e4e","name": "user","email": "user@gmail.com","password": "$jhbasd$jabhjads","phoneNumber": "090078601","address": "Address of user","verified": true,"deleteStatus": false,"role": "role","createdAt": "2022-10-21T10:54:13.112Z","updatedAt": "2022-10-21T10:54:13.112Z","__v": 0,"userId": "UID","shippingInfo": {"courier": "courier name","trackingNumber": "090078601","address": "Address of user"}}
This endpoint gets a specific user
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/users/<id>
URL Parameters
Parameter | Description |
---|---|
id | The ID of the user to get |
Updates a specific user
curl --location --request PATCH 'http://customer-portal-alpha.vercel.app/api/users/:id' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"name": "user name"}'
The above command returns JSON structured like this:
{"message": "User updated successfully"}
This endpoint updates a specific user
HTTP Request
PATCH https://customer-portal-alpha.vercel.app/api/users/<id>
URL Parameters
Parameter | Description |
---|---|
id | The ID of the user to update |
Deletes a specific user
curl --location --request DELETE 'http://customer-portal-alpha.vercel.app/api/users/:id' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"message": "User deleted successfully"}
This endpoint deletes a specific user
HTTP Request
DELETE https://customer-portal-alpha.vercel.app/api/users/<id>
URL Parameters
Parameter | Description |
---|---|
id | The ID of the user to delete |
Products
Get all products
curl --location --request GET 'http://customer-portal-alpha.vercel.app/api/products' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"docs": [{"_id": "6347f90ad2d0b4cf845c6207","name": "Headphones","productId": "1","status": "available","category": "Electronic","price": 25,"productImage": [{"name": "1667390534195_productImage_1.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534195_productImage_1.jpg?alt=media&token=6b03598d-f8fb-452a-a3f3-cad858df149c"},{"name": "1667390534196_productImage_2.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534196_productImage_2.jpg?alt=media&token=4b1c2e3c-c4e3-495b-b635-4267ee0761aa"},{"name": "1667390534198_productImage_3.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534198_productImage_3.jpg?alt=media&token=04a25612-bdbd-4f79-921d-e0e46a23fcd2"},{"name": "1667390534200_productImage_4.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534200_productImage_4.jpg?alt=media&token=bb6d400b-f0dc-4b80-85a7-4dcc7045ee57"},{"name": "1667390534202_productImage_5.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534202_productImage_5.jpg?alt=media&token=a62673f6-2bf7-4b85-8e06-18f1af4c0554"}],"productGenId": "ProdID34","unitOfMeasure": "perEach"}]}
This endpoint fetches all the products
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/products
Query Parameters
Parameter | Default | Description |
---|---|---|
name | '' | If provided, the result will give the products of that name. |
status | '' | If given the result will give all the products of that status. |
price | '' | A range that will give the products that'll fall in that range |
productId | '' | If provided, the result will give the specified product. |
Create a product
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/api/products' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"name": "Airdots","productId": "X025","status": "available","category": "electronic","price": 0,"quantity": 0,"stockQuantity": 0,"unitOfMeasure": "per","productImage": [{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"}]}'
The above command returns JSON structured like this:
{"status": 201,"message": "Record created"}
This endpoint creates a product
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/products
Body Parameters
Parameter | Default | Description |
---|---|---|
name | Name of the product | |
productId | Unique id of the globally product | |
status | Status of the product whether it is available or out of stock. Can accept only these values: ['available', 'outOfStock'] | |
category | Category of the product | |
price | 0 | Price of the product |
quantity | 0 | Quantity of the product |
stockQuantity | 0 | Stock Quantity of the product |
productImage | Array which contains objects that contains the product image name and their url | |
unitOfMeasure | The unit measure of product |
Get product
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/api/products/:prodId' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"_id": "6347f90ad2d0b4cf845c6207","name": "Headphones","productId": "1","status": "available","category": "Electronic","price": 25,"productImage": [{"name": "1667390534195_productImage_1.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534195_productImage_1.jpg?alt=media&token=6b03598d-f8fb-452a-a3f3-cad858df149c"},{"name": "1667390534196_productImage_2.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534196_productImage_2.jpg?alt=media&token=4b1c2e3c-c4e3-495b-b635-4267ee0761aa"},{"name": "1667390534198_productImage_3.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534198_productImage_3.jpg?alt=media&token=04a25612-bdbd-4f79-921d-e0e46a23fcd2"},{"name": "1667390534200_productImage_4.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534200_productImage_4.jpg?alt=media&token=bb6d400b-f0dc-4b80-85a7-4dcc7045ee57"},{"name": "1667390534202_productImage_5.jpg","url": "https://firebasestorage.googleapis.com/v0/b/customer-portal-kaispe.appspot.com/o/public%2Fuploads%2FproductImages%2F1667390534202_productImage_5.jpg?alt=media&token=a62673f6-2bf7-4b85-8e06-18f1af4c0554"}],"productGenId": "ProdID34","unitOfMeasure": "perEach"}
This endpoint fetches a specific product
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/products/<prodId>
URL Parameters
Parameter | Default | Description |
---|---|---|
prodId | The product global id |
Update product
curl --location --request PATCH 'https://customer-portal-alpha.vercel.app/api/api/products/:prodId' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"name": "Airdots","status": "available","category": "electronic","price": 0,"quantity": 0,"stockQuantity": 0,"unitOfMeasure": "per","productImage": [{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"},{"name": "name.jpg","url": "https://url/"}]}'
The above command returns JSON structured like this:
{"message": "Updated successfully"}
This endpoint updates a product
HTTP Request
PATCH https://customer-portal-alpha.vercel.app/api/products/<prodId>
URL Parameters
Parameter | Default | Description |
---|---|---|
prodId | The product global id |
Body Parameters
Parameter | Default | Description |
---|---|---|
name | Name of the product | |
status | Status of the product whether it is available or out of stock. Can accept only these values: ['available', 'outOfStock'] | |
category | Category of the product | |
price | 0 | Price of the product |
quantity | 0 | Quantity of the product |
stockQuantity | 0 | Stock Quantity of the product |
productImage | Array which contains objects that contains the product image name and their url | |
unitOfMeasure | The unit measure of product |
Delete product
curl --location --request DELETE 'https://customer-portal-alpha.vercel.app/api/api/products/:prodId' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"message": "Deleted successfully"}
This endpoint deletes a product
HTTP Request
DELETE https://customer-portal-alpha.vercel.app/api/products/<prodId>
URL Parameters
Parameter | Default | Description |
---|---|---|
prodId | The product global id |
Upload product images
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/products/upload' \--header 'Authorization: Bearer jwtToken' \--form 'productImage=@"location"' \--form 'productImage=@"location"' \--form 'productImage=@"location"' \--form 'productImage=@"location"' \--form 'productImage=@"location"'
The above command returns JSON structured like this:
[ {"name": "name","url": "url"}]
This endpoint uploads product images
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/products/upload
Body Parameters
Parameter | Default | Description |
---|---|---|
productImage | The product images |
Order Management
Get all orders
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/order-management' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"docs": [{"invoiceStatus": "unpaid","_id": "636b846c59cd3e8593337e63","orderStatus": "cancelled","shippingMethod": "car","products": [{"quantity": 1,"unit_price": 15,"prodRefId": "6347f90ad2d0b4cf845c6207","_id": "636b846c59cd3e8593337e64"},{"quantity": 2,"unit_price": 30,"prodRefId": "634808446c5aa4a06c9287ff","_id": "636b846c59cd3e8593337e65"}],"userRefId": "63625814a32326c9a462578f","userId": "UID16","deleteStatus": false,"expectedDeliveryDate": "2022-11-19T10:43:56.784Z","orderPlaced": "2022-11-09T10:43:56.784Z","totalAmount": 75,"totalQuantity": 3,"createdAt": "2022-11-09T10:43:56.786Z","updatedAt": "2022-11-09T10:45:22.320Z","__v": 0,"orderId": "OID98","paymentRefId": {"_id": "636b84c259cd3e8593337e67","userRefId": "63625814a32326c9a462578f","userId": "UID16","status": "paid","method": "card","orderRefId": "636b846c59cd3e8593337e63","deleteStatus": false,"paymentDate": "2022-11-19T10:45:22.318Z","createdAt": "2022-11-09T10:45:22.319Z","updatedAt": "2022-11-09T10:45:22.319Z","__v": 0,"paymentId": "PID38"}}]}
This endpoint fetches all the orders based on the role assigned to the logged in user
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/order-management
Query Parameters
Parameter | Default | Description |
---|---|---|
orderId | If provided, the result will give the specified order. | |
orderStatus | If given the result will give all the orders of that status. | |
paymentStatus | orderStatus | |
paymentMethod | If given the result will give all the orders of that method. | |
date_placed | If given the range i.e. (date1-date2) will give all the orders that fall in that range. | |
userId | Only allowed for admin, If given the user id of the user all the orders of that user will be given. | |
page | 1 | The page at which the user wants to navigate |
perPage | 10 | Per page how many orders should be shown |
Create order
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/order-management' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"totalAmount": 25,"totalQuantity": 50,"shippingInsurance": "required","shippingService": "standard","partialShipment": false,"saveAs": "save","vat": 15,"grossTotal": 200,"products": [{"quantity": 15,"unit_price": 10,"total_price": 150,"prodRefId": "6347f90ad2d0b4cf845c6207"}],"shippingAddress": {"name": "Shipper name","phone": "Shipper number","address": "Shipper address"},"buyerDetails": {"name": "Buyer name","phone": "Buyer number","address": "Buyer address"}}'
The above command returns JSON structured like this:
{"message": "Record created successfully"}
This endpoint creates an order.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/order-management
Body Parameters
Parameter | Db type | Description |
---|---|---|
totalAmount | Int | The total amount of the order |
totalQuantity | Int | The total items of the order |
shippingMethod | String | The shipping method of the order |
shippingInsurance | String | An enum which only accepts these options: ['required', 'optional'] |
shippingService | String | An enum which only accepts these options: ['standard', 'custom'] |
partialShipment | Boolean | Either true or false. |
saveAs | String | An enum which only accepts these options: ['save', 'draft'] |
vat | Int | The value tax to be added in total amount |
grossTotal | Int | The total amount value after adding vat. |
products | Array | An array which contains multiple objects of products |
quantity | Int | The quantity of the product |
unit_price | Int | The unit price of product |
total_price | Int | The total price of the product calculated. |
prodRefId | Int | The total price of the product calculated. |
shippingAddress | Object | An object which contains the shipping information |
name | String | Name of the user where the order will be delivered |
phone | String | Phone number of the user where the order will be delivered |
address | String | Address of the user where the order will be delivered |
buyerDetails | Object | An object which contains the buyer details |
name | String | Name of the user whose creating the order |
phone | String | Phone number of the user whose creating the order |
address | String | Address of the user whose creating the order |
Get order
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/order-management/:orderId' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"invoiceStatus": "unpaid","_id": "636b846c59cd3e8593337e63","orderStatus": "cancelled","shippingMethod": "car","products": [{"quantity": 1,"unit_price": 15,"prodRefId": "6347f90ad2d0b4cf845c6207","_id": "636b846c59cd3e8593337e64"},{"quantity": 2,"unit_price": 30,"prodRefId": "634808446c5aa4a06c9287ff","_id": "636b846c59cd3e8593337e65"}],"userRefId": "63625814a32326c9a462578f","userId": "UID16","deleteStatus": false,"expectedDeliveryDate": "2022-11-19T10:43:56.784Z","orderPlaced": "2022-11-09T10:43:56.784Z","totalAmount": 75,"totalQuantity": 3,"createdAt": "2022-11-09T10:43:56.786Z","updatedAt": "2022-11-09T10:45:22.320Z","__v": 0,"orderId": "OID98","paymentRefId": {"_id": "636b84c259cd3e8593337e67","userRefId": "63625814a32326c9a462578f","userId": "UID16","status": "paid","method": "card","orderRefId": "636b846c59cd3e8593337e63","deleteStatus": false,"paymentDate": "2022-11-19T10:45:22.318Z","createdAt": "2022-11-09T10:45:22.319Z","updatedAt": "2022-11-09T10:45:22.319Z","__v": 0,"paymentId": "PID38"}}
This endpoint fetches a specific order
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/order-management/<orderId>
Update order
curl --location --request PATCH 'https://customer-portal-alpha.vercel.app/api/order-management/:orderId' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"totalAmount": 25,"totalQuantity": 50,"shippingInsurance": "required","shippingService": "standard","partialShipment": false,"saveAs": "save","vat": 15,"grossTotal": 200,"products": [{"quantity": 15,"unit_price": 10,"total_price": 150,"prodRefId": "6347f90ad2d0b4cf845c6207"}],"shippingAddress": {"name": "Shipper name","phone": "Shipper number","address": "Shipper address"},"buyerDetails": {"name": "Buyer name","phone": "Buyer number","address": "Buyer address"}}'
The above command returns JSON structured like this:
{"message": "Order updated successfully"}
This endpoint updates an order.
HTTP Request
PATCH https://customer-portal-alpha.vercel.app/api/order-management/<orderId>
Body Parameters
Parameter | Db type | Description |
---|---|---|
totalAmount | Int | The total amount of the order |
totalQuantity | Int | The total items of the order |
shippingMethod | String | The shipping method of the order |
shippingInsurance | String | An enum which only accepts these options: ['required', 'optional'] |
shippingService | String | An enum which only accepts these options: ['standard', 'custom'] |
partialShipment | Boolean | Either true or false. |
saveAs | String | An enum which only accepts these options: ['save', 'draft'] |
vat | Int | The value tax to be added in total amount |
grossTotal | Int | The total amount value after adding vat. |
products | Array | An array which contains multiple objects of products |
quantity | Int | The quantity of the product |
unit_price | Int | The unit price of product |
total_price | Int | The total price of the product calculated. |
prodRefId | Int | The total price of the product calculated. |
shippingAddress | Object | An object which contains the shipping information |
name | String | Name of the user where the order will be delivered |
phone | String | Phone number of the user where the order will be delivered |
address | String | Address of the user where the order will be delivered |
buyerDetails | Object | An object which contains the buyer details |
name | String | Name of the user whose creating the order |
phone | String | Phone number of the user whose creating the order |
address | String | Address of the user whose creating the order |
Delete order
curl --location --request DELETE 'https://customer-portal-alpha.vercel.app/api/order-management/:orderId' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"message": "Order deleted successfully"}
This endpoint deletes an order.
HTTP Request
DELETE https://customer-portal-alpha.vercel.app/api/order-management/<orderId>
Export all orders
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/order-management/export/AllOrders' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{[{"invoiceStatus": "unpaid","_id": "636b846c59cd3e8593337e63","orderStatus": "cancelled","shippingMethod": "car","products": [{"quantity": 1,"unit_price": 15,"prodRefId": "6347f90ad2d0b4cf845c6207","_id": "636b846c59cd3e8593337e64"},{"quantity": 2,"unit_price": 30,"prodRefId": "634808446c5aa4a06c9287ff","_id": "636b846c59cd3e8593337e65"}],"userRefId": "63625814a32326c9a462578f","userId": "UID16","deleteStatus": false,"expectedDeliveryDate": "2022-11-19T10:43:56.784Z","orderPlaced": "2022-11-09T10:43:56.784Z","totalAmount": 75,"totalQuantity": 3,"createdAt": "2022-11-09T10:43:56.786Z","updatedAt": "2022-11-09T10:45:22.320Z","__v": 0,"orderId": "OID98","paymentRefId": {"_id": "636b84c259cd3e8593337e67","userRefId": "63625814a32326c9a462578f","userId": "UID16","status": "paid","method": "card","orderRefId": "636b846c59cd3e8593337e63","deleteStatus": false,"paymentDate": "2022-11-19T10:45:22.318Z","createdAt": "2022-11-09T10:45:22.319Z","updatedAt": "2022-11-09T10:45:22.319Z","__v": 0,"paymentId": "PID38"}}]}
This endpoint fetches all the orders based on the role assigned to the logged in user
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/order-management/export/AllOrders
Query Parameters
Parameter | Default | Description |
---|---|---|
orderId | If provided, the result will give the specified order. | |
orderStatus | If given the result will give all the orders of that status. | |
paymentStatus | orderStatus | |
paymentMethod | If given the result will give all the orders of that method. | |
date_placed | If given the range i.e. (date1-date2) will give all the orders that fall in that range. | |
userId | Only allowed for admin, If given the user id of the user all the orders of that user will be given. |
Create orders in bulk
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/order-management/createBulk' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '[{"totalAmount": 25,"totalQuantity": 50,"shippingInsurance": "required","shippingService": "standard","partialShipment": false,"saveAs": "save","vat": 15,"grossTotal": 200,"products": [{"quantity": 15,"unit_price": 10,"total_price": 150,"prodRefId": "6347f90ad2d0b4cf845c6207"}],"shippingAddress": {"name": "Shipper name","phone": "Shipper number","address": "Shipper address"},"buyerDetails": {"name": "Buyer name","phone": "Buyer number","address": "Buyer address"}}]'
The above command returns JSON structured like this:
{"message": "Record created successfully"}
This endpoint creates an order.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/order-management/createBulk
Body Parameters
Parameter | Db type | Description |
---|---|---|
totalAmount | Int | The total amount of the order |
totalQuantity | Int | The total items of the order |
shippingMethod | String | The shipping method of the order |
shippingInsurance | String | An enum which only accepts these options: ['required', 'optional'] |
shippingService | String | An enum which only accepts these options: ['standard', 'custom'] |
partialShipment | Boolean | Either true or false. |
saveAs | String | An enum which only accepts these options: ['save', 'draft'] |
vat | Int | The value tax to be added in total amount |
grossTotal | Int | The total amount value after adding vat. |
products | Array | An array which contains multiple objects of products |
quantity | Int | The quantity of the product |
unit_price | Int | The unit price of product |
total_price | Int | The total price of the product calculated. |
prodRefId | Int | The total price of the product calculated. |
shippingAddress | Object | An object which contains the shipping information |
name | String | Name of the user where the order will be delivered |
phone | String | Phone number of the user where the order will be delivered |
address | String | Address of the user where the order will be delivered |
buyerDetails | Object | An object which contains the buyer details |
name | String | Name of the user whose creating the order |
phone | String | Phone number of the user whose creating the order |
address | String | Address of the user whose creating the order |
Transaction details
Get all payment details
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/paymentDetails' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"docs": [{"_id": "636b84c259cd3e8593337e67","userId": "UID16","status": "paid","orderRefId": {"_id": "636b846c59cd3e8593337e63","products": [{"quantity": 1,"unit_price": 15,"prodRefId": "6347f90ad2d0b4cf845c6207","_id": "636b846c59cd3e8593337e64"},{"quantity": 2,"unit_price": 30,"prodRefId": "634808446c5aa4a06c9287ff","_id": "636b846c59cd3e8593337e65"}],"totalAmount": 75,"totalQuantity": 3,"orderId": "OID98"},"paymentDate": "2022-11-19T10:45:22.318Z","paymentId": "PID38"}]}
This endpoint fetches all the transactions based on the role assigned to the logged in user
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/paymentDetails
Query Parameters
Parameter | Default | Description |
---|---|---|
paymentId | If provided, the result will give the specified payment details. | |
status | If given the result will give all the payments of that status. | |
transaction_date | If given the range i.e. (date1-date2) will give all the transactions that fall in that range. | |
userId | Only allowed for admin, If given the user id of the user all the transactions of that user will be given. | |
page | 1 | The page at which the user wants to navigate |
perPage | 10 | Per page how many orders should be shown |
orderId | If provided, the result will give the specified payment details of that order. |
Create payment
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/paymentDetails' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"status": "received","method": "card","orderRefId": "635280b09086b3ad16a4a3cf"}'
The above command returns JSON structured like this:
{"message": "Record created successfully"}
This endpoint creates a payment.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/paymentDetails
Body Parameters
Parameter | Db type | Description |
---|---|---|
status | String | The status of the transaction. Takes the value in any of these: ['paid', 'unpaid', 'refund'] |
method | String | The method of the transaction. Takes the value in any of these: ['card', 'cash'] |
orderRefId | Object Id | Foreign key. Referred to the order table. |
Get payment details
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/paymentDetails/:paymentId' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"_id": "636b84c259cd3e8593337e67","userId": "UID16","status": "paid","orderRefId": {"_id": "636b846c59cd3e8593337e63","products": [{"quantity": 1,"unit_price": 15,"prodRefId": "6347f90ad2d0b4cf845c6207","_id": "636b846c59cd3e8593337e64"},{"quantity": 2,"unit_price": 30,"prodRefId": "634808446c5aa4a06c9287ff","_id": "636b846c59cd3e8593337e65"}],"totalAmount": 75,"totalQuantity": 3,"orderId": "OID98"},"paymentDate": "2022-11-19T10:45:22.318Z","paymentId": "PID38"}
This endpoint fetches the transaction
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/paymentDetails/<paymentId>
URL Parameters
Parameter | Description |
---|---|
paymentId | The payment id generated at time of payment creation |
Update payment
curl --location --request PATCH 'https://customer-portal-alpha.vercel.app/api/paymentDetails/:paymentId' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"status": "received","method": "card","orderRefId": "635280b09086b3ad16a4a3cf"}'
The above command returns JSON structured like this:
{"message": "Payment updated successfully"}
This endpoint updates a payment.
HTTP Request
PATCH https://customer-portal-alpha.vercel.app/api/paymentDetails/<paymentId>
URL Parameters
Parameter | Description |
---|---|
paymentId | The payment id generated at time of payment creation |
Body Parameters
Parameter | Db type | Description |
---|---|---|
status | String | The status of the transaction. Takes the value in any of these: ['paid', 'unpaid', 'refund'] |
method | String | The method of the transaction. Takes the value in any of these: ['card', 'cash'] |
orderRefId | Object Id | Foreign key. Referred to the order table. |
Change payment status
curl --location --request PATCH 'https://customer-portal-alpha.vercel.app/api/paymentDetails/:paymentId' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"status": "received",}'
The above command returns JSON structured like this:
{"message": "Payment updated successfully"}
This endpoint changes payment status.
HTTP Request
PUT https://customer-portal-alpha.vercel.app/api/paymentDetails/<paymentId>
URL Parameters
Parameter | Description |
---|---|
paymentId | The payment id generated at time of payment creation |
Body Parameters
Parameter | Db type | Description |
---|---|---|
status | String | The status of the transaction. Takes the value in any of these: ['paid', 'unpaid', 'refund'] |
Delete payment
curl --location --request DELETE 'https://customer-portal-alpha.vercel.app/api/paymentDetails/:paymentId' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{"message": "Payment deleted successfully"}
This endpoint changes payment status.
HTTP Request
DELETE https://customer-portal-alpha.vercel.app/api/paymentDetails/<paymentId>
URL Parameters
Parameter | Description |
---|---|
paymentId | The payment id generated at time of payment creation |
Export all payment details
curl --location --request GET 'https://customer-portal-alpha.vercel.app/api/paymentDetails/export/AllPayments' \--header 'Authorization: Bearer jwtToken'
The above command returns JSON structured like this:
{[{"_id": "636b84c259cd3e8593337e67","userId": "UID16","status": "paid","orderRefId": {"_id": "636b846c59cd3e8593337e63","products": [{"quantity": 1,"unit_price": 15,"prodRefId": "6347f90ad2d0b4cf845c6207","_id": "636b846c59cd3e8593337e64"},{"quantity": 2,"unit_price": 30,"prodRefId": "634808446c5aa4a06c9287ff","_id": "636b846c59cd3e8593337e65"}],"totalAmount": 75,"totalQuantity": 3,"orderId": "OID98"},"paymentDate": "2022-11-19T10:45:22.318Z","paymentId": "PID38"}]}
This endpoint fetches all the transactions based on the role assigned to the logged in user
HTTP Request
GET https://customer-portal-alpha.vercel.app/api/paymentDetails/export/AllPayments
Query Parameters
Parameter | Default | Description |
---|---|---|
paymentId | If provided, the result will give the specified payment details. | |
status | If given the result will give all the payments of that status. | |
transaction_date | If given the range i.e. (date1-date2) will give all the transactions that fall in that range. | |
userId | Only allowed for admin, If given the user id of the user all the transactions of that user will be given. | |
page | 1 | The page at which the user wants to navigate |
perPage | 10 | Per page how many orders should be shown |
orderId | If provided, the result will give the specified payment details of that order. |
Contact
Create contact
curl --location --request POST 'https://customer-portal-alpha.vercel.app/api/contact' \--header 'Authorization: Bearer jwtToken' \--header 'Content-Type: application/json' \--data-raw '{"title": "zx","content": "jeez","caption": "this or that","images": [{"filename": "filename","url": "url of image"}]}'
The above command returns JSON structured like this:
{"message": "Record created successfully"}
This endpoint posts contact form.
HTTP Request
POST https://customer-portal-alpha.vercel.app/api/contact
Body Parameters
Parameter | Db type | Description |
---|---|---|
userId | Object Id | The id of the user |
title | String | Title of the contact. |
content | String | Content of the contact. |
caption | String | Caption of the contact. |
images | Array | Images of the form |
Upload contact images
curl --location --request POST 'https://customer-portal-kaispe.herokuapp.com/api/contact/upload' \--header 'Authorization: Bearer jwtToken' \--form 'contactImages=@"/C:/Users/bilalulhaque/Desktop/test/pexels-maxime-francis-2246476 - Copy - Copy (2).jpg"'
The above command returns JSON structured like this:
{[{"filename": "fileName","url": "https://firebasestorage.googleapis.com/v0/filename"}]}
This endpoint posts contact form.
HTTP Request
POST https://customer-portal-kaispe.herokuapp.com/api/contact/upload
Body Parameters
Parameter | Description |
---|---|
contactImages |