Getting All Order List

Function: admin_orders_get_list()

Purpose

The admin_orders_get_list() function is used to retrieve a list of all customer orders from the WebCommander system. It provides administrators with access to order summaries, including order IDs, customer details, order status, and timestamps. This function helps streamline order management and provides visibility into all orders placed in the system.

Parameters

This function does not require any input parameters.

Use Case

This function is used by administrators and support staff to retrieve all customer orders recorded in the WebCommander system.

An admin can use it to generate reports or dashboards showing recent order activity, including statuses such as pending, shipped, completed, or canceled. It’s also helpful in customer service scenarios where support teams need to look up a customer’s order history before resolving an issue. Warehouse and fulfillment teams can utilize the retrieved list to verify current order statuses and prioritize processing.

Additionally, during audits or sales reviews, this function provides a quick and accurate way to obtain a full overview of transactions across the platform. By fetching the order list without needing filters or additional input, the function ensures ease of access and efficient backend operations.

def admin_orders_get_list():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = webcommander_sdk.admin_orders.list()
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response returns a structured list of customer orders, each containing key information such as the order ID, associated customer, total amount, order status, and creation date. This allows administrators to view and manage all existing orders from a centralized point.

OrdersListResponseDTO(
    orders=[
        OrderDTO(
            orderId="ORDER_ID",
            orderStatus="ORDER_STATUS",
            subTotal="SUB_TOTAL",
            shippingCost="SHIPPING_COST",
            totalTax="TOTAL_TAX",
            grandTotal="GRAND_TOTAL",
            paid="PAID",
            due="DUE",
            itemsTotal="ITEMS_TOTAL",
            paymentStatus="PAYMENT_STATUS",
            ipAddress="IP_ADDRESS",
            customerSummary=CustomerSummaryDTO(
                firstName="FIRST_NAME",
                lastName="LAST_NAME",
                email="EMAIL",
                addressLine1="ADDRESS_LINE_1",
                addressLine2="ADDRESS_LINE_2",
                city="CITY",
                state=StateDTO(id="STATE_ID", name="STATE_NAME", code="STATE_CODE"),
                country=CountryDTO(id="COUNTRY_ID", name="COUNTRY_NAME", code="COUNTRY_CODE"),
                postCode="POST_CODE",
                phone="PHONE",
                mobile="MOBILE",
                fax="FAX",
                companyName="COMPANY_NAME"
            ),
            orderLineDetails=[
                OrderLineDetailDTO(
                    itemId="ITEM_ID",
                    productName="PRODUCT_NAME",
                    productId="PRODUCT_ID",
                    quantity="QUANTITY",
                    price="PRICE",
                    totalAmount="TOTAL_AMOUNT",
                    tax="TAX",
                    discount="DISCOUNT",
                    isTaxable="IS_TAXABLE",
                    isShippable="IS_SHIPPABLE"
                )
            ]
        )
    ],
    pagination=PaginationDTO(
        records="RECORDS",
        limit="LIMIT",
        offset="OFFSET",
        nextPage="NEXT_PAGE",
        previousPage="PREVIOUS_PAGE"
    )
)

Getting Specific Order Details

Function: admin_orders_get_details()

Purpose

The admin_orders_get_details()function is used to retrieve detailed information about a specific order in the WebCommander system using the order's unique ID. It provides administrators with access to comprehensive order data, including order status, payment information, customer details, items ordered, and timestamps.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the order to retrieve detailed information for.

Use Case

This function is commonly used by administrators who need to view specific order details for operational, support, or analytical purposes.

When a customer contacts support about an issue with a particular order, the admin can use this function to retrieve all associated order data for verification and resolution. In warehouse and logistics workflows, the function provides access to item-level details and shipping information, helping ensure accurate fulfillment.

It also plays a critical role during refund processing or order cancellation, as it gives insight into payment status, item quantities, and fulfillment progress. Additionally, finance and auditing teams may use the detailed view to verify transaction records against financial reports. By offering a structured and accurate data retrieval method, this function simplifies order management tasks and improves response times in customer support.

def admin_orders_get_details():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = "ORDER_ID"
        response = webcommander_sdk.admin_orders.details(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response returns complete details of the specified order, including customer information, items purchased, quantities, total price, payment status, shipping address, and order history. This data enables administrators to handle order-related inquiries, verify fulfillment accuracy, and make informed decisions.

If the order ID does not exist, is invalid, or access is restricted, the API returns an error message. The function captures any exceptions and logs the error information and raw response for debugging purposes, helping administrators quickly resolve issues or confirm the reason for the failure.

OrdersDetailsResponseDTO(
    order=OrderDTO(
        orderId="ORDER_ID",
        orderStatus="ORDER_STATUS",
        subTotal="SUB_TOTAL",
        shippingCost="SHIPPING_COST",
        shippingTax="SHIPPING_TAX",
        handlingCost="HANDLING_COST",
        totalSurcharge="TOTAL_SURCHARGE",
        totalDiscount="TOTAL_DISCOUNT",
        totalTax="TOTAL_TAX",
        grandTotal="GRAND_TOTAL",
        paid="PAID",
        due="DUE",
        itemsTotal="ITEMS_TOTAL",
        paymentStatus="PAYMENT_STATUS",
        ipAddress="IP_ADDRESS",
        customerSummary=CustomerSummaryDTO(
            firstName="FIRST_NAME",
            lastName="LAST_NAME",
            customerGroup="CUSTOMER_GROUP",
            gender="GENDER",
            email="EMAIL",
            addressLine1="ADDRESS_LINE_1",
            addressLine2="ADDRESS_LINE_2",
            city="CITY",
            country=CountryDTO(
                id="COUNTRY_ID",
                name="COUNTRY_NAME",
                code="COUNTRY_CODE"
            ),
            state=StateDTO(
                id="STATE_ID",
                name="STATE_NAME",
                code="STATE_CODE"
            ),
            postCode="POST_CODE",
            phone="PHONE",
            mobile="MOBILE",
            fax="FAX",
            companyName="COMPANY_NAME"
        ),
        orderLineDetails=[
            OrderLineDetailDTO(
                itemId="ITEM_ID_1",
                productName="PRODUCT_NAME_1",
                productId="PRODUCT_ID_1",
                quantity="QUANTITY_1",
                price="PRICE_1",
                totalAmount="TOTAL_AMOUNT_1",
                tax="TAX_1",
                discount="DISCOUNT_1",
                taxDiscount="TAX_DISCOUNT_1",
                isTaxable="IS_TAXABLE_1",
                isShippable="IS_SHIPPABLE_1"
            ),
            OrderLineDetailDTO(
                itemId="ITEM_ID_2",
                productName="PRODUCT_NAME_2",
                productId="PRODUCT_ID_2",
                quantity="QUANTITY_2",
                price="PRICE_2",
                totalAmount="TOTAL_AMOUNT_2",
                tax="TAX_2",
                discount="DISCOUNT_2",
                taxDiscount="TAX_DISCOUNT_2",
                isTaxable="IS_TAXABLE_2",
                isShippable="IS_SHIPPABLE_2"
            ),
            OrderLineDetailDTO(
                itemId="ITEM_ID_3",
                productName="PRODUCT_NAME_3",
                productId="PRODUCT_ID_3",
                quantity="QUANTITY_3",
                price="PRICE_3",
                totalAmount="TOTAL_AMOUNT_3",
                tax="TAX_3",
                discount="DISCOUNT_3",
                taxDiscount="TAX_DISCOUNT_3",
                isTaxable="IS_TAXABLE_3",
                isShippable="IS_SHIPPABLE_3"
            )
        ]
    )
)

Create an Order

Function: admin_create_orders()

Purpose

The admin_create_orders() function allows administrators to manually create a new order in the WebCommander system by specifying customer details, billing and shipping addresses, product lines, shipping cost, discounts, and payment information. It is used for backend order placement and custom workflows where orders are created outside of the frontend checkout process.

Parameters

Parameter
Type
Description
customer
String
The unique identifier of the customer placing the order.
billingAddress
Object
Billing address details including name, email, phone, address lines, city, state, country, and postal code.
shippingAddress
Object
Shipping address details including name, email, phone, address lines, city, state, country, and postal code.
shippingCost
String
Cost associated with shipping the order.
discountCoupon
String
The discount coupon code applied to the order.
lines
List
A list of product line items with product ID, name, quantity, and price.
payment
Object
Payment details including coupon, gift card, store credit, and payment gateway method.

Use Case

This function is used when an order needs to be created manually by an admin — for example, over phone support, in offline retail scenarios, or during migration from another system. It’s useful in B2B workflows or custom integrations where orders are pushed directly to the system through internal logic rather than customer checkout flows.

def admin_create_orders():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = OrderRequestDTO(
            customer="CUSTOMER_ID",
            billingAddress=AddressDTO(
                firstName="BILLING_FIRST_NAME",
                lastName="BILLING_LAST_NAME",
                email="BILLING_EMAIL",
                phone="BILLING_PHONE",
                mobile="BILLING_MOBILE",
                addressLine1="BILLING_LINE1",
                addressLine2="BILLING_LINE2",
                city="BILLING_CITY",
                state="BILLING_STATE",
                country="BILLING_COUNTRY",
                postCode="BILLING_POSTCODE"
            ),
            shippingAddress=AddressDTO(
                firstName="SHIPPING_FIRST_NAME",
                lastName="SHIPPING_LAST_NAME",
                email="SHIPPING_EMAIL",
                phone="SHIPPING_PHONE",
                mobile="SHIPPING_MOBILE",
                addressLine1="SHIPPING_LINE1",
                addressLine2="SHIPPING_LINE2",
                city="SHIPPING_CITY",
                state="SHIPPING_STATE",
                country="SHIPPING_COUNTRY",
                postCode="SHIPPING_POSTCODE"
            ),
            shippingCost="SHIPPING_COST",
            discountCoupon="DISCOUNT_CODE",
            lines=[
                OrderLineDetailDTO(
                    productId="PRODUCT_ID_1",
                    productName="PRODUCT_NAME_1",
                    productOrderQuantity="QUANTITY_1",
                    productPrice="PRICE_1"
                ),
                OrderLineDetailDTO(
                    productId="PRODUCT_ID_2",
                    productName="PRODUCT_NAME_2",
                    productOrderQuantity="QUANTITY_2",
                    productPrice="PRICE_2"
                )
            ],
            payment=PaymentDTO(
                coupon="COUPON_CODE",
                giftCard="GIFTCARD_CODE",
                storeCredit="STORE_CREDIT_AMOUNT",
                paymentGateway="PAYMENT_GATEWAY"
            )
        )

        response = webcommander_sdk.admin_orders.create_orders(request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response returns the newly created order’s details, including order ID, customer reference, and status. If any required information is missing or invalid (e.g., missing address, invalid product ID), the system returns a structured error response indicating what needs to be corrected.

OrderDetailsResponseDTO(
    status="STATUS",
    order=OrderDTO(
        orderId="ORDER_ID",
        orderStatus="ORDER_STATUS",
        subTotal="SUB_TOTAL",
        shippingCost="SHIPPING_COST",
        shippingTax="SHIPPING_TAX",
        handlingCost="HANDLING_COST",
        totalSurcharge="TOTAL_SURCHARGE",
        totalDiscount="TOTAL_DISCOUNT",
        totalTax="TOTAL_TAX",
        grandTotal="GRAND_TOTAL",
        paid="PAID_AMOUNT",
        due="DUE_AMOUNT",
        itemsTotal="ITEMS_TOTAL",
        paymentStatus="PAYMENT_STATUS",
        ipAddress="IP_ADDRESS",
        customerSummary=CustomerSummaryDTO(
            firstName="FIRST_NAME",
            lastName="LAST_NAME",
            customerGroup="CUSTOMER_GROUP",
            gender="GENDER",
            email="EMAIL",
            addressLine1="ADDRESS_LINE_1",
            addressLine2="ADDRESS_LINE_2",
            city="CITY",
            country=CountryDTO(
                id="COUNTRY_ID",
                name="COUNTRY_NAME",
                code="COUNTRY_CODE"
            ),
            state=StateDTO(
                id="STATE_ID",
                name="STATE_NAME",
                code="STATE_CODE"
            ),
            postCode="POST_CODE",
            phone="PHONE",
            mobile="MOBILE",
            fax="FAX",
            companyName="COMPANY_NAME"
        ),
        orderLineDetails=[]
    ),
    paymentData=None
)

Getting Specific Customer Order details

Function: admin_customer_orders_get_details()

Purpose

The admin_customer_orders_get_details() function retrieves the complete list of orders associated with a specific customer based on their unique ID. It provides administrators with visibility into all transactions made by the customer, including order history, status, and order amounts. This function is critical for customer service operations, order management reviews, and customer account auditing. It securely interacts with the WebCommander system through the SDK, with debugging outputs disabled for a cleaner execution flow.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the customer whose orders are to be retrieved.

Use Case

This function is used when administrators or customer service teams need to review the order history of a particular customer. For instance, when a customer raises a query about a past or recent order, support agents can fetch the full list of that customer's orders for quick verification.

It is also valuable during account audits, refunds, complaint investigations, and fraud analysis where complete visibility into a customer's purchasing activity is required. Sales and marketing teams may use it to analyze customer purchasing patterns to develop loyalty programs or personalized offers. The function ensures efficient, real-time retrieval of customer-related order information without the need to manually search through the entire order database.

def admin_customer_orders_get_details():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = 'CUSTOMER_ID'
        response = webcommander_sdk.admin_orders.customer_orders(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

Upon successful execution, the function returns a list of all orders associated with the specified customer ID. Each record typically includes the order ID, status, total amount, created date, and basic item information. This helps administrators gain full insights into the customer’s transaction history for various operational and service purposes.

If the customer ID does not exist or there are issues accessing the order data, an error response is generated with detailed information. The function captures and logs these errors, making troubleshooting easier and allowing for corrective action.

CustomerOrdersDetailsResponseDTO(
    customerId="CUSTOMER_ID",
    orders=[
        OrderDTO(
            orderId="ORDER_ID",
            orderStatus="ORDER_STATUS",
            subTotal="SUB_TOTAL",
            shippingCost="SHIPPING_COST",
            shippingTax="SHIPPING_TAX",
            handlingCost="HANDLING_COST",
            totalSurcharge="TOTAL_SURCHARGE",
            totalDiscount="TOTAL_DISCOUNT",
            totalTax="TOTAL_TAX",
            grandTotal="GRAND_TOTAL",
            paid="PAID",
            due="DUE",
            itemsTotal="ITEMS_TOTAL",
            paymentStatus="PAYMENT_STATUS",
            ipAddress="IP_ADDRESS",
            customerSummary=CustomerSummaryDTO(
                firstName="FIRST_NAME",
                lastName="LAST_NAME",
                customerGroup="CUSTOMER_GROUP",
                gender="GENDER",
                email="EMAIL",
                addressLine1="ADDRESS_LINE1",
                addressLine2="ADDRESS_LINE2",
                city="CITY",
                country=CountryDTO(
                    id="COUNTRY_ID",
                    name="COUNTRY_NAME",
                    code="COUNTRY_CODE"
                ),
                state=StateDTO(
                    id="STATE_ID",
                    name="STATE_NAME",
                    code="STATE_CODE"
                ),
                postCode="POST_CODE",
                phone="PHONE",
                mobile="MOBILE",
                fax="FAX",
                companyName="COMPANY_NAME"
            ),
            orderLineDetails=[
                # If there are order lines, they will be listed here as OrderLineDetailDTO
            ]
        )
    ]
)

Getting Order Count

Function: admin_orders_count_get()

Purpose

The function admin_orders_count_get() used by administrators to obtain a quick overview of the platform’s order volume, which can support reporting, analytics, and operational planning.

Parameters

This function does not require any input parameters.

Use Case

This function is commonly used in administrative dashboards, analytics reports, or system monitoring tools to track the total number of orders placed on the platform.

An operations manager can use it to monitor daily or weekly order trends, while finance teams may rely on it to validate transaction volumes against revenue reports. During high-sales periods like promotions or seasonal events, the function helps gauge system performance by providing real-time order counts.

It can also be used in health checks or backend jobs to ensure that order processing systems are functioning correctly. Since it doesn’t require any parameters or filters, it is ideal for scheduled tasks that track business metrics at a high level without deep data inspection.

def admin_orders_count_get():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = webcommander_sdk.admin_orders.orders_count()
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response returns the total count of orders currently stored in the system. The count reflects all orders across different statuses, such as pending, completed, canceled, or refunded. This number provides insight into the platform’s order volume, helping administrators make informed decisions based on real-time data.

OrdersCountDetailsResponseDTO(count="ORDER_COUNT_NUMBER")

Creating Invoice of an Order and send to a Customer

Function: admin_create_orders_invoice()

Purpose

The admin_create_orders_invoice() function is used to generate an invoice for a specific order in the WebCommander system. It allows administrators to mark an order as paid and attach related notes or payment settings. This is useful for confirming transactions, issuing receipts, or finalizing billing processes in the system. The function utilizes the WebCommander SDK to send a secure API request for invoice creation. Debugging outputs are disabled, making it suitable for production environments where minimal logging is preferred.

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order for which the invoice will be created.
paymentStatus
String
The status of the payment for the order, such as "paid".
notes
String
Optional text to include in the invoice, such as payment confirmation details.
paymentMethodOptions
Dictionary
Optional payment method settings; can be None if not applicable.

Use Case

This function is used when an administrator needs to generate an invoice for a completed order and record its payment status. A business may manually confirm receipt of payment via external methods like bank transfer, mobile wallet, or cash, and then issue an invoice using this function. It is also applicable in systems where invoices are generated post-payment rather than automatically. For accounting and auditing purposes, this function ensures that payment information is properly logged against the corresponding order. Admins can also add notes such as the method of payment or transaction reference numbers. This allows the platform to maintain a complete and accurate financial record for each customer transaction.

def admin_create_orders_invoice(): 
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = OrderInvoiceRequestDTO(
            paymentSettings= OrderInvoicePaymentSettingsDTO(
                paymentMethodOptions=None
            ),
            paymentStatus='paid',
            notes='Your payment is successful via bkash'
        )
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.create_orders_invoice(order_id=order_id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

If the invoice is created successfully, the response includes confirmation details along with invoice data such as  status. The order is updated to reflect the payment status, and the invoice becomes available for customer and administrative reference. In case of errors such as invalid order ID or missing payment status, the API returns an error response with details to help resolve the issue. The function catches and prints these errors to aid in debugging.

OrderInvoiceResponseDTO(status='success')

Creating Order comments

Function: admin_create_orders_comment()

Purpose

The admin_create_orders_comment() function is used to add a comment to a specific order in the WebCommander system. It enables administrators to record internal notes or communicate order-related updates to customers. Comments can be saved internally or sent to the customer, depending on the configuration. This function is helpful for maintaining a history of communications, actions, or observations related to an order. 

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order to which the comment will be added.
saveAndSend
String
A flag indicating whether the comment should also be sent to the customer. Accepts values like "true" or "false".
content
String
The actual text content of the comment being added to the order.

Use Case

This function is used when administrators need to annotate an order with custom comments. These comments can serve as internal records for actions taken, such as contacting a customer or resolving an issue. Alternatively, when the saveAndSend option is enabled, it can be used to inform customers of updates like shipping progress, payment confirmation, or follow-ups. For example, after processing an order, an admin might use this function to note that the items were packed and shipped. It also helps maintain an audit trail of communication and operational decisions tied to each order, supporting both customer service and internal workflow documentation.

def admin_create_orders_comment():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = OrderCommentsDetailsRequestDTO(
            saveAndSend='true',
            content='This is the order comment'
        )
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.create_orders_comment(order_id=order_id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns confirmation that the comment was added to the specified order. If saveAndSend is set to true, the system also triggers a notification or email containing the comment content to the customer. This enhances transparency and helps maintain communication logs. If the request fails, for example due to a missing order ID or empty comment content, an error response is returned with details describing the issue. The function captures and prints these errors for review.

OrderCommentsDetailsResponseDTO(
    comment=OrderCommentDTO(
        id="COMMENT_ID",
        content="COMMENT_CONTENT",
        adminName="ADMIN_NAME",
        isVisibleToCustomer="IS_VISIBLE_TO_CUSTOMER",
        isAdmin="IS_ADMIN",
        created="CREATED_DATE"
    )
)

Getting Specific Order Comments

Function: admin_orders_comment_get_list()

Purpose

The admin_orders_comment_get_list()function retrieves the list of all comments associated with a specific order in the WebCommander system. It enables administrators to review the comment history for an order, including internal notes and customer-facing messages. This function is useful for auditing communication, tracking order-related decisions, and maintaining a full record of updates made by different users. 

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order for which comments are to be retrieved.

Use Case

This function is used in scenarios where administrators or support staff need to view the comment history of an order for reference, verification, or troubleshooting. For example, a support agent handling a customer inquiry can retrieve past comments to check if updates or issues were previously communicated. If multiple users manage an order throughout its lifecycle, the function ensures everyone can access a chronological record of all remarks and interactions. 

def admin_orders_comment_get_list():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.orders_comment_list(order_id=order_id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response includes a list of all comments added to the specified order, along with metadata such as the author of each comment, the content, whether the comment was sent to the customer, and the timestamp. This allows admins to understand the order’s communication history and track how it was handled over time. If the provided order ID is invalid or the order has no comments, the API returns an appropriate message.

OrderCommentsListResponseDTO(
    comments=[
        OrderCommentDTO(
            id="COMMENT_ID_1",
            content="COMMENT_CONTENT_1",
            adminName="ADMIN_NAME_1",
            isVisibleToCustomer="IS_VISIBLE_TO_CUSTOMER_1",
            isAdmin="IS_ADMIN_1",
            created="CREATED_DATE_1"
        ),
        OrderCommentDTO(
            id="COMMENT_ID_2",
            content="COMMENT_CONTENT_2",
            adminName="ADMIN_NAME_2",
            isVisibleToCustomer="IS_VISIBLE_TO_CUSTOMER_2",
            isAdmin="IS_ADMIN_2",
            created="CREATED_DATE_2"
        ),
        OrderCommentDTO(
            id="COMMENT_ID_3",
            content="COMMENT_CONTENT_3",
            adminName="ADMIN_NAME_3",
            isVisibleToCustomer="IS_VISIBLE_TO_CUSTOMER_3",
            isAdmin="IS_ADMIN_3",
            created="CREATED_DATE_3"
        )
    ]
)

Getting Shipment Status of an Order

Function: admin_orders_shipment_status_get()

Purpose

The admin_orders_shipment_status_get() function is used to retrieve the shipment status of a specific order from the WebCommander system. It provides administrators with real-time tracking information such as whether the order is pending shipment, shipped, delivered, or returned. This function is essential for monitoring the fulfillment progress of orders and ensuring that logistics are operating as expected. It uses the WebCommander SDK to securely interact with the platform’s API, and debugging is disabled by default to ensure cleaner logs during standard use.

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order whose shipment status is to be retrieved.

Use Case

This function is commonly used by warehouse staff, order fulfillment teams, and customer support agents to check the delivery progress of an order. For example, if a customer inquires about the current status of their order, an admin can use this function to fetch the latest shipping status and respond with accurate information.

It also assists in identifying delays or delivery issues by checking whether orders are stuck in transit or not yet dispatched. During post-order audits or logistics reviews, the function helps track the status of all outgoing packages. It ensures transparency in the order lifecycle and helps maintain high levels of service accuracy and customer satisfaction.

def admin_orders_shipment_status_get():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.orders_shipment_status(order_id=order_id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response returns the current shipment status of the specified order. This includes information such as the delivery stage (e.g. processing, shipped, delivered), carrier details, tracking number, and timestamps. This information enables administrators to act promptly in case of delays or to confirm successful delivery. If the order ID is invalid or the shipment record is not available, the API returns an error message. The function captures such errors and logs them, allowing administrators to quickly troubleshoot or escalate the issue.

OrderShipmentStatusResponseDTO(
    orderId="ORDER_ID",
    shipmentStatus="SHIPMENT_STATUS",
    shipmentsInfo=[]
)

Create Order Shipment

Function: admin_create_orders_shipment()

Purpose

The admin_create_orders_shipment() function allows administrators to create a shipment record for a specific order in the WebCommander system. It enables tracking shipment details such as the shipping method, tracking number, and shipped items for better logistics management.

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order for which the shipment will be created.
shippingDate
String
The date and time when the shipment is scheduled or completed.
method
String
The shipping carrier or method used for the shipment.
trackingInfo
String
The tracking number provided by the shipping carrier.
shipmentItems
List
A list of shipment item details including quantity and order item ID.

Use Case

This function is used when a customer's order has been processed and is ready for shipment. It records the shipping event, associates it with the order, and updates the system with tracking information. It is essential for order fulfillment processes, enabling better communication with customers about shipping progress and estimated delivery times.

def admin_create_orders_shipment():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = OrderShipmentRequestDTO(
            shippingDate='SHIPPING_DATE_TIME',
            method='SHIPPING_METHOD',
            trackingInfo='TRACKING_NUMBER',
            shipmentItems=[ShipmentItemDTO(
                quantity=1,
                orderItemId='ORDER_ITEM_ID'
            )]
        )
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.create_orders_shipment(order_id=order_id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response confirms that the shipment has been created, returning shipment details such as shipment ID and tracking data. If required information is missing or the order ID is invalid, an error response is returned describing the failure, allowing administrators to quickly identify and correct the issue.

[----]

Getting Shipment Details of Order

Function: admin_orders_shipment_get()

Purpose

The admin_orders_shipment_status_get() function retrieves the shipment status of a specific order in the WebCommander system. It allows administrators to track the delivery progress, carrier details, and shipment timelines associated with customer orders.

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order whose shipment status is to be retrieved.

Use Case

This function is used when administrators or support teams need to check the current shipment status of an order. It helps in providing customers with real-time updates on their delivery progress, identifying shipping delays, and ensuring that the logistics workflow is properly tracked and managed.

def admin_orders_shipment_get():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.orders_shipment(order_id=order_id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response provides detailed shipment information including shipment status, carrier name, tracking number, and timestamps for shipping and estimated delivery. If the order ID is invalid or shipment information is unavailable, an error response is returned describing the problem for troubleshooting.

ShipmentsListResponseDTO(shipments=[])

Updating Order Status

Function: admin_update_orders_status()

Purpose

The admin_update_orders_status() function allows administrators to update the status of a specific order in the WebCommander system. It helps track and manage the different stages of an order’s lifecycle, from processing to fulfillment or completion.

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order whose status will be updated.
status
String
The new status to be assigned to the order (e.g., "IN_PROGRESS", "COMPLETED", "CANCELLED").

Use Case

This function is used when an order’s status needs to be changed manually or programmatically. It is commonly applied during fulfillment workflows, customer service interventions, or after payment confirmation. It ensures that the order status accurately reflects its current position in the order management process.

def admin_update_orders_status():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = OrderStatusUpdateRequestDTO(
            status='ORDER_STATUS'
        )
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.update_orders_status(order_id=order_id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response confirms that the order status has been updated. If the order ID is invalid, or if the status value does not meet validation rules, an error response is returned describing the problem for corrective action.

OrdersDetailsResponseDTO(
    order=OrderDTO(
        orderId="ORDER_ID",
        orderStatus="ORDER_STATUS",
        subTotal="SUB_TOTAL",
        shippingCost="SHIPPING_COST",
        shippingTax="SHIPPING_TAX",
        handlingCost="HANDLING_COST",
        totalSurcharge="TOTAL_SURCHARGE",
        totalDiscount="TOTAL_DISCOUNT",
        totalTax="TOTAL_TAX",
        grandTotal="GRAND_TOTAL",
        paid="PAID_AMOUNT",
        due="DUE_AMOUNT",
        itemsTotal="ITEMS_TOTAL",
        paymentStatus="PAYMENT_STATUS",
        ipAddress="IP_ADDRESS",
        customerSummary=CustomerSummaryDTO(
            firstName="FIRST_NAME",
            lastName="LAST_NAME",
            customerGroup="CUSTOMER_GROUP",
            gender="GENDER",
            email="EMAIL_ADDRESS",
            addressLine1="ADDRESS_LINE_1",
            addressLine2="ADDRESS_LINE_2",
            city="CITY",
            country=CountryDTO(
                id="COUNTRY_ID",
                name="COUNTRY_NAME",
                code="COUNTRY_CODE"
            ),
            state=StateDTO(
                id="STATE_ID",
                name="STATE_NAME",
                code="STATE_CODE"
            ),
            postCode="POST_CODE",
            phone="PHONE_NUMBER",
            mobile="MOBILE_NUMBER",
            fax="FAX",
            companyName="COMPANY_NAME"
        ),
        orderLineDetails=[
            OrderLineDetailDTO(
                itemId="ITEM_ID",
                productName="PRODUCT_NAME",
                productId="PRODUCT_ID",
                quantity="QUANTITY",
                price="PRICE",
                totalAmount="TOTAL_AMOUNT",
                tax="TAX",
                discount="DISCOUNT",
                taxDiscount="TAX_DISCOUNT",
                isTaxable="IS_TAXABLE",
                isShippable="IS_SHIPPABLE",
                productOrderQuantity="PRODUCT_ORDER_QUANTITY",
                productPrice="PRODUCT_PRICE"
            )
        ]
    )
)

Creating Payment for Order

Function: admin_create_orders_payment()

Purpose

The admin_create_orders_payment() function allows administrators to manually record a payment against a specific order in the WebCommander system. It is used to log transaction details, including amount, method, payer info, and whether to notify the customer.

Parameters

Parameter
Type
Description
order_id
String
The unique identifier of the order to which the payment will be applied.
paymentMethod
String
The method used for payment (e.g., "PIS", "CreditCard").
date
String
The date and time when the payment occurred.
amount
String
The payment amount.
surcharge
String
Any additional surcharge applied to the transaction.
trackInfo
String
Optional tracking or reference information for the payment.
payerInfo
String
Information about the person or entity making the payment.
isNotify
String
Specifies whether to notify the customer via email ("true" or "false").

Use Case

This function is used when a payment is made outside of the automated checkout process, such as manual bank transfers or external systems. It helps administrators log these payments accurately into the system to reflect up-to-date order and financial statuses. It's also useful for B2B scenarios or post-sale adjustments.

def admin_create_orders_payment():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = True

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = OrdersPaymentRequestDTO(
            payment=OrdersPaymentRequestDetailsDTO(
                paymentMethod='PAYMENT_METHOD',
                date='PAYMENT_DATE_TIME',
                amount="PAYMENT_AMOUNT",
                surcharge="SURCHARGE_AMOUNT",
                trackInfo="TRACKING_INFO",
                payerInfo="PAYER_INFORMATION",
                isNotify="true"
            )
        )
        order_id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.create_orders_payment(order_id=order_id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response confirms that the payment was recorded and associated with the specified order. If any required fields are missing, values are invalid, or the order ID does not exist, an error response is returned describing the issue in detail.

OrdersPaymentResponseDTO(
    payment=OrdersPaymentResponseDetailsDTO(
        status="PAYMENT_STATUS",
        id="PAYMENT_ID",
        date="PAYMENT_DATE",
        paymentApplied="PAYMENT_APPLIED",
        paymentMethod="PAYMENT_METHOD",
        orderId="ORDER_ID",
        orderTotal="ORDER_TOTAL",
        dueAmount="DUE_AMOUNT",
        paidAmount="PAID_AMOUNT",
        customer={
            "id": "CUSTOMER_ID",
            "name": "CUSTOMER_NAME"
        },
        createdBy="CREATED_BY",
        createdAt="CREATED_AT"
    )
)

Creating Refund for Payment

Function: admin_payments_refund()

Purpose

The admin_payments_refund() function allows administrators to issue a refund for a specific payment in the WebCommander system. It supports both internal balance adjustments and optional gateway-based refunds, and enables control over email notifications and order total adjustments.

Parameters

Parameter
Type
Description
payment_id
String
The unique identifier of the payment being refunded.
amount
String
The amount to refund.
reason
String
The reason for the refund.
gatewayRefund
Boolean
Indicates whether the refund should also be processed through the payment gateway.
sendRefundEmail
Boolean
Specifies whether a refund notification email should be sent to the customer.
adjustWithOrder
Boolean
Indicates if the refund amount should be adjusted against the original order total.

Use Case

This function is used when a customer payment needs to be partially or fully refunded, such as for cancellations, returns, overcharges, or customer disputes. It allows administrators to log the refund in the system and control whether it is processed through the original gateway and whether the customer should be notified.

def admin_payments_refund():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = PaymentsRefundRequestDTO(
            refund=PaymentsRefundRequestDetailsDTO(
                amount="REFUND_AMOUNT",
                reason="REFUND_REASON",
                gatewayRefund=False,
                sendRefundEmail=False,
                adjustWithOrder=True
            )
        )
        payment_id = 'PAYMENT_ID'
        response = webcommander_sdk.admin_payments.create_payments_refund(payment_id=payment_id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

A successful response confirms that the refund has been created and linked to the original payment. If any validation errors occur (e.g., refund amount exceeds original payment, or the payment ID is invalid), an error response is returned with details to help resolve the issue.

PaymentsRefundResponseDTO(
    status="STATUS",
    paymentId="PAYMENT_ID",
    amount="AMOUNT",
    reason="REASON",
    sendRefundEmail="SEND_REFUND_EMAIL",
    adjustWithOrder="ADJUST_WITH_ORDER"
)

Cancelling an Order

Function: admin_orders_cancel()

Purpose

The admin_orders_cancel() function is used to cancel a specific order in the WebCommander system. It enables administrators to revoke or terminate an order that has not yet been fulfilled, typically due to customer request, payment failure, inventory issues, or other operational reasons. This function sends a secure API call via the WebCommander SDK to change the status of the order to "cancelled." Debugging outputs are disabled by default to maintain a clean execution environment.

Parameters

Parameter
Type
Description
id
StringThe unique identifier of the order to be cancelled.

Use Case

This function is valuable in scenarios where an order must be cancelled before it is shipped or processed. For example, if a customer contacts support to revoke their purchase, the administrator can cancel the order using this function. It can also be used when fraud is detected, a duplicate order is placed, or stock for the purchased items is no longer available.

Warehouse teams and finance departments may rely on this function to maintain accurate inventory and financial records by ensuring that cancelled orders do not proceed through further fulfillment steps. It also helps maintain customer trust by promptly acting on cancellation requests and preventing unintentional shipments.

def admin_orders_cancel():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = 'ORDER_ID'
        response = webcommander_sdk.admin_orders.orders_cancel(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

If the request is successful, the response confirms that the specified order has been cancelled, and the order status is updated accordingly in the system. This ensures that no further processing, invoicing, or shipping actions will occur for the cancelled order.

If the order cannot be cancelled—for example, if it has already been shipped or the ID is invalid—the function returns an error response.

OrdersDetailsResponseDTO(
    order=OrderDTO(
        orderId="ORDER_ID",
        orderStatus="cancelled",
        subTotal="SUB_TOTAL",
        shippingCost="SHIPPING_COST",
        shippingTax="SHIPPING_TAX",
        handlingCost="HANDLING_COST",
        totalSurcharge="TOTAL_SURCHARGE",
        totalDiscount="TOTAL_DISCOUNT",
        totalTax="TOTAL_TAX",
        grandTotal="GRAND_TOTAL",
        paid="PAID",
        due="DUE",
        itemsTotal="ITEMS_TOTAL",
        paymentStatus="PAYMENT_STATUS",
        ipAddress="IP_ADDRESS",
        customerSummary=CustomerSummaryDTO(
            firstName="FIRST_NAME",
            lastName="LAST_NAME",
            customerGroup="CUSTOMER_GROUP",
            gender="GENDER",
            email="EMAIL",
            addressLine1="ADDRESS_LINE1",
            addressLine2="ADDRESS_LINE2",
            city="CITY",
            country=CountryDTO(
                id="COUNTRY_ID",
                name="COUNTRY_NAME",
                code="COUNTRY_CODE"
            ),
            state=StateDTO(
                id="STATE_ID",
                name="STATE_NAME",
                code="STATE_CODE"
            ),
            postCode="POST_CODE",
            phone="PHONE",
            mobile="MOBILE",
            fax="FAX",
            companyName="COMPANY_NAME"
        ),
        orderLineDetails=[
            OrderLineDetailDTO(
                itemId="ITEM_ID",
                productName="PRODUCT_NAME",
                productId="PRODUCT_ID",
                quantity="QUANTITY",
                price="PRICE",
                totalAmount="TOTAL_AMOUNT",
                tax="TAX",
                discount="DISCOUNT",
                taxDiscount="TAX_DISCOUNT",
                isTaxable="IS_TAXABLE",
                isShippable="IS_SHIPPABLE",
                productOrderQuantity="PRODUCT_ORDER_QUANTITY",
                productPrice="PRODUCT_PRICE"
            )
        ]
    )
)