» Working with Orders

Working with Orders

In the context of WebCommander, “orders” represent transactions where customers purchase products from a website. This section explains how to effectively work with order data within the WebCommander platform. To streamline order-related tasks, WebCommander provides a set of APIs. Below is a list of order-related operations that you can perform using WebCommander’s APIs:

Get Order List

Returns the list of all orders. An example is given below:

curl --location 'http://yourapp.com/external/app/access/orders?max=-1&offset=0' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'

Request Details

  • Request URL: http://yourapp.com/external/app/access/orders
  • Request type: GET

Request Parameter

"max": "-1",
"offset": "0"

Response

{
    "status": "success",
    "total": 424,
    "max": "1",
    "offset": "0",
    "orders": [
        {
            "orderComment": [],
            "payments": [
                {
                    "surcharge": 0.0,
                    "amount": 25.0,
                    "trackInfo": null,
                    "payerInfo": "Customer# 93",
                    "gatewayCode": "PIS",
                    "payingDate": "2023-05-10T10: 02: 15",
                    "gatewayName": null,
                    "gatewayResponse": null,
                    "id": 1808,
                    "refundId": null,
                    "order": 1645,
                    "status": "refunded"
                },
                {
                    "surcharge": 0.0,
                    "amount": 10.0,
                    "trackInfo": "",
                    "payerInfo": "",
                    "gatewayCode": "PIS",
                    "payingDate": "2023-05-14T09: 58: 15",
                    "gatewayName": null,
                    "gatewayResponse": null,
                    "id": 1809,
                    "refundId": null,
                    "order": 1645,
                    "status": "refunded"
                }
            ],
            "lastReminderTime": "2023-05-10T10: 02: 15",
            "totalSurcharge": 0.0,
            "orderStatus": "pending",
            "orderChannel": null,
            "billing": {
                "lastName": "Tom",
                "country": 12,
                "city": "Wheelers Hill",
                "companyName": null,
                "mobile": "123456789",
                "firstName": "Jarry",
                "phone": "12345",
                "addressLine1": "Address Line 1",
                "addressLine2": null,
                "postCode": "3150",
                "id": 4346,
                "state": 72,
                "fax": "fax",
                "email": "3896\u0040noemail.loc"
            },
            "shippingStatus": "completed",
            "shippingTax": 0.0,
            "shipping": {
                "lastName": "Tom",
                "country": 12,
                "city": "Wheelers Hill",
                "companyName": null,
                "mobile": "123456789",
                "firstName": "Jarry",
                "phone": "12345",
                "addressLine1": "Address Line 1",
                "addressLine2": null,
                "postCode": "3150",
                "id": 4347,
                "state": 72,
                "fax": "fax",
                "email": "3896\u0040noemail.loc"
            },
            "discountOnOrder": 0.0,
            "additionalInfo": null,
            "customerId": 301,
            "handlingCost": 0.0,
            "discountOnShippingTax": 0.0,
            "id": 1645,
            "paymentStatus": "unpaid",
            "handlingTax": 0.0,
            "orderNo": 635,
            "shippingCost": 0.0,
            "discountOnOrderTotalTax": 0.0,
            "created": "2023-05-10T10: 02: 15",
            "ipAddress": "0: 0: 0: 0: 0: 0: 0: 1",
            "deliveryType": "shipping",
            "version": null,
            "shipments": [
                {
                    "shippingDate": "2023-05-14T04: 33: 32",
                    "method": "Australia Post",
                    "trackingInfo": "TRX45454",
                    "id": 47,
                    "shipmentItem": [
                        140
                    ],
                    "order": 1645
                }
            ],
            "customerName": "Jarry Tommmmmy",
            "reminderCount": 0,
            "createdBy": null,
            "actualTax": 0.91,
            "discountOnShipping": 0.0,
            "updated": "2023-05-14T10: 18: 48",
            "items": [
                {
                    "actualDiscount": 0.0,
                    "quantity": 1,
                    "productId": 180,
                    "productVariationId": null,
                    "actualPrice": 9.99,
                    "shippingClassName": null,
                    "taxDiscount": 0.0,
                    "isTaxable": true,
                    "discount": 0.0,
                    "tax": 0.91,
                    "storeId": null,
                    "version": null,
                    "shippingClassId": null,
                    "productName": "Nike Brasilia Football\u002fRugby Boot Bag",
                    "price": 9.08,
                    "variations": [],
                    "id": 2940,
                    "productType": "product",
                    "isShippable": true,
                    "productInfo": {
                        "images": [
                            {
                                "idx": 1,
                                "name": "nike-brasilia-boot-bag.jpg",
                                "altText": "Nike Brasilia Football\u002fRugby Boot Bag",
                                "url": "http:\u002f\u002flocalhost: 1301\u002fresources\u002f00000000\u002fproduct\u002fproduct-180\u002fnike-brasilia-boot-bag.jpg"
                            }
                        ]
                    }
                }
            ],
            "orderSummary": {
                "subTotal": "9.08",
                "shippingCost": "0.00",
                "shippingTax": "0.00",
                "handlingCost": "0.00",
                "totalSurcharge": "0.00",
                "totalDiscount": "0.00",
                "totalTax": "0.91",
                "grandTotal": "9.99",
                "paid": "0.00",
                "due": "9.99"
            }
        }
    ]
}

Get Single Order

Responsible to get a single order detail. An example is given below :

curl --location 'http://yourapp.com/external/app/access/order?id=2344666' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'

Request Details

  • Request URL: http://yourapp.com/external/app/access/order
  • Request type: GET

Request parameter

"id": 1220

Response

{
    "order": {
        "orderComment": [],
        "payments": [
            {
                "surcharge": 0.0,
                "amount": 249.7,
                "trackInfo": null,
                "payerInfo": "Guest Customer",
                "gatewayCode": "PIS",
                "payingDate": "2021-09-03T06: 00: 43",
                "gatewayName": null,
                "gatewayResponse": null,
                "id": 100,
                "refundId": null,
                "order": 100,
                "status": "pending"
            }
        ],
        "lastReminderTime": "2021-09-03T06: 00: 43",
        "totalSurcharge": 0.0,
        "orderStatus": "cancelled",
        "orderChannel": null,
        "billing": {
            "lastName": "Tom",
            "country": {
                "isDefault": true,
                "code": "AU",
                "name": "Australia",
                "id": 12,
                "state": [
                    66,
                    67,
                    68,
                    69,
                    70,
                    71,
                    72,
                    73
                ],
                "isActive": true
            },
            "city": "South Yarra",
            "companyName": null,
            "mobile": "123456789",
            "version": null,
            "firstName": "Jarry",
            "phone": "12345",
            "addressLine1": "Address Line 1",
            "addressLine2": null,
            "postCode": "3141",
            "id": 220,
            "state": {
                "country": 12,
                "isDefault": false,
                "code": "VIC",
                "name": "Victoria",
                "id": 72,
                "isActive": true
            },
            "fax": "fax",
            "email": "220\u0040noemail.loc"
        },
        "shippingStatus": "awaiting",
        "shippingTax": 0.0,
        "shipping": {
            "lastName": "Tom",
            "country": {
                "isDefault": true,
                "code": "AU",
                "name": "Australia",
                "id": 12,
                "state": [
                    66,
                    67,
                    68,
                    69,
                    70,
                    71,
                    72,
                    73
                ],
                "isActive": true
            },
            "city": "South Yarra",
            "companyName": null,
            "mobile": "123456789",
            "version": null,
            "firstName": "Jarry",
            "phone": "12345",
            "addressLine1": "Address Line 1",
            "addressLine2": null,
            "postCode": "3141",
            "id": 223,
            "state": {
                "country": 12,
                "isDefault": false,
                "code": "VIC",
                "name": "Victoria",
                "id": 72,
                "isActive": true
            },
            "fax": "fax",
            "email": "223\u0040noemail.loc"
        },
        "discountOnOrder": 0.0,
        "additionalInfo": null,
        "customerId": null,
        "handlingCost": 0.0,
        "discountOnShippingTax": 0.0,
        "id": 100,
        "paymentStatus": "unpaid",
        "handlingTax": 0.0,
        "orderNo": 34,
        "shippingCost": 0.0,
        "discountOnOrderTotalTax": 0.0,
        "created": "2021-09-03T06: 00: 43",
        "ipAddress": "114.130.180.169",
        "deliveryType": "shipping",
        "version": null,
        "shipments": [],
        "customerName": "Guest Customer",
        "reminderCount": 0,
        "createdBy": null,
        "actualTax": 22.7,
        "discountOnShipping": 0.0,
        "updated": "2021-12-23T03: 44: 17",
        "items": [
            {
                "actualDiscount": 0.0,
                "quantity": 3,
                "productId": 1,
                "productVariationId": null,
                "actualPrice": 71.5,
                "shippingClassName": null,
                "taxDiscount": 0.0,
                "isTaxable": true,
                "discount": 0.0,
                "tax": 19.5,
                "storeId": null,
                "version": null,
                "shippingClassId": null,
                "productName": "Mulgrave 1\u002f4 zip",
                "price": 65.0,
                "variations": [],
                "id": 250,
                "productType": "product",
                "isShippable": true,
                "productInfo": {
                    "images": [
                        {
                            "idx": 1,
                            "name": "Test.png",
                            "altText": "Mulgrave 1\u002f4 zip",
                            "url": "http:\u002f\u002flocalhost: 1301\u002fresources\u002f00000000\u002fproduct\u002fproduct-1\u002fTest.png"
                        }
                    ]
                }
            },
            {
                "actualDiscount": 0.0,
                "quantity": 1,
                "productId": 13,
                "productVariationId": null,
                "actualPrice": 35.2,
                "shippingClassName": null,
                "taxDiscount": 0.0,
                "isTaxable": true,
                "discount": 0.0,
                "tax": 3.2,
                "storeId": null,
                "version": null,
                "shippingClassId": null,
                "productName": "Mulgrave Training Tee_37",
                "price": 32.0,
                "variations": [
                    "Colour: red",
                    "Size: XS"
                ],
                "id": 253,
                "productType": "product",
                "isShippable": true,
                "productInfo": {
                    "images": [
                        {
                            "thumbnail": "http:\u002f\u002flocalhost: 1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002f150-default.png",
                            "url": "http:\u002f\u002flocalhost: 1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002fdefault.png"
                        }
                    ]
                }
            }
        ],
        "orderSummary": {
            "subTotal": "227.00",
            "shippingCost": "0.00",
            "shippingTax": "0.00",
            "handlingCost": "0.00",
            "totalSurcharge": "0.00",
            "totalDiscount": "0.00",
            "totalTax": "22.70",
            "grandTotal": "249.70",
            "paid": "0.00",
            "due": "249.70"
        }
    }
}

Order Create

Responsible for creating an order. An example is given below:

curl --location 'http://yourapp.com/external/app/access/order-create' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "billingAddress": {
        "firstName": "John",
        "addressLine1": "60 Siddeley St, Docklands VIC 3008, Australia",
        "city": "Docklands",
        "postCode": "3008",
        "countryId": "11",
        "stateId": "7",
        "email": "john@bitmascot.com"
    },
    "shippingAddress": {
        "firstName": "John",
        "addressLine1": "60 Siddeley St, Docklands VIC 3008, Australia",
        "city": "Docklands",
        "postCode": "3008",
        "countryId": "11",
        "stateId": 7,
        "email": "john@bitmascot.com"
    },
    "customerId": 6,
    "handlingCost": 0,
    "shippingCost": 0,
    "shippingTax": 0,
    "totalSurcharge": 0,
    "ipAddress": "10.10.10.10",
    "items": [
        {
            "productId": 495,
            "productName": "API Product",
            "productType": "product",
            "quantity": 1,
            "price": 666.00,
            "tax": 0,
            "discount": 0,
            "isShippable": true,
            "isTaxable": true
        }
    ]
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/order-create
  • Request type: POST

Request Parameter

{
    "billingAddress": {
        "firstName": "John",
        "addressLine1": "60 Siddeley St, Docklands VIC 3008, Australia",
        "city": "Docklands",
        "postCode": "3008",
        "countryId": "11",
        "stateId": "7",
        "email": "john@bitmascot.com"
    },
    "shippingAddress": {
        "firstName": "John",
        "addressLine1": "60 Siddeley St, Docklands VIC 3008, Australia",
        "city": "Docklands",
        "postCode": "3008",
        "countryId": "11",
        "stateId": 7,
        "email": "john@bitmascot.com"
    },
    "customerId": 6,
    "handlingCost": 0,
    "shippingCost": 0,
    "shippingTax": 0,
    "totalSurcharge": 0,
    "ipAddress": "10.10.10.10",
    "items": [
        {
            "productId": 495,
            "productName": "API Product",
            "productType": "product",
            "quantity": 1,
            "price": 666.00,
            "tax": 0,
            "discount": 0,
            "isShippable": true,
            "isTaxable": true
        }
    ]
}

Response

{
    "status": "success",
    "order": {
        "orderComment": [],
        "payments": [
            {
                "surcharge": 0.0,
                "amount": 666.0,
                "trackInfo": null,
                "payerInfo": null,
                "gatewayCode": "PIS",
                "payingDate": "2023-02-01T09:38:18",
                "gatewayName": null,
                "gatewayResponse": null,
                "id": 63,
                "refundId": null,
                "order": 48,
                "status": "awaiting"
            }
        ],
        "lastReminderTime": "2023-02-01T09:38:17",
        "totalSurcharge": 0.0,
        "orderStatus": "pending",
        "orderChannel": null,
        "billing": {
            "lastName": null,
            "country": {
                "isDefault": false,
                "code": "AM",
                "name": "Armenia",
                "id": 11,
                "state": [],
                "isActive": true
            },
            "city": "Docklands",
            "companyName": null,
            "mobile": null,
            "version": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "60 Siddeley St, Docklands VIC 3008, Australia",
            "addressLine2": null,
            "postCode": "3008",
            "id": 186,
            "state": {
                "country": 236,
                "isDefault": false,
                "code": "CT",
                "name": "Connecticut",
                "id": 7,
                "isActive": true
            },
            "fax": null,
            "email": "john@bitmascot.com"
        },
        "shippingStatus": "awaiting",
        "shippingTax": 0.0,
        "shipping": {
            "lastName": null,
            "country": {
                "isDefault": false,
                "code": "AM",
                "name": "Armenia",
                "id": 11,
                "state": [],
                "isActive": true
            },
            "city": "Docklands",
            "companyName": null,
            "mobile": null,
            "version": null,
            "firstName": "Irtiza",
            "phone": null,
            "addressLine1": "60 Siddeley St, Docklands VIC 3008, Australia",
            "addressLine2": null,
            "postCode": "3008",
            "id": 189,
            "state": {
                "country": 236,
                "isDefault": false,
                "code": "CT",
                "name": "Connecticut",
                "id": 7,
                "isActive": true
            },
            "fax": null,
            "email": "john@bitmascot.com"
        },
        "discountOnOrder": 0.0,
        "additionalInfo": null,
        "customerId": 6,
        "handlingCost": 0.0,
        "discountOnShippingTax": 0.0,
        "id": 48,
        "paymentStatus": "unpaid",
        "handlingTax": 0.0,
        "orderNo": 16,
        "shippingCost": 0.0,
        "discountOnOrderTotalTax": 0.0,
        "created": "2023-02-01T09:38:17",
        "ipAddress": "172.16.15.151",
        "deliveryType": "shipping",
        "version": null,
        "shipments": [],
        "customerName": "Irtiza",
        "reminderCount": 0,
        "createdBy": null,
        "actualTax": 60.55,
        "discountOnShipping": 0.0,
        "updated": "2023-02-01T09:38:18",
        "items": [
            {
                "actualDiscount": 0.0,
                "quantity": 1,
                "productId": 495,
                "productVariationId": null,
                "actualPrice": 666.0,
                "shippingClassName": null,
                "taxDiscount": 0.0,
                "isTaxable": true,
                "discount": 0.0,
                "tax": 60.55,
                "storeId": null,
                "version": null,
                "shippingClassId": null,
                "productName": "API Product",
                "price": 605.45,
                "variations": null,
                "id": 48,
                "productType": "product",
                "isShippable": true
            }
        ],
        "orderSummary": {
            "subTotal": "605.45",
            "shippingCost": "0.00",
            "shippingTax": "0.00",
            "handlingCost": "0.00",
            "totalSurcharge": "0.00",
            "totalDiscount": "0.00",
            "totalTax": "60.55",
            "grandTotal": "666.00",
            "paid": "0.00",
            "due": "666.00"
        }
    },
    "paymentData": {}
}

Change Order Status

Responsible for changing order status. An example is given below:

curl --location 'http://yourapp.com/external/app/access/change-order-Status' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": "48",
    "status": "completed"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/change-order-Status
  • Request type: POST

Request Parameter

{
    "id": "48",
    "status": "completed"
} 
OR 
{
    "id": "48",
    "status": "cancelled"
}

Response

{ "status": "success" }

Order Comment Add

Responsible for adding comments in order. An example is given below:

curl --location 'http://yourapp.com/external/app/access/order-comment-add' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "orderId": "22",
    "message": "quick deliver"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/order-comment-add
  • Request type: POST

Request Parameter

{
    "orderId": "22",
    "message": "quick deliver"
}

Response

{ "status": "success", "id": 6 }

Order Payment Refund

Responsible for refunding an order payment. An example is given below:

curl --location 'http://yourapp.com/external/app/access/order-payment-refund' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": "66",
    "amount": "66"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/order-payment-refund
  • Request type: POST

Request Parameter

{
    "id": "66",
    "amount": "66"
}

Response

{ "status": "success", "haveToReAdjustInvetory": false, "id": 66 }

Change Order Payment Status

Responsible for changing order payment status. An example is given below:

curl --location 'http://yourapp.com/external/app/access/change-order-payment-status' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": "48",
    "status": "completed"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/change-order-payment-status
  • Request type: POST

Request Parameter

{ "id": "48", "status": "completed" } OR { "id": "48", "status": "cancelled" }

Response

{ "status": "success" }

Make Order Payment

Responsible for making payment for an order. An example is given below:

curl --location 'http://yourapp.com/external/app/access/make-order-payment' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "orderId": "48",
    "paymentGateway": "PIS",
    "date": "2023-02-01 20:38:17",
    "amount": "666",
    "isNotify": "false"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/make-order-payment
  • Request type: POST

Request Parameter

{
    "orderId": "48",
    "paymentGateway": "PIS",
    "date": "2023-02-01 20:38:17",
    "amount": "666",
    "isNotify": "false"
}

Response

{ "status": "success", "id": 66 }

Payment Gateways

Returns the list of available payment gateways. An example is given below:

curl --location 'http://yourapp.com/external/app/access/payment-gateways?max=-1&offset=0' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'

Request Details

  • Request URL: http://yourapp.com/external/app/access/payment-gateways
  • Request type: GET

Request Parameter

"max": "-1",
"offset": "0"

Response

{
    "status": "success",
    "total": 9,
    "max": "1",
    "offset": "0",
    "paymentGatewayList": [
        {
            "isPromotional": false,
            "code": "PIS",
            "flatSurcharge": 0.0,
            "successMessage": null,
            "version": null,
            "isDefault": false,
            "availableToCustomers": [],
            "isSurChargeApplicable": false,
            "surchargeType": "no_surcharge",
            "availableToCustomerGroups": [],
            "zone": null,
            "percentSurcharge": 0.0,
            "availableFor": "everyone",
            "isEnabled": true,
            "name":"Pay In Store",
            "pendingMessage": null,
            "information": null,
            "id": 1,
            "updated": "2023-05-10T07:11:01",
            "surchargeRange": []
        }
    ]
}

Update Payment Gateway

Responsible for updating payment gateway configurations. An example is given below:

curl --location 'http://yourapp.com/external/app/access/update-payment-gateway' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": 8,
    "isEnabled": "true",
    "isDefault": "true",
    "isUnionPay": "true",
    "metafield.CRD.creditCardProcessor": "SECUREPAY_OAUTH2",
    "isUnionPay": "true",
    "metafield.SECUREPAY_OAUTH2.type": "merchant",
    "metafield.SECUREPAY_OAUTH2.mode": "test",
    "metafield.SECUREPAY_OAUTH2.merchantCode": "5AR0055",
    "metafield.SECUREPAY_OAUTH2.client_Id": "0oaxb9i8P9vQdXTsn3l5",
    "metafield.SECUREPAY_OAUTH2.client_secret": "0aBsGU3x1bc-UIF_vDBA2JzjpCPHjoCP7oI6jisp",
    "metafield.CRD.cardType": "creditCard",
    "metafield.CRD.creditCards": "visa",
    "metafield.CRD.creditCards": "master",
    "availableFor": "everyone",
    "surchargeType": "no_surcharge",
    "flatSurcharge": 0.0,
    "percentSurcharge": 0.0,
    "pendingMessage": "",
    "successMessage": "<p>Charges will appear on your credit card as <strong>*WEBALIVE*</strong></p>"
}'

Request Details

  • Request URL: http://yourapp.com/external/app/access/update-payment-gateway
  • Request type: POST

Request Parameter

{
    "id": 8,
    "isEnabled": "true",
    "isDefault": "true",
    "isUnionPay": "true",
    "metafield.CRD.creditCardProcessor": "SECUREPAY_OAUTH2",
    "isUnionPay": "true",
    "metafield.SECUREPAY_OAUTH2.type": "merchant",
    "metafield.SECUREPAY_OAUTH2.mode": "test",
    "metafield.SECUREPAY_OAUTH2.merchantCode": "5AR0055",
    "metafield.SECUREPAY_OAUTH2.client_Id": "0oaxb9i8P9vQdXTsn3l5",
    "metafield.SECUREPAY_OAUTH2.client_secret": "0aBsGU3x1bc-UIF_vDBA2JzjpCPHjoCP7oI6jisp",
    "metafield.CRD.cardType": "creditCard",
    "metafield.CRD.creditCards": "visa",
    "metafield.CRD.creditCards": "master",
    "availableFor": "everyone",
    "surchargeType": "no_surcharge",
    "flatSurcharge": 0.0,
    "percentSurcharge": 0.0,
    "pendingMessage": "",
    "successMessage": "<p>Charges will appear on your credit card as <strong>*WEBALIVE*</strong></p>"
}

Response

{ "status": "success" , "message": "Successfully Updated"}