Working with Store

An admin can configure his store. In this section, We have explained how to play with WebCommander store configuration. There are multiple webhooks and APIs available for store-based operation. You can find the list of webhooks in the webhook section. A list of available APIs are given below:

Get Countries

Returns the list of countries. An example is given below-

{
    "webhooks": [
        {
            "sourceUrl": "https://yourapp.com/api/v1/cart/added-to-cart",
            "eventName": "added-to-cart",
            "renderScope": "",
            "accessType": "webhook"
        }
    ],
    "scriptTag": [
        {
            "sourceUrl": "https://yourapp.com/assets/js/script-tag.js",
            "renderScope": "All",
            "accessType": "scriptTag"
        }
    ],
    "customerProfileTabs": [
        {
            "customerProfileTabIdentifier": "myPluginTab",
            "customerProfileTabDisplayName": "My Plugin",
            "customerProfileTabSourceUrl": "https://yourapp.com/plugin/my-plugin"
        }
    ]
}

Request URL: http://yourapp.com/external/app/access/countries

Request type: GET

Response

{
  "status": "success",
  "countries": [
    {
      "isDefault": false,
      "code": "AF",
      "name": "Afghanistan",
      "id": 1,
      "state": [],
      "isActive": true,
      "version": null
    },
    {
      "isDefault": false,
      "code": "AL",
      "name": "Albania",
      "id": 2,
      "state": [],
      "isActive": true,
      "version": null
    }
  ]
}

Working With My Profile

Customer profiles play a pivotal role in allowing customers to manage their personal information, including account details, billing information, shipping details, and order history. In WebCommander, plugin developers have the capability to enhance this section by adding plugin-specific tabs or sections. This empowers customers to conveniently manage data related to your plugin. Below, we outline the process of configuring custom profile tabs step by step from the WebCommander admin panel.

Overview

Similar to webhooks or ScriptTags, you can register a customer profile tab during the plugin installation process. On the /install endpoint, you need to return an array of configurations with the specified parameters. Here’s an example:

{
    "webhooks": [
        {
            "sourceUrl": "https://yourapp.com/api/v1/cart/added-to-cart", // The url WebCommander will call when firing this hook
            "eventName": "added-to-cart", // A webhook. Check Webhook list to find details
            "renderScope": "", // Required for script tags
            "accessType": "webhook" // A data access type to define which way your plugin collecting data.    
        }
    ],
    "scriptTags": [
        {
            "sourceUrl": "https://yourapp.com/assets/js/script-tag.js", // The JS file URL webcommander will render in the head where you can manipulate its dom/data through JS code. Also possible to customise css.  
            "eventName": "", // Not required for Script Tags.
            "renderScope": "All", //Required for script tags. Values: "All/Specific page url"
            "accessType": "scriptTag" // A data access type to define which way your plugin collecting or manipulating data.
        }
    ],
    "customerProfileTabs": [
        {
            "customerProfileTabIdentifier": "miningbullSubscription", // A unique tab identifier
            "customerProfileTabDisplayName": "Subscriptions", // Display name will be displayed in customer configuration section and customer profile. You may change it from configuration. 
            "customerProfileTabSourceUrl": "https://stage-mnb.clubeez.com/customer/subscrptions" // The page WebCommander will render through iframe for the registered tab.  
        }
    ]
}

After installing the plugin, the site administrator can navigate to the customer settings section and enable or disable any customer profile tab. WebCommander will render the customer profile custom tab source URL through an iframe, including additional parameters such as “uuid” and “user_token” to ensure security and authentication.

Example URL: https://stage-mnb.clubeez.com/customer/subscriptions?uuid=EF6AA-A8E0-4D0F&user_token=fDJ8CVR39i3O59Oi0YsyXnie6NMTiKvnvr2AR

To adjust the height and width of an iframe, you can use the following code:

window.addEventListener('load', function () {
    var data = {
        notificationType: "iframeHeightWidthAdjust", // fixed. No need to change. 
        notificationObj: {
            width: document.body.scrollHeight,
            height: document.body.scrollWidth,
            section: "mining" // unique customerProfileTabIdentifier 
        }
    };
    window.parent.postMessage(data, "*")
});

This code ensures that the iframe’s dimensions are properly adjusted for an optimal user experience.

By following these steps, you can enhance the customer profile section in WebCommander with custom tabs and sections related to your plugin, providing users with a seamless and personalised experience.

Plugin Widget

WebCommander offers widgets that you can easily incorporate into a website using the drag-and-drop editor. These widgets are designed to be user-friendly and require no coding expertise. By selecting a widget from the sidebar in the WebCommander Page editor, users can configure its settings and position it anywhere on your web page. If your plugin requires display on the front end, such as in contact forms, photo galleries, video embedding, or integrating social media feeds, you should consider incorporating one or more widgets into your plugin.

Registering Plugin Widgets

Registering widgets in WebCommander is similar to registering webhooks or ScriptTags. You can provide a list of plugin widgets that need to be registered. Page editors can then drag and drop these widgets onto pages and configure them using options provided by the plugin owner. This allows for easy customisation and design flexibility.

{
    "webhooks": [
        {
            "sourceUrl": "https://yourapp.com/api/v1/cart/added-to-cart", // The url WebCommander will call when firing this hook
            "eventName": "added-to-cart", // A webhook. Check Webhook list to find details
            "renderScope": "", // Required for script tags
            "accessType": "webhook" // A data access type to define which way your plugin collecting data.    
        }
    ],
    "scriptTags": [
        {
            "sourceUrl": "https://yourapp.com/assets/js/script-tag.js", // The JS file URL webcommander will render in the head where you can manipulate its dom/data through JS code. Also possible to customise css.  
            "eventName": "DummyEvent", // Not required for Script Tags.
            "renderScope": "All", //Required for script tags. Values: "All/Specific page url"
            "accessType": "scriptTag" // A data access type to define which way your plugin collecting or manipulating data.
        }
    ],
    "widgets": [
        {
            "widgetName": "mining", //unique internal identifier of widget(no space and special character and number allowed) 
            "widgetLabel": "Mining Signup", //widget display name  
            "widgetTitle": "Mining Signup Widget", //widget title will show on hover Widget 
            "widgetLogo": "https://stagingmining.mywebcommander.com/template/9738593f/images/package-pricing-icon.svg", // The URL of the logo of this widget
            "sourceUrl": "https://stage-mnb.clubeez.com/signup-widget?uuid=BB1EF6AA-A8E0-4D0F", // widget render source url 
            "configurationUrl": "https://stage-mnb.clubeez.com/configuration-signup-widget?uuid=BB1EF6AA-A8E0-4D0F", //widget configuration endpoint url 
        }
    ]
}

Response Parameters

Field NameDescription
widgetNameA unique internal identifier for the widget. It should not contain spaces, special characters, or numbers.
widgetLabelThe display name of the widget.
widgetTitleThe title of the widget, which appears when hovering over it.
widgetLogoThe URL of the widget’s logo.
sourceUrlThe URL from which the widget is rendered. It is displayed within an iframe in WebCommander.
configurationUrlThe URL used for configuring or modifying the widget’s rendering source to enable dynamic rendering.

In the following example, a plugin widget called “Mining Bull” is registered and rendered. It includes a signup form with a dynamic dropdown feature, which is added through the render source URL. Additionally, a basic controller section is provided in the left sidebar panel, allowing users to customise the title, add a custom class, or include custom CSS and JS. Clicking on the “Configuration” button will redirect you to a configuration page, which is also rendered within an iframe.

Maintaining Widget Dimensions

To ensure proper rendering, you can use the following JavaScript code to dynamically adjust the widget’s height and width:

window.addEventListener('load', function () {
    var data = {
        notificationType: "iframeHeightWidthAdjust", // fixed. No need to change. 
        notificationObj: {
            width: document.body.scrollWidth,
            height: document.body.scrollHeight,
            section: "mining" // unique widgetName
        }
    };
    window.parent.postMessage(data, "*")
})

By registering and utilising Plugin Widgets in WebCommander, you can enrich your website’s functionality and provide a superior user experience for your visitors.

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/orders?max=-1&offset=0' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/orders?max=-1&offset=0',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/orders?max=-1&offset=0", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/orders?max=-1&offset=0")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/orders?max=-1&offset=0", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/order?id=2344666' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/order?id=2344666',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/order?id=2344666", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/order?id=2344666")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/order?id=2344666", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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
        }
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/order-create',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "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
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "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,
      "tax": 0,
      "discount": 0,
      "isShippable": True,
      "isTaxable": True
    }
  ]
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/order-create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/order-create")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"billingAddress\": {\r\n        \"firstName\": \"John\",\r\n        \"addressLine1\": \"60 Siddeley St, Docklands VIC 3008, Australia\",\r\n        \"city\": \"Docklands\",\r\n        \"postCode\": \"3008\",\r\n        \"countryId\": \"11\",\r\n        \"stateId\": \"7\",\r\n        \"email\": \"john@bitmascot.com\"\r\n    },\r\n    \"shippingAddress\": {\r\n        \"firstName\": \"John\",\r\n        \"addressLine1\": \"60 Siddeley St, Docklands VIC 3008, Australia\",\r\n        \"city\": \"Docklands\",\r\n        \"postCode\": \"3008\",\r\n        \"countryId\": \"11\",\r\n        \"stateId\": 7,\r\n        \"email\": \"john@bitmascot.com\"\r\n    },\r\n    \"customerId\": 6,\r\n    \"handlingCost\": 0,\r\n    \"shippingCost\": 0,\r\n    \"shippingTax\": 0,\r\n    \"totalSurcharge\": 0,\r\n    \"ipAddress\": \"10.10.10.10\",\r\n    \"items\": [\r\n        {\r\n            \"productId\": 495,\r\n            \"productName\": \"API Product\",\r\n            \"productType\": \"product\",\r\n            \"quantity\": 1,\r\n            \"price\": 666.00,\r\n            \"tax\": 0,\r\n            \"discount\": 0,\r\n            \"isShippable\": true,\r\n            \"isTaxable\": true\r\n        }\r\n    ]\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/order-create", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""billingAddress"": {
" + "\n" +
@"        ""firstName"": ""John"",
" + "\n" +
@"        ""addressLine1"": ""60 Siddeley St, Docklands VIC 3008, Australia"",
" + "\n" +
@"        ""city"": ""Docklands"",
" + "\n" +
@"        ""postCode"": ""3008"",
" + "\n" +
@"        ""countryId"": ""11"",
" + "\n" +
@"        ""stateId"": ""7"",
" + "\n" +
@"        ""email"": ""john@bitmascot.com""
" + "\n" +
@"    },
" + "\n" +
@"    ""shippingAddress"": {
" + "\n" +
@"        ""firstName"": ""John"",
" + "\n" +
@"        ""addressLine1"": ""60 Siddeley St, Docklands VIC 3008, Australia"",
" + "\n" +
@"        ""city"": ""Docklands"",
" + "\n" +
@"        ""postCode"": ""3008"",
" + "\n" +
@"        ""countryId"": ""11"",
" + "\n" +
@"        ""stateId"": 7,
" + "\n" +
@"        ""email"": ""john@bitmascot.com""
" + "\n" +
@"    },
" + "\n" +
@"    ""customerId"": 6,
" + "\n" +
@"    ""handlingCost"": 0,
" + "\n" +
@"    ""shippingCost"": 0,
" + "\n" +
@"    ""shippingTax"": 0,
" + "\n" +
@"    ""totalSurcharge"": 0,
" + "\n" +
@"    ""ipAddress"": ""10.10.10.10"",
" + "\n" +
@"    ""items"": [
" + "\n" +
@"        {
" + "\n" +
@"            ""productId"": 495,
" + "\n" +
@"            ""productName"": ""API Product"",
" + "\n" +
@"            ""productType"": ""product"",
" + "\n" +
@"            ""quantity"": 1,
" + "\n" +
@"            ""price"": 666.00,
" + "\n" +
@"            ""tax"": 0,
" + "\n" +
@"            ""discount"": 0,
" + "\n" +
@"            ""isShippable"": true,
" + "\n" +
@"            ""isTaxable"": true
" + "\n" +
@"        }
" + "\n" +
@"    ]
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/change-order-Status',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": "48",
    "status": "completed"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": "48",
  "status": "completed"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/change-order-Status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/change-order-Status")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": \"48\",\r\n    \"status\": \"completed\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/change-order-Status", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": ""48"",
" + "\n" +
@"    ""status"": ""completed""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/order-comment-add',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "orderId": "22",
    "message": "quick deliver"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "orderId": "22",
  "message": "quick deliver"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/order-comment-add", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/order-comment-add")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"orderId\": \"22\",\r\n    \"message\": \"quick deliver\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/order-comment-add", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""orderId"": ""22"",
" + "\n" +
@"    ""message"": ""quick deliver""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/order-payment-refund',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": "66",
    "amount": "66"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": "66",
  "amount": "66"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/order-payment-refund", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/order-payment-refund")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": \"66\",\r\n    \"amount\": \"66\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/order-payment-refund", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": ""66"",
" + "\n" +
@"    ""amount"": ""66""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/change-order-payment-status',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": "48",
    "status": "completed"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": "48",
  "status": "completed"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/change-order-payment-status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/change-order-payment-status")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": \"48\",\r\n    \"status\": \"completed\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/change-order-payment-status", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": ""48"",
" + "\n" +
@"    ""status"": ""completed""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/change-order-payment-status',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": "48",
    "status": "completed"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": "48",
  "status": "completed"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/change-order-payment-status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/change-order-payment-status")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": \"48\",\r\n    \"status\": \"completed\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/change-order-payment-status", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": ""48"",
" + "\n" +
@"    ""status"": ""completed""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/payment-gateways?max=-1&offset=0' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/payment-gateways?max=-1&offset=0',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/payment-gateways?max=-1&offset=0", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/payment-gateways?max=-1&offset=0")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/payment-gateways?max=-1&offset=0", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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&nbsp;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
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
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>"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/payment-gateways',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "max": "-1",
    "offset": "0"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "max": "-1",
  "offset": "0"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/payment-gateways", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/payment-gateways")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"max\": \"-1\",\r\n    \"offset\": \"0\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/payment-gateways", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""max"": ""-1"",
" + "\n" +
@"    ""offset"": ""0""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

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"}

Working with Products

In the context of WebCommander, “products” encompass the goods or services offered for sale on a website. This section outlines how you can effectively interact with product data in the WebCommander platform. To streamline product-related tasks, a set of APIs is provided for your use. Below is a list of product-related operations that you can perform using WebCommander’s APIs:

Get Product List

Retrieve the list of all products available. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/products?max=-1&offset=0' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/products?max=-1&offset=0',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/products?max=-1&offset=0", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/products?max=-1&offset=0")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/products?max=-1&offset=0", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

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

Response

{
    "status": "success",
    "total": 106,
    "max": -1,
    "offset": 0,
    "products": [
        {
            "category": null,
            "calculatedRestrictPurchaseFor": "none",
            "codeToProtect": "",
            "isAvailableOnWeekdays": false,
            "restrictPurchaseExceptCustomerGroups": [],
            "relatedProducts": [],
            "soldOutLabel": null,
            "videos": [],
            "isActive": true,
            "lowStockLevel": 0,
            "shippingProfile": null,
            "spec": null,
            "calculatedRestrictPriceExceptCustomers": [],
            "productCondition": "new",
            "availableFromDate": null,
            "restrictPriceFor": "none",
            "metaTags": [],
            "globalTradeItemNumber": null,
            "model": null,
            "productFile": null,
            "id": 239,
            "isFeatured": false,
            "sku": "PRODUCT-9911C0FB075D",
            "multipleOfOrderQuantity": 1,
            "supplierIds": [],
            "basePrice": 500.0,
            "height": 0.0,
            "images": [
                {
                    "thumbnail": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002f150-default.png",
                    "url": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002fdefault.png"
                }
            ],
            "created": "2023-05-16T06:33:31",
            "availableStock": 0,
            "weight": 0.0,
            "hidePrice": false,
            "isParentInTrash": false,
            "version": null,
            "calculatedRestrictPriceExceptCustomerGroups": [],
            "availableToCustomers": [],
            "availableToCustomerGroups": [],
            "name": "Bicycle123",
            "isSoldOut": false,
            "availableToDate": null,
            "minOrderQuantity": 1,
            "isMultipleOrderQuantity": false,
            "isVirtual": false,
            "idx": 1,
            "onSaleAmountType": "flat",
            "updated": "2023-05-16T06:33:31",
            "isRestricted": false,
            "maxOrderQuantity": null,
            "categories": [],
            "expectToPayPrice": 0.0,
            "restrictPurchaseExceptCustomers": [],
            "isAvailable": true,
            "isAvailableOnDateRange": false,
            "calculatedRestrictPurchaseExceptCustomers": [],
            "description": "description",
            "isInTrash": false,
            "isInventoryEnabled": false,
            "customSku": null,
            "heading": "Insert&nbsp;an&nbsp;A.",
            "salePrice": 0.0,
            "restrictPriceExceptCustomerGroups": [],
            "length": 0.0,
            "costPrice": 0.0,
            "isNew": false,
            "calculatedRestrictPriceFor": "none",
            "isCombinationPriceFixed": true,
            "url": "bicycle123",
            "customType": null,
            "availabilityDays": [],
            "disableGooglePageTracking": false,
            "createdBy": {
                "isInTrash": false,
                "password": "21232f297a57a5a743894a0e4a801fc3",
                "isFrontEndEditorOnly": false,
                "roles": [
                    1
                ],
                "fullName": "WebCommander&nbsp;Administrator",
                "isMatured": true,
                "id": 1,
                "isActive": true,
                "isAPIAccessOnly": false,
                "uuid": "0EEF3E2B-3A93-4B77-BD80-3459A5950720",
                "email": "testingsalt-03\u0040yopmail.com"
            },
            "availableFor": "everyone",
            "taxProfile": null,
            "restrictPurchaseFor": "none",
            "width": 0.0,
            "isCombined": false,
            "featuredLabel": null,
            "isExpectToPay": false,
            "customTypes": [],
            "calculatedRestrictPurchaseExceptCustomerGroups": [],
            "productExtInfo": {
                "actualBasePrice": 454.55,
                "isOnSale": false,
                "basePrice": 454.55,
                "salePrice": 0.0,
                "previousPriceToDisplay": null,
                "expectToPayPriceWithTax": 500.0045454546,
                "actualPriceToDisplay": 500.0,
                "tax": 45.45,
                "taxMessage": null,
                "minOrderQuantity": 1,
                "maxOrderQuantity": null
            }
        }
    ]
}

Create Product

Responsible for creating a new product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/create-product' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "name": "T-Shirt1",
    "sku": "PRODUCT-E607CEF8B5F01",
    "isCombined": "false",
    "heading": "Insert an Additional heading for your product page.",
    "productType": "physical",
    "isAvailable": "true",
    "availableFor": "everyone",
    "isRestricted": "false",
    "isCodeProtected": "false",
    "basePrice": 100,
    "costPrice": 50,
    "active": "true",
    "summary": "Put a short one or two line of your product to briefly explain what it is about.",
    "description": "<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.</i></p>"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/create-product',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "name": "T-Shirt1",
    "sku": "PRODUCT-E607CEF8B5F01",
    "isCombined": "false",
    "heading": "Insert an Additional heading for your product page.",
    "productType": "physical",
    "isAvailable": "true",
    "availableFor": "everyone",
    "isRestricted": "false",
    "isCodeProtected": "false",
    "basePrice": 100,
    "costPrice": 50,
    "active": "true",
    "summary": "Put a short one or two line of your product to briefly explain what it is about.",
    "description": "<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.</i></p>"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "name": "T-Shirt1",
  "sku": "PRODUCT-E607CEF8B5F01",
  "isCombined": "false",
  "heading": "Insert an Additional heading for your product page.",
  "productType": "physical",
  "isAvailable": "true",
  "availableFor": "everyone",
  "isRestricted": "false",
  "isCodeProtected": "false",
  "basePrice": 100,
  "costPrice": 50,
  "active": "true",
  "summary": "Put a short one or two line of your product to briefly explain what it is about.",
  "description": "<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.</i></p>"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/create-product", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/create-product")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"name\": \"T-Shirt1\",\r\n    \"sku\": \"PRODUCT-E607CEF8B5F01\",\r\n    \"isCombined\": \"false\",\r\n    \"heading\": \"Insert an Additional heading for your product page.\",\r\n    \"productType\": \"physical\",\r\n    \"isAvailable\": \"true\",\r\n    \"availableFor\": \"everyone\",\r\n    \"isRestricted\": \"false\",\r\n    \"isCodeProtected\": \"false\",\r\n    \"basePrice\": 100,\r\n    \"costPrice\": 50,\r\n    \"active\": \"true\",\r\n    \"summary\": \"Put a short one or two line of your product to briefly explain what it is about.\",\r\n    \"description\": \"<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.</i></p>\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/create-product", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""name"": ""T-Shirt1"",
" + "\n" +
@"    ""sku"": ""PRODUCT-E607CEF8B5F01"",
" + "\n" +
@"    ""isCombined"": ""false"",
" + "\n" +
@"    ""heading"": ""Insert an Additional heading for your product page."",
" + "\n" +
@"    ""productType"": ""physical"",
" + "\n" +
@"    ""isAvailable"": ""true"",
" + "\n" +
@"    ""availableFor"": ""everyone"",
" + "\n" +
@"    ""isRestricted"": ""false"",
" + "\n" +
@"    ""isCodeProtected"": ""false"",
" + "\n" +
@"    ""basePrice"": 100,
" + "\n" +
@"    ""costPrice"": 50,
" + "\n" +
@"    ""active"": ""true"",
" + "\n" +
@"    ""summary"": ""Put a short one or two line of your product to briefly explain what it is about."",
" + "\n" +
@"    ""description"": ""<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.</i></p>""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

{
    "name": "T-Shirt1",
    "sku": "PRODUCT-E607CEF8B5F01",
    "isCombined": "false",
    "heading": "Insert an Additional heading for your product page.",
    "productType": "physical",
    "isAvailable": "true",
    "availableFor": "everyone",
    "isRestricted": "false",
    "isCodeProtected": "false",
    "basePrice": 100,
    "costPrice": 50,
    "active": "true",
    "summary": "Put a short one or two line of your product to briefly explain what it is about.",
    "description": "<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.</i></p>"
}

Response

{
    "status": "success",
    "product": {
        "category": null,
        "calculatedRestrictPurchaseFor": "none",
        "codeToProtect": null,
        "isAvailableOnWeekdays": false,
        "restrictPurchaseExceptCustomerGroups": [],
        "relatedProducts": [],
        "soldOutLabel": null,
        "videos": [],
        "isActive": true,
        "lowStockLevel": 0,
        "shippingProfile": null,
        "spec": null,
        "calculatedRestrictPriceExceptCustomers": [],
        "productCondition": "new",
        "availableFromDate": null,
        "restrictPriceFor": "none",
        "metaTags": [],
        "globalTradeItemNumber": null,
        "model": null,
        "productFile": null,
        "id": 241,
        "isFeatured": false,
        "sku": "PRODUCT-E607CEF8B5F01",
        "multipleOfOrderQuantity": 1,
        "supplierIds": [],
        "basePrice": 100.0,
        "height": 0.0,
        "images": [
            {
                "thumbnail": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002f150-default.png",
                "url": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002fdefault.png"
            }
        ],
        "created": "2023-05-18T10:37:49",
        "availableStock": 0,
        "weight": 0.0,
        "hidePrice": false,
        "isParentInTrash": false,
        "version": null,
        "calculatedRestrictPriceExceptCustomerGroups": [],
        "availableToCustomers": [],
        "availableToCustomerGroups": [],
        "name": "T-Shirt1",
        "isSoldOut": false,
        "availableToDate": null,
        "minOrderQuantity": 1,
        "isMultipleOrderQuantity": false,
        "isVirtual": false,
        "idx": 1,
        "onSaleAmountType": "flat",
        "updated": "2023-05-18T10:37:49",
        "isRestricted": false,
        "maxOrderQuantity": null,
        "categories": [],
        "expectToPayPrice": 0.0,
        "restrictPurchaseExceptCustomers": [],
        "isAvailable": true,
        "isAvailableOnDateRange": false,
        "calculatedRestrictPurchaseExceptCustomers": [],
        "description": "description",
        "title": null,
        "isCallForPriceEnabled": false,
        "isCombinationQuantityFlexible": false,
        "isDisposable": false,
        "restrictPriceExceptCustomers": [],
        "isCodeProtected": false,
        "isOnSale": false,
        "seoConfigs": [],
        "availableDays": [],
        "productType": "physical",
        "summary": "Put",
        "isInTrash": false,
        "isInventoryEnabled": false,
        "customSku": null,
        "heading": "Insert an Add.",
        "salePrice": 0.0,
        "restrictPriceExceptCustomerGroups": [],
        "length": 0.0,
        "costPrice": 50.0,
        "isNew": false,
        "calculatedRestrictPriceFor": "none",
        "isCombinationPriceFixed": true,
        "url": "t-shirt1",
        "customType": null,
        "availabilityDays": null,
        "disableGooglePageTracking": false,
        "createdBy": null,
        "availableFor": "everyone",
        "taxProfile": null,
        "restrictPurchaseFor": "none",
        "width": 0.0,
        "isCombined": false,
        "featuredLabel": null,
        "isExpectToPay": false,
        "customTypes": [],
        "calculatedRestrictPurchaseExceptCustomerGroups": [],
        "productExtInfo": {
            "actualBasePrice": 90.91,
            "isOnSale": false,
            "basePrice": 90.91,
            "salePrice": 0.0,
            "previousPriceToDisplay": null,
            "expectToPayPriceWithTax": 100.0009090909,
            "actualPriceToDisplay": 100.0,
            "tax": 9.09,
            "taxMessage": null,
            "minOrderQuantity": 1,
            "maxOrderQuantity": null
        }
    }
}

Get Single Product

Retrieve the details of a specific product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/product?id=56789345' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/product?id=56789345',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/product?id=56789345", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/product?id=56789345")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/product?id=56789345", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

"id": 56789345

Response

{
    "status": "success",
    "product": {
        "category": null,
        "calculatedRestrictPurchaseFor": "none",
        "codeToProtect": null,
        "isAvailableOnWeekdays": false,
        "restrictPurchaseExceptCustomerGroups": [],
        "relatedProducts": [],
        "soldOutLabel": null,
        "videos": [],
        "isActive": true,
        "lowStockLevel": 0,
        "shippingProfile": null,
        "spec": null,
        "calculatedRestrictPriceExceptCustomers": [],
        "productCondition": "new",
        "availableFromDate": null,
        "restrictPriceFor": "none",
        "metaTags": [],
        "globalTradeItemNumber": null,
        "model": null,
        "productFile": null,
        "id": 241,
        "isFeatured": false,
        "sku": "PRODUCT-E607CEF8B5F01",
        "multipleOfOrderQuantity": 1,
        "supplierIds": [],
        "basePrice": 100.0,
        "height": 0.0,
        "images": [
            {
                "thumbnail": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002f150-default.png",
                "url": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002fdefault.png"
            }
        ],
        "created": "2023-05-18T10:37:49",
        "availableStock": 0,
        "weight": 0.0,
        "hidePrice": false,
        "isParentInTrash": false,
        "version": null,
        "calculatedRestrictPriceExceptCustomerGroups": [],
        "availableToCustomers": [],
        "availableToCustomerGroups": [],
        "name": "T-Shirt1",
        "isSoldOut": false,
        "availableToDate": null,
        "minOrderQuantity": 1,
        "isMultipleOrderQuantity": false,
        "isVirtual": false,
        "idx": 1,
        "onSaleAmountType": "flat",
        "updated": "2023-05-18T10:37:49",
        "isRestricted": false,
        "maxOrderQuantity": null,
        "categories": [],
        "expectToPayPrice": 0.0,
        "restrictPurchaseExceptCustomers": [],
        "isAvailable": true,
        "isAvailableOnDateRange": false,
        "calculatedRestrictPurchaseExceptCustomers": [],
        "description": "description",
        "title": null,
        "isCallForPriceEnabled": false,
        "isCombinationQuantityFlexible": false,
        "isDisposable": false,
        "restrictPriceExceptCustomers": [],
        "isCodeProtected": false,
        "isOnSale": false,
        "seoConfigs": [],
        "availableDays": [],
        "productType": "physical",
        "summary": "Put",
        "isInTrash": false,
        "isInventoryEnabled": false,
        "customSku": null,
        "heading": "Insert&nbsp;an&nbsp;Add.",
        "salePrice": 0.0,
        "restrictPriceExceptCustomerGroups": [],
        "length": 0.0,
        "costPrice": 50.0,
        "isNew": false,
        "calculatedRestrictPriceFor": "none",
        "isCombinationPriceFixed": true,
        "url": "t-shirt1",
        "customType": null,
        "availabilityDays": null,
        "disableGooglePageTracking": false,
        "createdBy": null,
        "availableFor": "everyone",
        "taxProfile": null,
        "restrictPurchaseFor": "none",
        "width": 0.0,
        "isCombined": false,
        "featuredLabel": null,
        "isExpectToPay": false,
        "customTypes": [],
        "calculatedRestrictPurchaseExceptCustomerGroups": [],
        "productExtInfo": {
            "actualBasePrice": 90.91,
            "isOnSale": false,
            "basePrice": 90.91,
            "salePrice": 0.0,
            "previousPriceToDisplay": null,
            "expectToPayPriceWithTax": 100.0009090909,
            "actualPriceToDisplay": 100.0,
            "tax": 9.09,
            "taxMessage": null,
            "minOrderQuantity": 1,
            "maxOrderQuantity": null
        }
    }
}

Update Product

Responsible for updating an existing product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/update-product' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": 241,
    "fields": {
        "name": "Cycle",
        "description": "Amazing cycle"
    }
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/update-product',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": 241,
    "fields": {
        "name": "Cycle",
        "description": "Amazing cycle"
    }
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": 241,
  "fields": {
    "name": "Cycle",
    "description": "Amazing cycle"
  }
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/update-product", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/update-product")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": 241,\r\n    \"fields\": {\r\n        \"name\": \"Cycle\",\r\n        \"description\": \"Amazing cycle\"\r\n    }\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/update-product", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": 241,
" + "\n" +
@"    ""fields"": {
" + "\n" +
@"        ""name"": ""Cycle"",
" + "\n" +
@"        ""description"": ""Amazing cycle""
" + "\n" +
@"    }
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

// You may update any field from product object. Check response for all available fields.
{
    "id": 241,
    "fields": {
        "name": "Cycle",
        "description": "Amazing cycle"
    }
}

Response

{
    "status": "success",
    "product": {
        "category": null,
        "calculatedRestrictPurchaseFor": "none",
        "codeToProtect": null,
        "restrictPurchaseExceptCustomerGroups": [],
        "relatedProducts": [],
        "soldOutLabel": null,
        "videos": [],
        "isActive": true,
        "lowStockLevel": 0,
        "shippingProfile": null,
        "spec": null,
        "calculatedRestrictPriceExceptCustomers": [],
        "productCondition": "new",
        "availableFromDate": null,
        "restrictPriceFor": "none",
        "metaTags": [],
        "globalTradeItemNumber": null,
        "model": null,
        "productFile": null,
        "id": 241,
        "isFeatured": false,
        "sku": "PRODUCT-E607CEF8B5F01",
        "multipleOfOrderQuantity": 1,
        "supplierIds": [],
        "basePrice": 100.0,
        "height": 0.0,
        "images": [
            {
                "thumbnail": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002f150-default.png",
                "url": "http:\u002f\u002flocalhost:1301\u002fresources\u002f00000000\u002fproduct\u002fdefault\u002fdefault.png"
            }
        ],
        "created": "2023-05-18T10:37:49",
        "availableStock": 0,
        "weight": 0.0,
        "hidePrice": false,
        "isParentInTrash": false,
        "version": null,
        "calculatedRestrictPriceExceptCustomerGroups": [],
        "availableToCustomers": [],
        "availableToCustomerGroups": [],
        "name": "T-Shirt1",
        "isSoldOut": false,
        "availableToDate": null,
        "minOrderQuantity": 1,
        "isMultipleOrderQuantity": false,
        "isVirtual": false,
        "idx": 1,
        "onSaleAmountType": "flat",
        "updated": "2023-05-18T10:37:49",
        "isRestricted": false,
        "maxOrderQuantity": null,
        "categories": [],
        "expectToPayPrice": 0.0,
        "restrictPurchaseExceptCustomers": [],
        "isAvailable": true,
        "isAvailableOnDateRange": false,
        "calculatedRestrictPurchaseExceptCustomers": [],
        "description": "description",
        "title": null,
        "isCallForPriceEnabled": false,
        "isCombinationQuantityFlexible": false,
        "isDisposable": false,
        "restrictPriceExceptCustomers": [],
        "isCodeProtected": false,
        "isOnSale": false,
        "seoConfigs": [],
        "availableDays": [],
        "productType": "physical",
        "summary": "Put",
        "isInTrash": false,
        "isInventoryEnabled": false,
        "customSku": null,
        "heading": "Insert&nbsp;an&nbsp;Add.",
        "salePrice": 0.0,
        "restrictPriceExceptCustomerGroups": [],
        "length": 0.0,
        "costPrice": 50.0,
        "isNew": false,
        "calculatedRestrictPriceFor": "none",
        "isCombinationPriceFixed": true,
        "url": "t-shirt1",
        "customType": null,
        "availabilityDays": null,
        "disableGooglePageTracking": false,
        "createdBy": null,
        "availableFor": "everyone",
        "taxProfile": null,
        "restrictPurchaseFor": "none",
        "width": 0.0,
        "isCombined": false,
        "featuredLabel": null,
        "isExpectToPay": false,
        "customTypes": [],
        "calculatedRestrictPurchaseExceptCustomerGroups": [],
        "productExtInfo": {
            "actualBasePrice": 90.91,
            "isOnSale": false,
            "basePrice": 90.91,
            "salePrice": 0.0,
            "previousPriceToDisplay": null,
            "expectToPayPriceWithTax": 100.0009090909,
            "actualPriceToDisplay": 100.0,
            "tax": 9.09,
            "taxMessage": null,
            "minOrderQuantity": 1,
            "maxOrderQuantity": null
        }
    }
}

Delete Product

Responsible for deleting a product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location --request DELETE 'http://yourapp.com/external/app/access/delete-product' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": 241
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/delete-product',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_POSTFIELDS =>'{
    "id": 241
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": 241
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("DELETE", "/external/app/access/delete-product", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.delete("http://yourapp.com/external/app/access/delete-product")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": 241\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/delete-product", Method.Delete);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": 241
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/delete-product
  • Request type: DELETE

Request Parameter

{
    "id": 241
}

Product Stock Update

Responsible for updating the quantity of a product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/product-stock-update' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "status": "success",
    "message": "Inventory has been updated successfully"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/product-stock-update',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "status": "success",
    "message": "Inventory has been updated successfully"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "status": "success",
  "message": "Inventory has been updated successfully"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/product-stock-update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/product-stock-update")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"status\": \"success\",\r\n    \"message\": \"Inventory has been updated successfully\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/product-stock-update", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""status"": ""success"",
" + "\n" +
@"    ""message"": ""Inventory has been updated successfully""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

{
    "productId": 54678784645,
    "changeQuantity": 12,
    "note": "10 extra products added for EID"
}

Response

{
    "status": "success",
    "message": "Inventory has been updated successfully"
}

Product Price Update

Responsible for updating the price-related configuration of a product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/product-price-update' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "id": 5456423432,
    "isCallForPriceEnabled": "true",
    "isExpectToPay": "true",
    "expectToPayPrice": 50,
    "isSoldOut": "false",
    "soldOutLabel": "sold out",
    "isOnSale": "true",
    "salePrice": 12,
    "isInventoryEnabled": "false",
    "lowStockLevel": 0
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/product-price-update',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": 123,
    "isCallForPriceEnabled": "true",
    "isExpectToPay": "true",
    "expectToPayPrice": 50,
    "isSoldOut": "false",
    "soldOutLabel": "sold out",
    "isOnSale": "true",
    "salePrice": 12,
    "isInventoryEnabled": "false",
    "lowStockLevel": 0
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "id": 123,
  "isCallForPriceEnabled": "true",
  "isExpectToPay": "true",
  "expectToPayPrice": 50,
  "isSoldOut": "false",
  "soldOutLabel": "sold out",
  "isOnSale": "true",
  "salePrice": 12,
  "isInventoryEnabled": "false",
  "lowStockLevel": 0
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/product-price-update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/product-price-update")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"id\": 123,\r\n    \"isCallForPriceEnabled\": \"true\",\r\n    \"isExpectToPay\": \"true\",\r\n    \"expectToPayPrice\": 50,\r\n    \"isSoldOut\": \"false\",\r\n    \"soldOutLabel\": \"sold out\",\r\n    \"isOnSale\": \"true\",\r\n    \"salePrice\": 12,\r\n    \"isInventoryEnabled\": \"false\",\r\n    \"lowStockLevel\": 0\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/product-price-update", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""id"": 123,
" + "\n" +
@"    ""isCallForPriceEnabled"": ""true"",
" + "\n" +
@"    ""isExpectToPay"": ""true"",
" + "\n" +
@"    ""expectToPayPrice"": 50,
" + "\n" +
@"    ""isSoldOut"": ""false"",
" + "\n" +
@"    ""soldOutLabel"": ""sold out"",
" + "\n" +
@"    ""isOnSale"": ""true"",
" + "\n" +
@"    ""salePrice"": 12,
" + "\n" +
@"    ""isInventoryEnabled"": ""false"",
" + "\n" +
@"    ""lowStockLevel"": 0
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

{
    "id": 123,
    "isCallForPriceEnabled": "true",
    "isExpectToPay": "true",
    "expectToPayPrice": 50,
    "isSoldOut": "false",
    "soldOutLabel": "sold out",
    "isOnSale": "true",
    "salePrice": 12,
    "isInventoryEnabled": "false",
    "lowStockLevel": 0
}

Response

{"status": "success", "message": "Price has been updated successfully"}

Product Image Add

Responsible for adding an image to a product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/product-image-add' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "productId": 10,
    "images": [
        "base64data1",
        "base64data2"
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/product-image-add',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "productId": 10,
    "images": [
        "base64data1",
        "base64data2"
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "productId": 10,
  "images": [
    "base64data1",
    "base64data2"
  ]
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/product-image-add", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/product-image-add")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"productId\": 10,\r\n    \"images\": [\r\n        \"base64data1\",\r\n        \"base64data2\"\r\n    ]\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/product-image-add", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""productId"": 10,
" + "\n" +
@"    ""images"": [
" + "\n" +
@"        ""base64data1"",
" + "\n" +
@"        ""base64data2""
" + "\n" +
@"    ]
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

{
    "productId": 10,
    "images": [
        "base64data1",
        "base64data2"
    ]
}

Response

{"status": "success", "message": "Product image properties has been saved successfully"}

Product Image Delete

Responsible for deleting an image of a product. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location --request DELETE 'http://yourapp.com/external/app/access/product-image-delete' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "imageId": [
        22,
        23
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/product-image-delete',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_POSTFIELDS =>'{
    "imageId": [
        22,
        23
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "imageId": [
    22,
    23
  ]
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("DELETE", "/external/app/access/product-image-delete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.delete("http://yourapp.com/external/app/access/product-image-delete")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"imageId\": [\r\n        22,\r\n        23\r\n    ]\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/product-image-delete", Method.Delete);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""imageId"": [
" + "\n" +
@"        22,
" + "\n" +
@"        23
" + "\n" +
@"    ]
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/product-image-delete
  • Request type: DELETE

Request Parameter

{
    "imageId": [
        22,
        23
    ]
}

Working with Users/Customers

In the context of WebCommander, a “customer” refers to an individual who purchases goods or services from the platform. This section explains how you can interact with customer data using webhooks and APIs specifically designed for customer-related operations. Below is a list of customer-related operations that you can perform using WebCommander’s APIs:

Get Customer Data

To retrieve customer data using a token, you can use the following API endpoint.

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-details-with-token?token=0e35317d7dfcabad2a4b9e06d8df168c' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-details-with-token?token=0e35317d7dfcabad2a4b9e06d8df168c',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/customer-details-with-token?token=0e35317d7dfcabad2a4b9e06d8df168c", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/customer-details-with-token?token=0e35317d7dfcabad2a4b9e06d8df168c")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-details-with-token?token=0e35317d7dfcabad2a4b9e06d8df168c", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-details-with-token?token=0e35317d7dfcabad2a4b9e06d8df168c
  • Request Type: GET

Get Customer List

Retrieve a comprehensive list of all customers or users. An example is provided below:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customers?max=-1&offset=0&type=active' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'uuid: F8A3-A88E-C6EF-B1CB'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customers?max=-1&offset=0&type=active',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'uuid: F8A3-A88E-C6EF-B1CB'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'uuid': 'F8A3-A88E-C6EF-B1CB'
}
conn.request("GET", "/external/app/access/customers?max=-1&offset=0&type=active", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/customers?max=-1&offset=0&type=active")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customers?max=-1&offset=0&type=active", Method.Get);
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

Request URL: http://yourapp.com/external/app/access/customers

Request type: GET

Request Parameters

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

Response

{
    "customers": [
        {
            "countReferralCodeUsed": 0,
            "cloudConfig": null,
            "lastName": "Islam",
            "parent": null,
            "backgroundImage": null,
            "companyName": null,
            "billingAddresses": [
                {
                    "lastName": "Doe",
                    "country": 236,
                    "city": "Dhaka",
                    "companyName": null,
                    "mobile": null,
                    "firstName": "John",
                    "phone": null,
                    "addressLine1": "Dhaka",
                    "addressLine2": "",
                    "postCode": null,
                    "id": 4191,
                    "state": 10,
                    "fax": null,
                    "email": "john@0040gmail.com"
                }
            ],
            "source": null,
            "shippingProfile": null,
            "activeBillingAddress": {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4191,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            },
            "abnBranch": null,
            "referralCode": null,
            "id": 310,
            "howDoYouKnow": null,
            "activeShippingAddress": {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4192,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            },
            "address": {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4190,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            },
            "sex": "Male",
            "isCompany": false,
            "userName": "john@40gmail.com",
            "abn": null,
            "version": null,
            "storeCredit": 0.0,
            "firstName": "John",
            "baseUrl": "\u002f",
            "usedReferralCode": null,
            "displayId": 102,
            "defaultTaxCode": null,
            "status": "A",
            "shippingAddresses": [
                {
                    "lastName": "Doe",
                    "country": 236,
                    "city": "Dhaka",
                    "companyName": null,
                    "mobile": null,
                    "firstName": "John",
                    "phone": null,
                    "addressLine1": "Dhaka",
                    "addressLine2": "",
                    "postCode": null,
                    "id": 4192,
                    "state": 10,
                    "fax": null,
                    "email": "johndoe0040gmail.com"
                }
            ]
        }
    ]
}

Create a Customer

Responsible for customer creation. An example is provided below:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-create' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "John",
    "lastName": "Doe",
    "password":"123213",
    "abnBranch": null,
    "source": "",
    "country": 236,
    "city": "Dhaka",
    "companyName": null,
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "john@0040gmail.com",
    "sex": "Male",
    "isCompany": false,
    "userName": "john@0040gmail.com",
    "abn": null
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-create',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "firstName": "John",
    "lastName": "Doe",
    "password":"123213",
    "abnBranch": null,
    "source": "",
    "country": 236,
    "city": "Dhaka",
    "companyName": null,
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "john@0040gmail.com",
    "sex": "Male",
    "isCompany": false,
    "userName": "john@0040gmail.com",
    "abn": null
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "firstName": "John",
  "lastName": "Doe",
  "password": "123213",
  "abnBranch": None,
  "source": "",
  "country": 236,
  "city": "Dhaka",
  "companyName": None,
  "mobile": None,
  "phone": None,
  "addressLine1": "Dhaka",
  "addressLine2": "",
  "postCode": None,
  "state": 10,
  "fax": None,
  "email": "john@0040gmail.com",
  "sex": "Male",
  "isCompany": False,
  "userName": "john@0040gmail.com",
  "abn": None
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/customer-create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/customer-create")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"password\":\"123213\",\r\n    \"abnBranch\": null,\r\n    \"source\": \"\",\r\n    \"country\": 236,\r\n    \"city\": \"Dhaka\",\r\n    \"companyName\": null,\r\n    \"mobile\": null,\r\n    \"phone\": null,\r\n    \"addressLine1\": \"Dhaka\",\r\n    \"addressLine2\": \"\",\r\n    \"postCode\": null,\r\n    \"state\": 10,\r\n    \"fax\": null,\r\n    \"email\": \"john@0040gmail.com\",\r\n    \"sex\": \"Male\",\r\n    \"isCompany\": false,\r\n    \"userName\": \"john@0040gmail.com\",\r\n    \"abn\": null\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-create", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""firstName"": ""John"",
" + "\n" +
@"    ""lastName"": ""Doe"",
" + "\n" +
@"    ""password"":""123213"",
" + "\n" +
@"    ""abnBranch"": null,
" + "\n" +
@"    ""source"": """",
" + "\n" +
@"    ""country"": 236,
" + "\n" +
@"    ""city"": ""Dhaka"",
" + "\n" +
@"    ""companyName"": null,
" + "\n" +
@"    ""mobile"": null,
" + "\n" +
@"    ""phone"": null,
" + "\n" +
@"    ""addressLine1"": ""Dhaka"",
" + "\n" +
@"    ""addressLine2"": """",
" + "\n" +
@"    ""postCode"": null,
" + "\n" +
@"    ""state"": 10,
" + "\n" +
@"    ""fax"": null,
" + "\n" +
@"    ""email"": ""john@0040gmail.com"",
" + "\n" +
@"    ""sex"": ""Male"",
" + "\n" +
@"    ""isCompany"": false,
" + "\n" +
@"    ""userName"": ""john@0040gmail.com"",
" + "\n" +
@"    ""abn"": null
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-create
  • Request Type: POST

Request Parameters

{
    "firstName": "John",
    "lastName": "Doe",
    "password":"123213",
    "abnBranch": null,
    "source": "",
    "country": 236,
    "city": "Dhaka",
    "companyName": null,
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "john@0040gmail.com",
    "sex": "Male",
    "isCompany": false,
    "userName": "john@0040gmail.com",
    "abn": null
}

Response

{
    "customers": {
        "countReferralCodeUsed": 0,
        "cloudConfig": null,
        "lastName": "Doe",
        "parent": null,
        "backgroundImage": null,
        "companyName": null,
        "billingAddresses": [
            {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4191,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            }
        ],
        "source": null,
        "shippingProfile": null,
        "activeBillingAddress": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4191,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "abnBranch": null,
        "referralCode": null,
        "id": 310,
        "howDoYouKnow": null,
        "activeShippingAddress": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4192,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "address": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4190,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "sex": "Male",
        "isCompany": false,
        "userName": "john@0040gmail.com",
        "abn": null,
        "version": null,
        "storeCredit": 0.0,
        "firstName": "John",
        "baseUrl": "\u002f",
        "usedReferralCode": null,
        "displayId": 102,
        "defaultTaxCode": null,
        "status": "A",
        "shippingAddresses": [
            {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4192,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            }
        ]
    }
}

Customer Delete

Responsible for customer deletion. An example is provided below:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location --request DELETE 'http://yourapp.com/external/app/access/customer-delete' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{"customerId": 229956}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-delete',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_POSTFIELDS =>'{"customerId": 229956}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "customerId": 229956
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("DELETE", "/external/app/access/customer-delete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.delete("http://yourapp.com/external/app/access/customer-delete")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\"customerId\": 229956}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-delete", Method.Delete);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{""customerId"": 229956}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-delete
  • Request type: DELETE

Request Parameter

"email":"abc@gmail.com"

or

"customerId": 123

Customer Update

Responsible for customer data updates. An example is provided below:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-update' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "john@0040gmail.com",
    "sex": "Male"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-update',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "john@0040gmail.com",
    "sex": "Male"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "firstName": "John",
  "lastName": "Doe",
  "status": "active",
  "country": 236,
  "city": "Dhaka",
  "mobile": None,
  "phone": None,
  "addressLine1": "Dhaka",
  "addressLine2": "",
  "postCode": None,
  "state": 10,
  "fax": None,
  "email": "john@0040gmail.com",
  "sex": "Male"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/customer-update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/customer-update")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"status\": \"active\",\r\n    \"country\": 236,\r\n    \"city\": \"Dhaka\",\r\n    \"mobile\": null,\r\n    \"phone\": null,\r\n    \"addressLine1\": \"Dhaka\",\r\n    \"addressLine2\": \"\",\r\n    \"postCode\": null,\r\n    \"state\": 10,\r\n    \"fax\": null,\r\n    \"email\": \"john@0040gmail.com\",\r\n    \"sex\": \"Male\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-update", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""firstName"": ""John"",
" + "\n" +
@"    ""lastName"": ""Doe"",
" + "\n" +
@"    ""status"": ""active"",
" + "\n" +
@"    ""country"": 236,
" + "\n" +
@"    ""city"": ""Dhaka"",
" + "\n" +
@"    ""mobile"": null,
" + "\n" +
@"    ""phone"": null,
" + "\n" +
@"    ""addressLine1"": ""Dhaka"",
" + "\n" +
@"    ""addressLine2"": """",
" + "\n" +
@"    ""postCode"": null,
" + "\n" +
@"    ""state"": 10,
" + "\n" +
@"    ""fax"": null,
" + "\n" +
@"    ""email"": ""john@0040gmail.com"",
" + "\n" +
@"    ""sex"": ""Male""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "john@0040gmail.com",
    "sex": "Male"
}

Response

{
    "customers": {
        "countReferralCodeUsed": 0,
        "cloudConfig": null,
        "lastName": "Doe",
        "parent": null,
        "backgroundImage": null,
        "companyName": null,
        "billingAddresses": [
            {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4191,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            }
        ],
        "source": null,
        "shippingProfile": null,
        "activeBillingAddress": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4191,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "abnBranch": null,
        "referralCode": null,
        "id": 310,
        "howDoYouKnow": null,
        "activeShippingAddress": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4192,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "address": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4190,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "sex": "Male",
        "isCompany": false,
        "userName": "john@0040gmail.com",
        "abn": null,
        "version": null,
        "storeCredit": 0.0,
        "firstName": "John",
        "baseUrl": "\u002f",
        "usedReferralCode": null,
        "displayId": 102,
        "defaultTaxCode": null,
        "status": "A",
        "shippingAddresses": [
            {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4192,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            }
        ]
    }
}

Customer Payments

List of payments initiated by a customer. An example is provided below:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-payments?customerId=2299563456' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-payments?customerId=2299563456',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/customer-payments?customerId=2299563456", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/customer-payments?customerId=2299563456")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-payments?customerId=2299563456", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

Request URL: http://yourapp.com/external/app/access/customer-payments

Request type: GET

Request Parameter

"email": "john@gmail.com"

or

"customerId": "667785555"

Response

{
    "payments": [
        [
            {
                "surcharge": 0.0,
                "amount": 110.0,
                "trackInfo": null,
                "payingDate": "2023-03-21T11:09:25",
                "gatewayName": null,
                "created": "2023-03-21T11:09:25",
                "version": null,
                "payerInfo": null,
                "gatewayCode": "CRD",
                "gatewayResponse": null,
                "id": 1586,
                "updated": "2023-03-21T11:09:25",
                "refundId": null,
                "order": {
                    "orderComment": [],
                    "payments": [
                        1586,
                        1591
                    ],
                    "lastReminderTime": "2023-03-21T11:09:24",
                    "totalSurcharge": 0.0,
                    "orderStatus": "pending",
                    "orderChannel": null,
                    "billing": 3866,
                    "shippingStatus": "awaiting",
                    "shippingTax": 0.0,
                    "shipping": 3871,
                    "discountOnOrder": 0.0,
                    "additionalInfo": null,
                    "customerId": 296,
                    "handlingCost": 0.0,
                    "discountOnShippingTax": 0.0,
                    "id": 1446,
                    "paymentStatus": "paid",
                    "handlingTax": 0.0,
                    "orderNo": 457,
                    "shippingCost": 0.0,
                    "discountOnOrderTotalTax": 0.0,
                    "ipAddress": "127.0.0.1",
                    "deliveryType": "shipping",
                    "shipments": [],
                    "customerName": "Dimitrius&nbsp;Sideris",
                    "reminderCount": 0,
                    "createdBy": null,
                    "actualTax": 10.0,
                    "discountOnShipping": 0.0,
                    "items": [
                        2611,
                        2616,
                        2621
                    ]
                },
                "status": "awaiting"
            }
        ]
    ]
}

Get Single Customer

Retrieve the details of a single customer based on their ID or email. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer?customerId=667785555' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer?customerId=667785555',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/customer?customerId=667785555", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/customer?customerId=667785555")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/customer?customerId=667785555")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();

Request Details

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

Request Parameter

"email": "john@gmail.com"

or

"customerId": "667785555"

Response

{
    "customers": {
        "countReferralCodeUsed": 0,
        "cloudConfig": null,
        "lastName": "Doe",
        "parent": null,
        "backgroundImage": null,
        "companyName": null,
        "billingAddresses": [
            {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4191,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            }
        ],
        "source": null,
        "shippingProfile": null,
        "activeBillingAddress": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4191,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "abnBranch": null,
        "referralCode": null,
        "id": 310,
        "howDoYouKnow": null,
        "activeShippingAddress": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4192,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "address": {
            "lastName": "Doe",
            "country": 236,
            "city": "Dhaka",
            "companyName": null,
            "mobile": null,
            "firstName": "John",
            "phone": null,
            "addressLine1": "Dhaka",
            "addressLine2": "",
            "postCode": null,
            "id": 4190,
            "state": 10,
            "fax": null,
            "email": "john@0040gmail.com"
        },
        "sex": "Male",
        "isCompany": false,
        "userName": "john@0040gmail.com",
        "abn": null,
        "version": null,
        "storeCredit": 0.0,
        "firstName": "John",
        "baseUrl": "\u002f",
        "usedReferralCode": null,
        "displayId": 102,
        "defaultTaxCode": null,
        "status": "A",
        "shippingAddresses": [
            {
                "lastName": "Doe",
                "country": 236,
                "city": "Dhaka",
                "companyName": null,
                "mobile": null,
                "firstName": "John",
                "phone": null,
                "addressLine1": "Dhaka",
                "addressLine2": "",
                "postCode": null,
                "id": 4192,
                "state": 10,
                "fax": null,
                "email": "john@0040gmail.com"
            }
        ]
    }
}

Customer Orders

Retrieve the list of all orders placed by a customer. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-orders?customerId=667785555' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-orders?customerId=667785555',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("yourapp.com")
payload = ''
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb'
}
conn.request("GET", "/external/app/access/customer-orders?customerId=667785555", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("http://yourapp.com/external/app/access/customer-orders?customerId=667785555")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-orders?customerId=667785555", Method.Get);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

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

Request Parameter

"email": "john@gmail.com"

or

"customerId": "667785555"

Response

{
    "orders": [
        {
            "orderComment": [],
            "payments": [
                {
                    "surcharge": 0.0,
                    "amount": 110.0,
                    "trackInfo": null,
                    "payerInfo": null,
                    "gatewayCode": "CRD",
                    "payingDate": "2023-03-21T11:09:25",
                    "gatewayName": null,
                    "gatewayResponse": null,
                    "id": 1586,
                    "refundId": null,
                    "order": 1446,
                    "status": "awaiting"
                },
                {
                    "surcharge": 0.0,
                    "amount": 110.0,
                    "trackInfo": "684084",
                    "payerInfo": "Customer#92",
                    "gatewayCode": "CRD",
                    "payingDate": "2023-03-21T11:10:47",
                    "gatewayName": "securePay",
                    "gatewayResponse": "Code 08 - Approved",
                    "id": 1591,
                    "refundId": "ca644b7c-00457-559",
                    "order": 1446,
                    "status": "success"
                }
            ],
            "lastReminderTime": "2023-03-21T11: 09: 24",
            "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": 3866,
                "state": 72,
                "fax": "fax",
                "email": "3866\u0040noemail.loc"
            },
            "shippingStatus": "awaiting",
            "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": 3871,
                "state": 72,
                "fax": "fax",
                "email": "3871\u0040noemail.loc"
            },
            "discountOnOrder": 0.0,
            "additionalInfo": null,
            "customerId": 296,
            "handlingCost": 0.0,
            "discountOnShippingTax": 0.0,
            "id": 1446,
            "paymentStatus": "paid",
            "handlingTax": 0.0,
            "orderNo": 457,
            "shippingCost": 0.0,
            "discountOnOrderTotalTax": 0.0,
            "created": "2023-03-21T11: 09: 24",
            "ipAddress": "127.0.0.1",
            "deliveryType": "shipping",
            "version": null,
            "shipments": [],
            "customerName": "Dimitrius Sideris",
            "reminderCount": 0,
            "createdBy": null,
            "actualTax": 10.0,
            "discountOnShipping": 0.0,
            "updated": "2023-03-21T11: 11: 31",
            "items": [
                {
                    "actualDiscount": 0.0,
                    "quantity": 1,
                    "productId": 38,
                    "productVariationId": 305,
                    "actualPrice": 45.0,
                    "shippingClassName": null,
                    "taxDiscount": 0.0,
                    "isTaxable": true,
                    "discount": 0.0,
                    "tax": 4.09,
                    "storeId": null,
                    "shippingClassId": null,
                    "productName": "ON FIELD SHORTS - AWAY",
                    "price": 40.91,
                    "variations": [
                        "Size: M - Adult Medium"
                    ],
                    "id": 2611,
                    "productType": "product",
                    "isShippable": true,
                    "order": 1446
                },
                {
                    "actualDiscount": 0.0,
                    "quantity": 1,
                    "productId": 32,
                    "productVariationId": 308,
                    "actualPrice": 45.0,
                    "shippingClassName": null,
                    "taxDiscount": 0.0,
                    "isTaxable": true,
                    "discount": 0.0,
                    "tax": 4.09,
                    "storeId": null,
                    "shippingClassId": null,
                    "productName": "ON FIELD SHORTS - HOME",
                    "price": 40.91,
                    "variations": [
                        "Size: M - Adult Medium"
                    ],
                    "id": 2616,
                    "productType": "product",
                    "isShippable": true,
                    "order": 1446
                },
                {
                    "actualDiscount": 0.0,
                    "quantity": 1,
                    "productId": 101,
                    "productVariationId": 487,
                    "actualPrice": 20.0,
                    "shippingClassName": null,
                    "taxDiscount": 0.0,
                    "isTaxable": true,
                    "discount": 0.0,
                    "tax": 1.82,
                    "storeId": null,
                    "shippingClassId": null,
                    "productName": "ON FIELD SOCKS - TRADITIONAL LENGTH",
                    "price": 18.18,
                    "variations": [
                        "Size: 8 - 11"
                    ],
                    "id": 2621,
                    "productType": "product",
                    "isShippable": true,
                    "order": 1446
                }
            ]
        }
    ]

Update Customer Billing Address

Responsible for updating the billing addresses of a customer. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/update-customer-billing-address' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "AU",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "name@gmail.com"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/update-customer-billing-address',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "AU",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "name@gmail.com"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "firstName": "John",
  "lastName": "Doe",
  "status": "active",
  "country": 236,
  "city": "Dhaka",
  "mobile": None,
  "phone": None,
  "addressLine1": "Dhaka",
  "addressLine2": "AU",
  "postCode": None,
  "state": 10,
  "fax": None,
  "email": "name@gmail.com"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/update-customer-billing-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/update-customer-billing-address")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"status\": \"active\",\r\n    \"country\": 236,\r\n    \"city\": \"Dhaka\",\r\n    \"mobile\": null,\r\n    \"phone\": null,\r\n    \"addressLine1\": \"Dhaka\",\r\n    \"addressLine2\": \"AU\",\r\n    \"postCode\": null,\r\n    \"state\": 10,\r\n    \"fax\": null,\r\n    \"email\": \"name@gmail.com\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/update-customer-billing-address", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""firstName"": ""John"",
" + "\n" +
@"    ""lastName"": ""Doe"",
" + "\n" +
@"    ""status"": ""active"",
" + "\n" +
@"    ""country"": 236,
" + "\n" +
@"    ""city"": ""Dhaka"",
" + "\n" +
@"    ""mobile"": null,
" + "\n" +
@"    ""phone"": null,
" + "\n" +
@"    ""addressLine1"": ""Dhaka"",
" + "\n" +
@"    ""addressLine2"": ""AU"",
" + "\n" +
@"    ""postCode"": null,
" + "\n" +
@"    ""state"": 10,
" + "\n" +
@"    ""fax"": null,
" + "\n" +
@"    ""email"": ""name@gmail.com""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/update-customer-billing-address
  • Request type: POS

Request Parameter

{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "AU",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "name@gmail.com"
}

Response

{
    "address": {
        "firstName": "John",
        "lastName": "Doe",
        "status": "active",
        "country": 236,
        "city": "Dhaka",
        "mobile": null,
        "phone": null,
        "addressLine1": "Dhaka",
        "addressLine2": "AU",
        "postCode": null,
        "state": 10,
        "fax": null,
        "email": "name@gmail.com"
    }
}

Update Customer Shipping Address

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/update-customer-shipping-address' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "AU",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "name@gmail.com"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/update-customer-shipping-address',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "AU",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "name@gmail.com"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "firstName": "John",
  "lastName": "Doe",
  "status": "active",
  "country": 236,
  "city": "Dhaka",
  "mobile": None,
  "phone": None,
  "addressLine1": "Dhaka",
  "addressLine2": "AU",
  "postCode": None,
  "state": 10,
  "fax": None,
  "email": "name@gmail.com"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/update-customer-shipping-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/update-customer-shipping-address")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"status\": \"active\",\r\n    \"country\": 236,\r\n    \"city\": \"Dhaka\",\r\n    \"mobile\": null,\r\n    \"phone\": null,\r\n    \"addressLine1\": \"Dhaka\",\r\n    \"addressLine2\": \"AU\",\r\n    \"postCode\": null,\r\n    \"state\": 10,\r\n    \"fax\": null,\r\n    \"email\": \"name@gmail.com\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/update-customer-shipping-address", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""firstName"": ""John"",
" + "\n" +
@"    ""lastName"": ""Doe"",
" + "\n" +
@"    ""status"": ""active"",
" + "\n" +
@"    ""country"": 236,
" + "\n" +
@"    ""city"": ""Dhaka"",
" + "\n" +
@"    ""mobile"": null,
" + "\n" +
@"    ""phone"": null,
" + "\n" +
@"    ""addressLine1"": ""Dhaka"",
" + "\n" +
@"    ""addressLine2"": ""AU"",
" + "\n" +
@"    ""postCode"": null,
" + "\n" +
@"    ""state"": 10,
" + "\n" +
@"    ""fax"": null,
" + "\n" +
@"    ""email"": ""name@gmail.com""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/update-customer-shipping-address
  • Request type: POST

Request Parameter

{
    "firstName": "John",
    "lastName": "Doe",
    "status": "active",
    "country": 236,
    "city": "Dhaka",
    "mobile": null,
    "phone": null,
    "addressLine1": "Dhaka",
    "addressLine2": "AU",
    "postCode": null,
    "state": 10,
    "fax": null,
    "email": "name@gmail.com"
}

Response

{
    "address": {
        "firstName": "John",
        "lastName": "Doe",
        "status": "active",
        "country": 236,
        "city": "Dhaka",
        "mobile": null,
        "phone": null,
        "addressLine1": "Dhaka",
        "addressLine2": "AU",
        "postCode": null,
        "state": 10,
        "fax": null,
        "email": "name@gmail.com"
    }
}

Update Customer Store Credit

Responsible for updating a customer’s store credit. Here is an example:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/update-customer-store-credit' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "name@gmail.com",
    "add": "true",
    "deltaAmount": 50,
    "adjustNote": "50 dollar added"
}'
curl --location 'http://yourapp.com/external/app/access/update-customer-store-credit' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "name@gmail.com",
    "add": "true",
    "deltaAmount": 50,
    "adjustNote": "50 dollar added"
}'
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "email": "name@gmail.com",
  "add": "true",
  "deltaAmount": 50,
  "adjustNote": "50 dollar added"
})
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/update-customer-store-credit", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/update-customer-store-credit")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"email\": \"name@gmail.com\",\r\n    \"add\": \"true\",\r\n    \"deltaAmount\": 50,\r\n    \"adjustNote\": \"50 dollar added\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/update-customer-store-credit", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""email"": ""name@gmail.com"",
" + "\n" +
@"    ""add"": ""true"",
" + "\n" +
@"    ""deltaAmount"": 50,
" + "\n" +
@"    ""adjustNote"": ""50 dollar added""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/update-customer-store-credit
  • Request type: POST

Request Parameter

{
    "email": "name@gmail.com",
    "add": "true",
    "deltaAmount": 50,
    "adjustNote": "50 dollar added"
}

Response

{
    "status": "true",
    "isMaxCreditExceed": "false",
    "storeCredit": 100
}

Working with Login & Logout

In this section, we will explain how the WebCommander login and logout API works and how to secure a source URL from a plugin that is rendered through an iframe inside the WebCommander site. We’ll provide code examples in various programming languages to help you understand the implementation.

User Login

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-login' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "clientId": "abf9ab31352bfc92f5a6a5b891782b9f", 
    "email": "tanviruls8@gmail.com", 
    "password": "123456"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-login',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "clientId": "abf9ab31352bfc92f5a6a5b891782b9f", 
    "email": "tanviruls8@gmail.com", 
    "password": "123456"
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = "{\r\n&nbsp;&nbsp;&nbsp; \"clientId\": \"abf9ab31352bfc92f5a6a5b891782b9f\", \n&nbsp;&nbsp;&nbsp; \"email\": \"tanviruls8@gmail.com\", \n&nbsp;&nbsp;&nbsp; \"password\": \"123456\"\r\n}"
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/customer-login", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/customer-login")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"clientId\": \"abf9ab31352bfc92f5a6a5b891782b9f\", \n    \"email\": \"tanviruls8@gmail.com\", \n    \"password\": \"123456\"\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-login", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""clientId"": ""abf9ab31352bfc92f5a6a5b891782b9f"", " + "\n" +
@"    ""email"": ""tanviruls8@gmail.com"", " + "\n" +
@"    ""password"": ""123456""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-login
  • Request Type: POST

Request Parameter

{
    "clientId": "abf9ab31352bfc92f5a6a5b891782b9f", // you will find the clientID on plugin installation. Check /install request parameter in project setup section.
    "email": "tanviruls8@gmail.com", // accepted parameters - email or userName
    "password": "4465234235667"
}

Response

{
    "status": "success",
    "access_token": "abf9ab31352bfc92f5a6a5b891782b9f", // To secure a plugin source URL that is used to render through iframe in WebCommander.
    "refresh_token": "fda44530af4b9b11d48d263fe499c146" // 
}

Example

As an example, suppose you want to register a plugin widget where your sourceUrl is https://stage-mnb.clubeez.com/signup-widget?uuid=BB1EF6AA-A8E0-4D0F and configurationUrl is https://stage-mnb.clubeez.com/configuration-signup-widget?uuid=BB1EF6AA-A8E0-4D0F. WebCommander will send an additional parameter token (e.g., https://stage-mnb.clubeez.com/my-subscriptions?token=BB1EF6AA-A8E0-4D0F-86B5-751EAD851890) when they are rendered through an iframe in WebCommander. The plugin developer can check the token to validate the login and identify who is responsible for rendering their internal page.

    "widgets": [
        {
            "widgetName": "mining", //unique internal identifier of widget(no space and special character and number allowed) 
            "widgetLabel": "Mining Signup", //widget display name  
            "widgetTitle": "Mining Signup Widget", //widget title will show on hover Widget 
            "widgetLogo": "https://stagingmining.mywebcommander.com/template/9738593f/images/package-pricing-icon.svg", // The URL of the logo of this widget
            "sourceUrl": "https://stage-mnb.clubeez.com/my-subscriptions?uuid=BB1EF6AA-A8E0-4D0F", // widget render source url 
            "configurationUrl": "https://stage-mnb.clubeez.com/configuration-signup-widget?uuid=BB1EF6AA-A8E0-4D0F", //widget configuration endpoint url 
        }
    ]

User Logout

The plugin developer can send a request to log out a user where WebCommander will clear the token generated for that user.

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'http://yourapp.com/external/app/access/customer-logout' \
--header 'uuid: F8A3-A88E-C6EF-B1CB' \
--header 'accessToken: 11b4ec017714ef095b8e115545467fcb' \
--header 'Content-Type: application/json' \
--data '{
    "token": "abf9ab31352bfc92f5a6a5b891782b9f" 
}
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://yourapp.com/external/app/access/customer-logout',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "token": "abf9ab31352bfc92f5a6a5b891782b9f" 
}',
  CURLOPT_HTTPHEADER => array(
    'uuid: F8A3-A88E-C6EF-B1CB',
    'accessToken: 11b4ec017714ef095b8e115545467fcb',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = "{\r\n    \"token\": \"abf9ab31352bfc92f5a6a5b891782b9f\" \n}"
headers = {
  'uuid': 'F8A3-A88E-C6EF-B1CB',
  'accessToken': '11b4ec017714ef095b8e115545467fcb',
  'Content-Type': 'application/json'
}
conn.request("POST", "/external/app/access/customer-logout", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://yourapp.com/external/app/access/customer-logout")
  .header("uuid", "F8A3-A88E-C6EF-B1CB")
  .header("accessToken", "11b4ec017714ef095b8e115545467fcb")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"token\": \"abf9ab31352bfc92f5a6a5b891782b9f\" \n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("http://yourapp.com/external/app/access/customer-logout", Method.Post);
request.AddHeader("uuid", "F8A3-A88E-C6EF-B1CB");
request.AddHeader("accessToken", "11b4ec017714ef095b8e115545467fcb");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""token"": ""abf9ab31352bfc92f5a6a5b891782b9f"" " + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Request Details

  • Request URL: http://yourapp.com/external/app/access/customer-logout
  • Request type: POST

Request Parameter

{
    "token": "abf9ab31352bfc92f5a6a5b891782b9f" // The access token you recieved during login
}

Response

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

ScriptTag

What are ScriptTags?

ScriptTags are a powerful feature in WebCommander that allows you to inject custom JavaScript code into the head of WebCommander pages. This provides you with full control over the page’s content and functionality. When your plugin is installed, WebCommander registers the JavaScript files you provide as ScriptTags, enabling you to customise the behaviour of your online store.

How ScriptTags Work

  1. Installation: When you install your plugin, WebCommander registers the JavaScript files you provide as ScriptTags.
  2. Head Injection: These JavaScript files are injected into the <head> section of WebCommander pages, where they can manipulate the DOM (Document Object Model) and perform various customizations.
  3. Custom Functionalities: You can use ScriptTags to add custom functionalities to your WebCommander store. For example, you can enhance the shopping cart experience, track user interactions, or customize the appearance of specific pages.

Example Response

Here’s an example response from the /install endpoint that demonstrates how to use ScriptTags:

{
  "webhooks": [
    {
      "sourceUrl": "https://yourapp.com/api/v1/cart/added-to-cart", // The url WebCommander will call when firing this hook. Might be an endpoint of your own app.
      "eventName": "added-to-cart", // A webhook event name. Check Webhook list to find details
      "renderScope": "", // Required for script tags
      "accessType": "webhook" // A data access type to define which way your plugin collecting data.    
    }
  ],
  "scriptTags": [
    {
      "sourceUrl": "https://yourapp.com/assets/js/script-tag.js", // The JS file URL webcommander will render in the head where you can manipulate its dom/data through JS code. Also possible to customize css.  
      "eventName": "DummyName",
      "renderScope": "All", //Required for script tags. Values: "All/Specific page url"
      "accessType": "scriptTag" // A data access type to define which way your plugin collecting or manipulating data.
    }
  ]
}

In this example, a ScriptTag is registered with the following details:

  • sourceUrl: The URL of the JavaScript file to be injected.
  • eventName: Not required for ScriptTags.
  • renderScope: Specifies where the ScriptTag should be applied (e.g., “All” pages).
  • accessType: Defines how your plugin collects or manipulates data (in this case, “scriptTag”).

You can add any desired functionality to the ScriptTags. Nevertheless, please note that if the plugin is uninstalled, all the ScriptTags will be removed from WebCommander.

List of Webhooks

added-to-cart

{
    "hook_name": "added-to-cart",
    "hook_Data": {
        "email": "johndoe@gmail.com",
        "eventId": "3938532C-5622-40C1-9178-F6F53FBD7048",
        "firstName": "John",
        "lastName": "Doe",
        "totalCartValue": 104.5,
        "totalCartTax": 9.5,
        "items": [
            {
                "productID": "8097",
                "sKU": "PRODUCT-800EAEB67DAD",
                "productName": "Blouse",
                "productType": "physical",
                "productCatagory": null,
                "quantity": 1,
                "itemPrice": 27.5,
                "rowTotal": 27.5,
                "variations": null,
                "productURL": "https://cm27.mywebcommander.com/product/blouse",
                "imageURL": "https://cm27.mywebcommander.com/https://template5.mywebcommander.com/resources/4351c511/product/product-1/blouse.jpg/blouse.jpg"
            }
        ]
    }
}

Let’s break down the JSON payload:

  • email: This field contains the email address of the user who added items to their cart. It identifies the user associated with this action.
  • eventId: This is a unique identifier for the event. It’s often used to ensure the event is processed only once and can be used for tracking and auditing purposes.
  • totalCartValue: This field represents the total value of the items in the user’s cart. In this case, it’s set to 76, indicating that the total cost of the items in the cart is $76.
  • items: This is an array of items that were added to the cart. Each item is represented as an object with various properties:
    • productID: A unique identifier for the product being added to the cart.
    • sKU: The SKU (Stock Keeping Unit) for the product. It’s a unique identifier for tracking inventory.
    • productName: The name or title of the product.
    • quantity: The quantity of this specific product added to the cart.
    • itemPrice: The price per unit of the product.
    • rowTotal: The total cost for this specific product (quantity * itemPrice).
    • productURL: A URL pointing to the product’s page on the website. This can be useful for providing a link to the product details.
    • imageURL: A URL pointing to an image of the product. This can be used to display the product image in the cart or during checkout.

This JSON payload provides detailed information about the items added to a user’s cart, allowing the receiving system to update the cart, calculate totals, and potentially trigger further actions like sending a confirmation email or updating inventory.

abandoned-cart-created

{
    "email": "johndoe@mailinator.com",
    "eventId": "A45AB3CC-34D8-4ABC-B314-2FD63534FD9E",
    "add_to_cart_url": "https://instance6.webcommander.com/abandonedCart/abandonedAddToCartByUrl?key=A45AB3CC-34D8-4ABC-B314-2FD63534FD9E",
    "items": [
        {
            "productName": "SSD test",
            "itemPrice": "$250.0",
            "prductUrl": "https://instance6.webcommander.com/product/printer-test",
            "imageUrl": "https://instance6.webcommander.com/resources/00000000/product/product-86/150-s-l500.jpg"
        }
    ]
}

When a cart is abandoned by a customer (after 30 minutes of inactivity), a webhook can trigger an action. The body parameters associated with this event are explained below:

  • email: This field contains the email address of the user who triggered the event. It identifies the user associated with this action.
  • eventId: This is a unique identifier for the event. It’s often used for tracking and auditing purposes. In this case, it’s “A45AB3CC-34D8-4ABC-B314-2FD63534FD9E.”
  • add_to_cart_url: This URL appears to be a specific URL that allows you to add an item to the cart for the user associated with this event. It includes a key or token in the URL (“key=A45AB3CC-34D8-4ABC-B314-2FD63534FD9E”) that likely helps identify and authenticate the user or session.
  • items: This is an array containing information about the item that was added to the cart. In this case, there’s one item:
    • productName: The name or title of the product. It’s “SSD test” in this example.
    • itemPrice: The price of the item. It’s “$250.0” in this example.
    • productUrl: A URL pointing to the product’s page on the website. This URL is https://instance6.webcommander.com/product/printer-test.
    • imageUrl: A URL pointing to an image of the product. It can be used to display the product image in the cart or during checkout. This URL is https://instance6.webcommander.com/resources/00000000/product/product-86/150-s-l500.jpg.

Your webhook endpoint can utilize these parameters to trigger the desired action or process the data according to your application’s requirements when a cart is abandoned by a customer.

abandoned-cart-converted

{
    "email": "johndoe@mailinator.com"
    "eventId": "A45AB3CC-34D8-4ABC-B314-2FD63534FD9E", // uuid of the abandoned the cart. We use them to recover the cart in future.
    "add_to_cart_url": "https:\u002f\u002finstance6.webcommander.com\u002fabandonedCart\u002fabandonedAddToCartByUrl?key=A45AB3CC-34D8-4ABC-B314-2FD63534FD9E",
    "convertedQty": 3,
    "convertedValue": 231 //$ total
}

When an abandoned cart becomes active again (when a customer or guest interacts with it), a webhook can trigger an action. The body parameters associated with this event are explained below:

  • email: This field contains the email address of the user associated with this event. In this case, it’s johndoe@mailinator.com.
  • eventId: This is a unique identifier (UUID) for the event, and it’s used to identify an abandoned cart. The comment indicates that it’s used for future cart recovery. In this case, it’s “A45AB3CC-34D8-4ABC-B314-2FD63534FD9E.”
  • add_to_cart_url: This URL appears to be a special link that could be used to recover or restore the abandoned cart associated with this event. It includes a key or token (“key=A45AB3CC-34D8-4ABC-B314-2FD63534FD9E”) that helps identify the specific cart.
  • convertedQty: This field represents the number of items that were converted or purchased by the user. In this example, the user converted 3 items.
  • convertedValue: This field indicates the total value of the converted items, likely in dollars. In this case, it’s $231.

customer-create

{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@0040gmail.com",
    "mobile": 014785214,
    "phone": 8956231,
    "addressLine1": "Dhaka",
    "addressLine2": "",
    "postCode": 1230,
    "state": "Dhaka",
    "fax": null,
    "country": "Bangladesh",
    "city": "Dhaka",
    "companyName": null
}

When a customer is created, a webhook can trigger an action. The body parameters associated with this event are explained below:

  • firstName: John’s first name is “John.”
  • lastName: His last name is “Doe.”
  • email: John’s email address is “john@0040gmail.com.”
  • mobile: The mobile number provided appears to be “014785214.”
  • phone: There’s another phone number provided as “8956231.”
  • addressLine1: John’s address is listed as “Dhaka,” which is typically the city or locality.
  • addressLine2: This field is empty, suggesting that John did not provide a second line of address details.
  • postCode: The postal code or ZIP code for John’s address is “1230.”
  • state: The state or region is also listed as “Dhaka.”
  • fax: The fax field is set to null, indicating that no fax number is provided.
  • country: John is located in the country “Bangladesh.”
  • city: His city is “Dhaka,” which corresponds with the state and address details.

By utilizing these parameters in your webhook endpoint, you can trigger the desired action or process the data according to your application’s requirements when a customer is created. This can include sending a welcome email, updating customer records, or performing any other necessary operations.

customer-billing-address-update

{
    "first_name": "First",
    "last_name": "Test",
    "address_line1": "au,bd",
    "address_line2": "012948594594",
    "post_code": "3211",
    "phone": "+7723232323",
    "mobile": "+7723232323",
    "fax": "+77232323",
    "email": "test4320942@mailinator.com",
    "state": "melboune",
    "city": "+7723232323"
}

When the customer billing address is updated, the webhook will trigger an action.

customer-shipping-address-update

{
    "first_name": "First",
    "last_name": "Test",
    "address_line1": "au,bd",
    "address_line2": "012948594594",
    "post_code": "3211",
    "phone": "+7723232323",
    "mobile": "+7723232323",
    "fax": "+77232323",
    "email": "test4320942@mailinator.com",
    "state": "melboune",
    "city": "+7723232323"
}

When a customer’s shipping address is updated, the webhook will trigger an action.

customer-store-credit-update

{
    "store_credit": 100, // Credit amount
    "email": "johndoe@gmail.com", // Customer email address
    "mobile": "019888333388",
    "first_name": "John",
    "last_name": "Doe",
}

Triggers an action when the store credit of a customer is updated.

order-create

{
    "OrderDetails": {
        "email": "johndoe@mailinator.com", // Billing email address
        "eventId": "WC000000-3", 
        "orderId": "WC000000-3",
        "value": 7.7, //Grand total price of this order
        "items": [
            {
                "ProductID": "8",
                "SKU": "PRODUCT-08E28E395DD5",
                "ProductName": "Orange Juice",
                "Quantity": 1,
                "ItemPrice": 13.2,
                "RowTotal": 13.2,
                "ProductURL": "http://localhost:1301/product/orange-juice",
                "ImageURL": "http://localhost:8080resources/00000000/product/product-8//images(1).jpg"
            }
        ]
    },
    "BillingAddress": {
        "FirstName": "John",
        "LastName": "Doe",
        "Company": null,
        "Address1": "melbourne",
        "Address2": null,
        "City": "Carrum Downs",
        "Country": "Australia",
        "CountryCode": "AU",
        "Zip": "3201",
        "Phone": ""
    },
    "ShippingAddress": {
        "FirstName": "test",
        "LastName": "",
        "Company": null,
        "Address1": "melbourne",
        "Address2": null,
        "City": "Carrum Downs",
        "Country": "Australia",
        "CountryCode": "AU",
        "Zip": "3201",
        "Phone": ""
    }
}

When an order is created, a webhook can trigger an action. The body parameters associated with this event are explained below:

  • email: The billing email address associated with the order.
  • eventId: A unique identifier for the order event.
  • orderId: A unique identifier for the order itself.
  • items: This parameter represents an object and contains a list of products that were added to this order.
  • billingAddress: This parameter represents an object and contains the customer’s billing address information.
  • shippingAddress: This parameter represents an object and contains the customer’s shipping address information.

By utilizing these parameters in your webhook endpoint, you can trigger the desired action or process the data according to your application’s requirements when an order is created. This can include updating inventory, sending order confirmation emails, generating invoices, or performing any other necessary operations related to order management.

order-status-change

{
   "orderId": "WCP00000-4353",
   "order_status": "completed",
}

Triggers an action when the status of an order changes. Types of available status – payment awaiting, shipment awaiting, cancelled, completed

order-complete

{
   "orderId": "WCP00000-4353",
   "order_status": "completed",
}

Triggers an action when the shipment of an order is confirmed.

order-payment-success

{
    "orderId": "2550", // Id of the order
    "amount": 500, // Order amount
    "surcharge": 10, // Payment gateway surcharge. Depens on the payment gateway. 
    "trackInfo": "4YS8449025641163E", // Payment tracking info
    "payerInfo": "Customer# 2", // Customers data
    "gatewayCode": "PIS", // Short form of payment gateway
    "gatewayResponse": "Completed", //Response after payment
    "gatewayName": "Secure Pay", // Name of the payment gateway
    "status": "success",
    "payingDate": "2022-04-02 16:19:59"
}

Triggers an action when a payment of an order is successful.

order-payment-failed

{
    "orderId": "2550", // Id of the order
    "amount": 500, // Order amount
    "surcharge": 10, // Payment gateway surcharge. Depens on the payment gateway. 
    "trackInfo": "4YS8449025641163E", // Payment tracking info
    "payerInfo": "Customer# 2", // Customers data
    "gatewayCode": "CRD", // Short form of payment gateway
    "gatewayResponse": "Code 51 - Insufficient Funds", //Response after payment
    "refundId": "ca644b7c-00422-493",
    "gatewayName": "Secure Pay", // Name of the payment gateway
    "status": "failed",
    "payingDate": "2022-04-02 16:19:59"
}

Triggers an action when a payment is failed for an order.

product-create

{
    "id": "wc00012",
    "parent": null,
    "calculatedRestrictPurchaseFor": "none",
    "codeToProtect": "",
    "isAvailableOnWeekdays": false,
    "restrictPurchaseExceptCustomerGroups": [],
    "relatedProducts": [],
    "soldOutLabel": null,
    "calculatedRestrictPriceExceptCustomers": [],
    "productCondition": "new",
    "availableFromDate": null,
    "restrictPriceFor": "none",
    "metaTags": [],
    "globalTradeItemNumber": null,
    "model": null,
    "productFile": null,
    "isFeatured": false,
    "sku": "PRODUCT-9911C0FB075D",
    "multipleOfOrderQuantity": 1,
    "supplierIds": [],
    "basePrice": 500.0,
    "height": 0.0,
    "images": [],
    "availableStock": 0,
    "weight": 0.0,
    "hidePrice": false,
    "isParentInTrash": false,
    "calculatedRestrictPriceExceptCustomerGroups": [],
    "availableToCustomers": [],
    "availableToCustomerGroups": [],
    "name": "Bicycle123",
    "isSoldOut": false,
    "availableToDate": null,
    "minOrderQuantity": 1,
    "isMultipleOrderQuantity": false,
    "isVirtual": false,
    "idx": 1,
    "isAvailable": true,
    "isAvailableOnDateRange": false,
    "calculatedRestrictPurchaseExceptCustomers": [],
    "description": "<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.<\/i><\/p>",
    "title": null,
    "isCallForPriceEnabled": false,
    "isCombinationQuantityFlexible": false,
    "isDisposable": false,
    "restrictPriceExceptCustomers": [],
    "inventoryAdjustments": [],
    "isCodeProtected": false,
    "isOnSale": false,
    "seoConfigs": [],
    "availableDays": [],
    "productType": "physical",
    "summary": "Put a short one or two line of your product to briefly explain what it is about.",
}

Triggers an action when a product is created.

product-update

{
    "id": "wc00012",
    "parent": null,
    "calculatedRestrictPurchaseFor": "none",
    "codeToProtect": "",
    "isAvailableOnWeekdays": false,
    "restrictPurchaseExceptCustomerGroups": [],
    "relatedProducts": [],
    "soldOutLabel": null,
    "calculatedRestrictPriceExceptCustomers": [],
    "productCondition": "new",
    "availableFromDate": null,
    "restrictPriceFor": "none",
    "metaTags": [],
    "globalTradeItemNumber": null,
    "model": null,
    "productFile": null,
    "isFeatured": false,
    "sku": "PRODUCT-9911C0FB075D",
    "multipleOfOrderQuantity": 1,
    "supplierIds": [],
    "basePrice": 500.0,
    "height": 0.0,
    "images": [],
    "availableStock": 0,
    "weight": 0.0,
    "hidePrice": false,
    "isParentInTrash": false,
    "calculatedRestrictPriceExceptCustomerGroups": [],
    "availableToCustomers": [],
    "availableToCustomerGroups": [],
    "name": "Bicycle123",
    "isSoldOut": false,
    "availableToDate": null,
    "minOrderQuantity": 1,
    "isMultipleOrderQuantity": false,
    "isVirtual": false,
    "idx": 1,
    "isAvailable": true,
    "isAvailableOnDateRange": false,
    "calculatedRestrictPurchaseExceptCustomers": [],
    "description": "<p><i>Put a detailed description of your product. You can insert a link, table, image, video or other cool stuff in here.<\/i><\/p>",
    "title": null,
    "isCallForPriceEnabled": false,
    "isCombinationQuantityFlexible": false,
    "isDisposable": false,
    "restrictPriceExceptCustomers": [],
    "inventoryAdjustments": [],
    "isCodeProtected": false,
    "isOnSale": false,
    "seoConfigs": [],
    "availableDays": [],
    "productType": "physical",
    "summary": "Put a short one or two line of your product to briefly explain what it is about.",
}

Triggers an action when a product is updated.

product-stock-update

{
   "id": "WCP00000-4353",
    "available_stock": 10,
}

Triggers an action when stock quantity is updated for a product.

product-delete

{
   "id": "WCP00000-4353", // Id of the product
}

Triggers an action when a product is deleted.

How to Use Webhooks?

/Install

To register webhooks for a site using the /install endpoint in WebCommander, you can provide a list of event names and source URLs. Here’s an example response format:

{
  "webhooks": [
    {
      "sourceUrl": "https://yourapp.com/api/v1/cart/added-to-cart", // The url WebCommander will call when firing this hook. Might be an endpoint of your own app.
      "eventName": "added-to-cart", // A webhook event name. Check Webhook list to find details
      "renderScope": "", // Required for script tags
      "accessType": "webhook" // A data access type to define which way your plugin collecting data.    
    }
  ],
  "scriptTag": [
    {
      "sourceUrl": "https://yourapp.com/assets/js/script-tag.js", // The JS file URL webcommander will render in the head where you can manipulate its dom/data through JS code. Also possible to customize css.  
      "eventName": "", // Not required for Script Tags.
      "renderScope": "All", //Required for script tags. Values: "All/Specific page url"
      "accessType": "scriptTag" // A data access type to define which way your plugin collecting or manipulating data.
    }
  ]
}

added-to-cart

When you register an added-to-cart webhook with WebCommander, it will call your specified endpoint whenever the “added-to-cart” event occurs. Here’s an example of how WebCommander might call your endpoint:

  • cURL
  • PHP – cURL
  • Python – http.client
  • Java – Unirest
  • C# – RestSharp
curl --location 'https://yourapp.com/api/v1/cart/added-to-cart?uuid=F8A3-A88E-C6EF-B1CB' \
--header 'Content-Type: application/json' \
--data-raw '{
    "hook_name": "added-to-cart",
    "hook_Data": {
        "cartItems": [
            {
                "firstName": "second",
                "lastName": "Test",
                "email": "test1fdsfe4@mailinator.com"
            },
            {
                "eventId": "C60B89F8-3A90-4DED-937D-DD62867859E2",
                "value": 27.5,
                "items": [
                    {
                        "ProductID": "15",
                        "SKU": "PRODUCT-7E2BEE252B07",
                        "ProductName": "Vegetarian Pasta",
                        "Quantity": 1,
                        "ItemPrice": 27.5,
                        "RowTotal": 27.5,
                        "ProductURL": "http://localhost:1301/product/vegetarian-pasta-1",
                        "ImageURL": "http://localhost:8080resources/00000000/product/product-15//vegetarian-pasta.png"
                    }
                ]
            }
        ]
    }
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://yourapp.com/api/v1/cart/added-to-cart?uuid=F8A3-A88E-C6EF-B1CB',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "hook_name": "added-to-cart",
    "hook_Data": {
        "cartItems": [
            {
                "firstName": "second",
                "lastName": "Test",
                "email": "test1fdsfe4@mailinator.com"
            },
            {
                "eventId": "C60B89F8-3A90-4DED-937D-DD62867859E2",
                "value": 27.5,
                "items": [
                    {
                        "ProductID": "15",
                        "SKU": "PRODUCT-7E2BEE252B07",
                        "ProductName": "Vegetarian Pasta",
                        "Quantity": 1,
                        "ItemPrice": 27.5,
                        "RowTotal": 27.5,
                        "ProductURL": "http://localhost:1301/product/vegetarian-pasta-1",
                        "ImageURL": "http://localhost:8080resources/00000000/product/product-15//vegetarian-pasta.png"
                    }
                ]
            }
        ]
    }
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("yourapp.com")
payload = json.dumps({
  "hook_name": "added-to-cart",
  "hook_Data": {
    "cartItems": [
      {
        "firstName": "second",
        "lastName": "Test",
        "email": "test1fdsfe4@mailinator.com"
      },
      {
        "eventId": "C60B89F8-3A90-4DED-937D-DD62867859E2",
        "value": 27.5,
        "items": [
          {
            "ProductID": "15",
            "SKU": "PRODUCT-7E2BEE252B07",
            "ProductName": "Vegetarian Pasta",
            "Quantity": 1,
            "ItemPrice": 27.5,
            "RowTotal": 27.5,
            "ProductURL": "http://localhost:1301/product/vegetarian-pasta-1",
            "ImageURL": "http://localhost:8080resources/00000000/product/product-15//vegetarian-pasta.png"
          }
        ]
      }
    ]
  }
})
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/api/v1/cart/added-to-cart?uuid=F8A3-A88E-C6EF-B1CB", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://yourapp.com/api/v1/cart/added-to-cart?uuid=F8A3-A88E-C6EF-B1CB")
  .header("Content-Type", "application/json")
  .body("{\r\n    \"hook_name\": \"added-to-cart\",\r\n    \"hook_Data\": {\r\n        \"cartItems\": [\r\n            {\r\n                \"firstName\": \"second\",\r\n                \"lastName\": \"Test\",\r\n                \"email\": \"test1fdsfe4@mailinator.com\"\r\n            },\r\n            {\r\n                \"eventId\": \"C60B89F8-3A90-4DED-937D-DD62867859E2\",\r\n                \"value\": 27.5,\r\n                \"items\": [\r\n                    {\r\n                        \"ProductID\": \"15\",\r\n                        \"SKU\": \"PRODUCT-7E2BEE252B07\",\r\n                        \"ProductName\": \"Vegetarian Pasta\",\r\n                        \"Quantity\": 1,\r\n                        \"ItemPrice\": 27.5,\r\n                        \"RowTotal\": 27.5,\r\n                        \"ProductURL\": \"http://localhost:1301/product/vegetarian-pasta-1\",\r\n                        \"ImageURL\": \"http://localhost:8080resources/00000000/product/product-15//vegetarian-pasta.png\"\r\n                    }\r\n                ]\r\n            }\r\n        ]\r\n    }\r\n}")
  .asString();
var options = new RestClientOptions("")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("https://yourapp.com/api/v1/cart/added-to-cart?uuid=F8A3-A88E-C6EF-B1CB", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""hook_name"": ""added-to-cart"",
" + "\n" +
@"    ""hook_Data"": {
" + "\n" +
@"        ""cartItems"": [
" + "\n" +
@"            {
" + "\n" +
@"                ""firstName"": ""second"",
" + "\n" +
@"                ""lastName"": ""Test"",
" + "\n" +
@"                ""email"": ""test1fdsfe4@mailinator.com""
" + "\n" +
@"            },
" + "\n" +
@"            {
" + "\n" +
@"                ""eventId"": ""C60B89F8-3A90-4DED-937D-DD62867859E2"",
" + "\n" +
@"                ""value"": 27.5,
" + "\n" +
@"                ""items"": [
" + "\n" +
@"                    {
" + "\n" +
@"                        ""ProductID"": ""15"",
" + "\n" +
@"                        ""SKU"": ""PRODUCT-7E2BEE252B07"",
" + "\n" +
@"                        ""ProductName"": ""Vegetarian Pasta"",
" + "\n" +
@"                        ""Quantity"": 1,
" + "\n" +
@"                        ""ItemPrice"": 27.5,
" + "\n" +
@"                        ""RowTotal"": 27.5,
" + "\n" +
@"                        ""ProductURL"": ""http://localhost:1301/product/vegetarian-pasta-1"",
" + "\n" +
@"                        ""ImageURL"": ""http://localhost:8080resources/00000000/product/product-15//vegetarian-pasta.png""
" + "\n" +
@"                    }
" + "\n" +
@"                ]
" + "\n" +
@"            }
" + "\n" +
@"        ]
" + "\n" +
@"    }
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Hook Parameter

Hook parameters are the set of data that WebCommander will send you with the Hook name and the data related to the fired hook. Example –

{
    "hook_name": "added-to-cart",
    "hook_Data": {
        // Check Webhooks list for sample hook data
    }
}