Skip to content
platform

Webhooks and events · Asynchronous webhook

Orders webhook, full payload

When it fires

The trigger is the same as the simplified webhook: the notification goes out after the order is generated on the platform, without depending on your system's response.

The difference is in the body. The full version already carries the transaction details: customer, seller, deliveries with freight and products, and payments.

Example payload

Example from the public collection. The URL is your system's: the address below is only illustrative.

POST https://api.exemplo-cliente.com.br/webhook/pedido-completo
Content-Type: application/json

{
    "id": 505676,
    "status": "CANCELED",
    "subTotal": "R$90.07",
    "total": "R$90.07",
    "dateCreated": "2024-04-08 13:33:27.0",
    "lastUpdated": "2024-04-08 13:35:42.0",
    "customer": {
        "id": 1637173,
        "name": "usuario teste CWS",
        "email": "usuarioteste@cws.digital",
        "phone": "(11) 98988-8888",
        "type": "pf",
        "document": "720.953.820-80"
    },
    "seller": {
        "id": 6255,
        "name": "Filial 1 Loja Exemplo Teste",
        "document": "78.861.562/0001-17"
    },
    "deliveries": [
        {
            "freight": {
                "name": "Retirada na Loja",
                "total": "R$0.00",
                "type": "PICKUP_IN_STORE"
            },
            "products": [
                {
                    "id": 10204964,
                    "name": "Produto de exemplo 18mm",
                    "mfrPartCode": "MF-0000000001",
                    "quantity": 1,
                    "price": 97.9,
                    "partnerPartCode": "5090805",
                    "brand": {
                        "id": 40329,
                        "name": "Marca Exemplo"
                    }
                }
            ]
        }
    ],
    "payments": [
        {
            "id": 305665,
            "gateway": "GATEWAY_DE_PAGAMENTO",
            "paymentInstallments": 1,
            "paymentInstallmentsValue": "R$90.07"
        }
    ]
}

How to respond

This is asynchronous communication: the platform does not wait for a response to continue its processes.

With the full payload your system can record the order without a second call. Progress goes back through the API: status, invoice and item tracking.

The collection documents both payload versions. The choice between the simplified and the full payload is made with the CWS Platform team.

What the collection documents

This is an example payload for the Orders Webhook in the complete version, containing all the transaction details.

Authentication of your endpoint

Authentication Overview

So that CWS can send Webhook notifications (Orders and Customers) securely, our system will first authenticate with yours to obtain an access token.

You must provide us with the details of your authentication endpoint so that we can configure it.

Token Endpoint Structure (Your Responsibility)

You will need to build a POST endpoint (e.g., /token) that, upon receiving the correct credentials, returns an access token. The response must follow the OAuth2 standard:

{
    "access_token": "SEU_TOKEN_GERADO",
    "expires_in": 3600
}

Below are three real examples of how your token endpoint can be configured.


Example 1: client_credentials Flow with Basic Auth

How it works: Your credentials (clientId and clientSecret) are combined, Base64-encoded and sent in the Authorization header.

Request that CWS will make to your token endpoint:

curl --location 'https://api.cliente.com.br/oauth/access-token' \
--header 'Authorization: Basic [SUAS_CREDENCIAS_EM_BASE64]' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials'

Example 2: Flow with clientId and clientSecret in the Body

How it works: Your credentials are sent directly in the request body in JSON format.

Request that CWS will make to your token endpoint:

curl --location 'https://api.cliente.com.br/v1/token' \
--header 'User-Agent: CWS Digital' \
--header 'Content-Type: application/json' \
--data '{
    "clientId": "SEU_CLIENT_ID",
    "clientSecret": "SEU_CLIENT_SECRET"
}'

Example 3: Flow with Credentials in Custom Headers

How it works: A non-standard model where the username and password are sent in specific headers, instead of using Authorization or the request body.

Request that CWS will make to your token endpoint:

curl --location --request POST 'https://api.cliente.com.br/rest/api/oauth2/v1/token?grant_type=password' \
--header 'username: SEU_USUARIO' \
--header 'password: SUA_SENHA'

Webhooks and events

Generated from the public API collection, published on 2026-09-04: api-docs.cws.digital.