/Orders

Esse recurso gerencia os pedidos dos consumidores em todas as suas etapas.

Siga os passos:

  1. Consulte a cada 30 segundos a atualização de pedidos através do recurso /live;

  2. Ao detectar a existência de um novo pedido, consulte as informações completas através do recurso /info e importe em seu sistema;

  3. Consulte o /Workflow disponível para o pedido e apresente as ações para usuário tomar a decisão do que será feito;

  4. Execute o fluxo escolhido pelo usuário;

  5. Ao concluir, utilize os recursos /Done e /Canceled para ter acesso ao histórico de pedidos;

/Live

Esse recurso gerencia a pesquisa de pedidos em tempo de execução, ou seja, pedidos que estão em aberto e devem passar pelo fluxo de atendimento (Workflow).

Listagem de pedidos abertos

GET /v1/merchant/orders/live

Método retorna uma listagem de pedidos em aberto, com dados resumidos.

Query Parameters

Name
Type
Description

page[]

string

filter[]

string

sort[]

string

{
    "items": [
        {
            "orderId": "400218",
            "externalId": null,
            "status": {
                "id": "1",
                "title": "Pendente",
                "object": "OrderShipmentStatus"
            },
            "amountTotal": "240.99",
            "paymentTypeId": "9",
            "paymentPrepaid": false,
            "customerId": "1",
            "customerName": "JACK BAUER",
            "customerPhone": "(63) 0000-0000",
            "addressDelivery": "Endereço: Quadra X Sul Alameda X; Nº: X; Bairro: Plano Diretor Sul; Cidade: Palmas/TO; CEP: 77022-386;",
            "startedAt": "2018-09-25T15:05:01-0300",
            "updateAt": null,
            "object": "OrderLive"
        },
        {
            "orderId": "400219",
            "externalId": null,
            "status": {
                "id": "2",
                "title": "Em produção",
                "object": "OrderShipmentStatus"
            },
            "amountTotal": "66.00",
            "paymentTypeId": "10",
            "paymentPrepaid": false,
            "customerId": "1",
            "customerName": "TONY STARK",
            "customerPhone": "(63) 0000-0000",
            "addressDelivery": "Endereço: Quadra X Sul Alameda X; Nº: X; Bairro: Plano Diretor Sul; Cidade: Palmas/TO; CEP: 77022-386;",
            "startedAt": "2018-09-26T17:54:38-0300",
            "updateAt": "2018-09-26T17:54:52-0300",
            "object": "OrderLive"
        }
    ],
    "meta": {
        "page": {
            "total": 2,
            "currentPage": 0,
            "lastPage": 0,
            "perPage": 10
        }
    },
    "links": []
}

/Info

Esse recurso retorna informações completas do pedido.

Informações do pedido

GET /v1/merchant/orders/{id}

Método retorna informações completas do pedido.

Path Parameters

Name
Type
Description

id

number

Código do pedido

{
    "id": "372630",
    "uid": "d40f86965d406245737asd5ceba7cb3b",
    "externalId": null,
    "amount": "95.99",
    "amountDiscount": "0.00",
    "amountTotal": "95.99",
    "status": {
        "id": "2",
        "title": "Concluído",
        "object": "OrderStatus"
    },
    "notes": "",
    "createdAt": "2018-07-02T18:45:40-0300",
    "customer": {
        "id": "3649900",
        "name": "JACK BAUER",
        "document": {
            "number": "000.000.000-00",
            "type": "cpf",
            "object": "Document"
        },
        "phone": "(63) 0000-0000",
        "phoneMobile": "(63) 0000-0000",
        "email": "jackbauer@ig.com.br",
        "createdAt": "2016-01-11T18:43:50-0300",
        "object": "Customer"
    },
    "coupon": null,
    "payment": {
        "prepaid": true,
        "statusPayment": {
            "id": "2",
            "title": "PAGO ONLINE",
            "alert": "(!) Já recebemos, não cobre do consumidor.",
            "object": "OrderPaymentStatus"
        },
        "paymentType": {
            "id": "1",
            "paymentTypeParentId": "0",
            "environmentId": "1",
            "title": "Cartão de crédito (online)",
            "titleInternal": "PAGO ONLINE (CIELO)",
            "slug": "online-credito",
            "priority": "1",
            "active": true,
            "object": "PaymentType"
        },
        "amountCart": "90.00",
        "amountCartDiscount": "0",
        "amountShipment": "5.99",
        "amountShipmentDiscount": "0",
        "amountDiscount": "0.00",
        "amountTotal": "95.99",
        "amountChange": "0.00",
        "paymentAt": "2018-07-02T18:45:55-0300",
        "object": "Payment"
    },
    "cart": {
        "amountCart": "90.00",
        "amountCartDiscount": "0",
        "amountCartTotal": "90.00",
        "items": [
            {
                "id": "617867",
                "orderId": "372630",
                "salesProductId": "532",
                "salesPricingId": "1",
                "externalId": null,
                "notes": "",
                "quantity": "1",
                "amountUnit": "90.00",
                "amountTotal": "90.00",
                "title": "Pizza Big c/ 3 Sabores",
                "titleInternal": "",
                "items": [
                    {
                        "id": "1635187",
                        "orderSalesProductId": "617867",
                        "productId": "1534",
                        "externalId": null,
                        "quantity": "1",
                        "amountUnit": "34.00",
                        "amountTotal": "34.00",
                        "title": "Allicci",
                        "titleInternal": "Allicci",
                        "object": "OrderInventoryProduct"
                    },
                    {
                        "id": "1635188",
                        "orderSalesProductId": "617867",
                        "productId": "1576",
                        "externalId": null,
                        "quantity": "1",
                        "amountUnit": "28.00",
                        "amountTotal": "28.00",
                        "title": "Margherita",
                        "titleInternal": "Margherita",
                        "object": "OrderInventoryProduct"
                    },
                    {
                        "id": "1635189",
                        "orderSalesProductId": "617867",
                        "productId": "1541",
                        "externalId": null,
                        "quantity": "1",
                        "amountUnit": "28.00",
                        "amountTotal": "28.00",
                        "title": "Baiana",
                        "titleInternal": "Baiana",
                        "object": "OrderInventoryProduct"
                    },
                    {
                        "id": "1635190",
                        "orderSalesProductId": "617867",
                        "productId": "1675",
                        "externalId": null,
                        "quantity": "1",
                        "amountUnit": "0.00",
                        "amountTotal": "0.00",
                        "title": "Massa Tradicional",
                        "titleInternal": "Massa Tradicional",
                        "object": "OrderInventoryProduct"
                    },
                    {
                        "id": "1635191",
                        "orderSalesProductId": "617867",
                        "productId": "1691",
                        "externalId": null,
                        "quantity": "1",
                        "amountUnit": "0.00",
                        "amountTotal": "0.00",
                        "title": "Sem borda",
                        "titleInternal": "Sem borda",
                        "object": "OrderInventoryProduct"
                    }
                ],
                "object": "OrderSalesProduct"
            }
        ],
        "object": "Cart"
    },
    "shipment": {
        "id": "372630",
        "shipmentPlanId": "2",
        "statusShipment": {
            "id": "4",
            "title": "Entregue",
            "object": "OrderShipmentStatus"
        },
        "amountShipment": "5.99",
        "amountShipmentDiscount": "0",
        "amountShipmentTotal": "5.99",
        "deliveryAt": "2018-07-02T19:28:30-0300",
        "nfse": "",
        "addressDelivery": {
            "street": "X Sul Rua X QI X",
            "number": "Lote X",
            "complement": "Casa X",
            "district": "Plano Diretor Sul",
            "zip": "77015000",
            "state": "TO",
            "city": "Palmas",
            "reference": "Entre o 1 batalhão da PM e Bombeiro.",
            "latitude": null,
            "longitude": null,
            "object": "Address"
        },
        "addressPickup": {
            "street": "103 Norte Avenida Juscelino Kubitschek",
            "number": "159",
            "complement": "",
            "district": "Plano Diretor Norte",
            "zip": "77001014",
            "state": "TO",
            "city": "Palmas",
            "reference": "",
            "latitude": "-10.184235",
            "longitude": "-48.340089",
            "object": "Address"
        },
        "transportType": {
            "id": 1,
            "title": "Moto",
            "object": "TransportType"
        },
        "packageType": {
            "id": 1,
            "title": "Bag (normal)",
            "object": "PackageType"
        },
        "slo": {
            "id": 1,
            "title": "Entrega imediata",
            "object": "SLO"
        },
        "driver": {
            "id": "54",
            "name": "FERNANDO",
            "phoneMobile": null,
            "document": null,
            "vehicle": null,
            "object": "Driver"
        },
        "carrier": {
            "id": "1",
            "title": "TNL PALMAS",
            "description": null,
            "image": null,
            "document": {
                "number": "27.692.571/0001-90",
                "type": "cnpj",
                "object": "Document"
            },
            "sponsor": "Darley Passarin",
            "phone": "(63) 3219-6900",
            "email": "palmas@tonolucro.com",
            "address": {
                "street": "103 Sul Rua SO 5",
                "number": "18",
                "complement": "",
                "district": "Plano Diretor Sul",
                "zip": "77015018",
                "state": "TO",
                "city": "Palmas",
                "reference": "",
                "latitude": "-10.187481",
                "longitude": "-48.339311",
                "object": "Address"
            },
            "createdAt": "2018-01-09T11:28:34-0300",
            "updatedAt": null,
            "object": "Franchise"
        },
        "object": "Shipment"
    },
    "object": "Order"
}

/Status

Esse recurso retorna o status atual do pedido /Order/Status e /Order/Shipment/Status.

Status do pedido

GET /v1/merchant/orders/{id}/status

Método retorna status atual do pedido.

Path Parameters

Name
Type
Description

id

number

Código do pedido

{
    "orderStatus": {
        "id": "1",
        "title": "Aberto",
        "object": "OrderStatus"
    },
    "shipmentStatus": {
        "id": "7",
        "title": "Coletado",
        "object": "OrderShipmentStatus"
    }
}

/Indicators

Esse recurso retorna as informações de cada etapa do clico de vida do pedido.

Indicadores do pedido

GET /v1/merchant/orders/{id}/indicators

Método retorna os indicadores do pedido.

Path Parameters

Name
Type
Description

id

number

Código do pedido

{
    "timeorder": 14,
    "steps": {
        "analysis": {
            "priority": 1,
            "key": "analysis",
            "minutes": 0,
            "seconds": 13,
            "status": 2,
            "start": "2019-10-07 09:59:19",
            "end": "2019-10-07 09:59:32",
            "level": {
                "key": "green",
                "percent": 0,
                "interval": {
                    "start": 0,
                    "end": 3
                },
                "parameters": {
                    "1": 3,
                    "2": 5,
                    "3": 10
                }
            }
        },
        "accept": {
            "priority": 2,
            "key": "accept",
            "minutes": 1,
            "seconds": 61,
            "status": 2,
            "start": "2019-10-07 09:59:32",
            "end": "2019-10-07 10:00:33",
            "level": {
                "key": "green",
                "percent": 10,
                "interval": {
                    "start": 0,
                    "end": 3
                },
                "parameters": {
                    "1": 3,
                    "2": 5,
                    "3": 10
                }
            }
        },
        "production": {
            "priority": 3,
            "key": "production",
            "minutes": 0,
            "seconds": 8,
            "status": 2,
            "start": "2019-10-07 10:00:33",
            "end": "2019-10-07 10:00:41",
            "level": {
                "key": "green",
                "percent": 0,
                "interval": {
                    "start": 0,
                    "end": 20
                },
                "parameters": {
                    "1": 20,
                    "2": 30,
                    "3": 60
                }
            }
        },
        "pickup": {
            "priority": 4,
            "key": "pickup",
            "minutes": 8,
            "seconds": 488,
            "status": 2,
            "start": "2019-10-07 10:00:41",
            "end": "2019-10-07 10:08:49",
            "level": {
                "key": "green",
                "percent": 27,
                "interval": {
                    "start": 0,
                    "end": 10
                },
                "parameters": {
                    "1": 10,
                    "2": 15,
                    "3": 30
                }
            }
        },
        "inbox": {
            "priority": 5,
            "key": "inbox",
            "minutes": 0,
            "seconds": 18,
            "status": 2,
            "start": "2019-10-07 10:08:49",
            "end": "2019-10-07 10:09:07",
            "level": {
                "key": "green",
                "percent": 0,
                "interval": {
                    "start": 0,
                    "end": 5
                },
                "parameters": {
                    "1": 5,
                    "2": 8,
                    "3": 16
                }
            }
        },
        "delivery": {
            "priority": 6,
            "key": "delivery",
            "minutes": 3,
            "seconds": 182,
            "status": 2,
            "start": "2019-10-07 10:09:07",
            "end": "2019-10-07 10:12:09",
            "level": {
                "key": "green",
                "percent": 10,
                "interval": {
                    "start": 0,
                    "end": 10
                },
                "parameters": {
                    "1": 10,
                    "2": 15,
                    "3": 30
                }
            }
        },
        "reception": {
            "priority": 7,
            "key": "reception",
            "minutes": 2,
            "seconds": 91,
            "status": 2,
            "start": "2019-10-07 10:12:09",
            "end": "2019-10-07 10:13:40",
            "level": {
                "key": "green",
                "percent": 13,
                "interval": {
                    "start": 0,
                    "end": 5
                },
                "parameters": {
                    "1": 5,
                    "2": 8,
                    "3": 16
                }
            }
        }
    }
}

/Done

Esse recurso gerencia a pesquisa de pedidos concluídos em um determinado período.

Listagem de pedidos concluídos

GET /v1/merchant/orders/done

Método retorna os pedidos concluídos em um intervalo de datas.

Query Parameters

Name
Type
Description

start

string

Data inicial. Formato YYYY-MM-DD.

end

string

Data final. Formato YYYY-MM-DD.

page[]

string

Pagination http://jsonapi.org/

filter[]

string

Filter http://jsonapi.org/

sort[]

string

Sort http://jsonapi.org/

{
    "items": [
        {
            "id": "372630",
            "customerId": "36499",
            "merchantId": "534",
            "paymentTypeId": "1",
            "amountCart": "90.00",
            "amountCartDiscount": "0",
            "amountShipment": "5.99",
            "amountShipmentDiscount": "0",
            "amountDiscount": "0.00",
            "amountTotal": "95.99",
            "amountChange": "0.00",
            "status": "2",
            "statusPayment": "2",
            "statusShipment": "4",
            "canceledJustification": "",
            "paymentAt": "2018-07-02T18:45:55-0300",
            "deliveryAt": "2018-07-02T19:28:30-0300",
            "createdAt": "2018-07-02T18:45:40-0300",
            "object": "OrderItem"
        }
    ],
    "meta": {
        "page": {
            "total": 430,
            "currentPage": 3,
            "lastPage": 429,
            "perPage": 1
        }
    },
    "links": {
        "first": "/merchant/orders/done?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=0&page%5Bsize%5D=1",
        "last": "/merchant/orders/done?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=429&page%5Bsize%5D=1",
        "prev": "/merchant/orders/done?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=2&page%5Bsize%5D=1",
        "next": "/merchant/orders/done?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=4&page%5Bsize%5D=1"
    }
}

Exemplo:

GET /api/merchant/orders/done?start=2018-07-01&end=2018-07-31&page[number]=3&page[size]=1 HTTP/1.1
Authorization: Basic XXX
Content-Type: application/json

/Canceled

Esse recurso gerencia a pesquisa de pedidos cancelados em determinado período.

Listagem de pedidos cancelados

GET /v1/merchant/orders/canceled

Método retorna pedidos cancelados em um intervalo de datas.

Query Parameters

Name
Type
Description

start

string

Data inicial. Formato YYYY-MM-DD.

end

string

Data final. Formato YYYY-MM-DD.

page[]

string

filter[]

string

sort[]

string

{
    "items": [
        {
            "id": "383051",
            "customerId": "44208",
            "merchantId": "534",
            "paymentTypeId": "13",
            "amountCart": "65.00",
            "amountCartDiscount": "0",
            "amountShipment": "5.99",
            "amountShipmentDiscount": "0",
            "amountDiscount": "0.00",
            "amountTotal": "70.99",
            "amountChange": "0.00",
            "status": "3",
            "statusPayment": "4",
            "statusShipment": "5",
            "canceledJustification": "Pedido cancelado por solicitação da cliente.",
            "paymentAt": "2018-07-11T18:36:55-0300",
            "deliveryAt": "2018-07-11T18:36:48-0300",
            "createdAt": "2018-07-11T18:36:48-0300",
            "object": "OrderItem"
        }
    ],
    "meta": {
        "page": {
            "total": 8,
            "currentPage": 3,
            "lastPage": 7,
            "perPage": 1
        }
    },
    "links": {
        "first": "/merchant/orders/canceled?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=0&page%5Bsize%5D=1",
        "last": "/merchant/orders/canceled?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=7&page%5Bsize%5D=1",
        "prev": "/merchant/orders/canceled?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=2&page%5Bsize%5D=1",
        "next": "/merchant/orders/canceled?start=2018-07-01&end=2018-07-31&page%5Bnumber%5D=4&page%5Bsize%5D=1"
    }
}

Exemplo:

GET /api/merchant/orders/canceled?start=2018-07-01&end=2018-07-31&page[number]=3&page[size]=1 HTTP/1.1
Authorization: Basic XXX
Content-Type: application/json

Last updated