API reference · Orders
Update Order Status - Marketplace
https://api.sandbox.cws.digital/partnerOrders/store/{id}Description
Allows the origin store to move an order that was born in it to the next status, saving along with it the data that status requires.
The body, the transitions and the response are identical to those of the store route. The difference is the scope and a configuration prerequisite — see The store must be enabled.
The invoice fields are only saved when the order does not have an invoice yet: resending them on an order already marked with an invoice does not overwrite the values.
Parameters
Path parameters
| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| id | integer | Yes | Id of the partner order ( |
Request body
application/jsonRequired| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| status | string | Yes | Target status. See Where the order can go. | |
| supplierOrderId | string | Conditional | Order number in your system. Required when | |
| supplierInvoiceNumber | string | Conditional | Invoice number. Accepted in | |
| supplierInvoiceSerie | string | No | Invoice series. Accepted in | |
| supplierInvoiceKey | string | No | Invoice access key. Accepted in | |
| supplierInvoiceDate | string | No | Invoice issue date, in the format | |
| trackingCode | string | Conditional | Tracking code. Accepted in | |
| urlTrackingCode | string | No | Carrier's tracking URL. Optional, accepted in | |
| ownCarrier | string | Conditional | Name of the carrier making the delivery. Accepted in | |
| orderObservation | string | No | Free note saved in the order. Accepted in | |
| orderReasonCanceled | integer | No | Cancellation reason id. Accepted in |
Business rules
Where the order can go
The target status is accepted from a specific current status. Outside that combination, the response is 422.
status sent | Required current status | Own fields |
|---|---|---|
APPROVED | order awaiting payment, without credit or with payment at the store | — |
READY | PAYMENT_APPROVED | supplierOrderId required |
SHIPPED | READY | trackingCode with Correios shipping; with trackingCode, ownCarrier; supplierInvoiceNumber if the order has no invoice yet — see Shipping (SHIPPED) |
DELIVERED | SHIPPED | — |
STRAYED | SHIPPED | — |
RETURNED | DELIVERED | — |
AWAITING_PAYMENT | AWAITING_PAYMENT | — |
CANCELED | any | orderReasonCanceled |
Payment approval is sent as APPROVED, not as PAYMENT_APPROVED — it is the order that then stays in PAYMENT_APPROVED.
The other values of the status enum (PRE_ORDER, PAYMENT_APPROVED, COMPLETED, WITHOUT_CREDIT_LIMIT, STORE_PAYMENT) are used to filter the listing, but are not accepted here: the request responds 422.
Shipping (SHIPPED)
trackingCodeis required when the order's shipping is Correios; with other shipping types, it is optional.- When you send
trackingCode, also sendownCarrierwith the carrier's name — that is what gets saved as the delivery carrier. - Without
ownCarrierand withouturlTrackingCode, the response is 422 withPara realizar a atualização do pedido com id <id> ownCarrier e urlTrackingCode é obrigatorio. - With only
urlTrackingCode, withoutownCarrier, the request is also refused with 422. urlTrackingCodeis optional.- If the order has no invoice number yet,
supplierInvoiceNumberis required: without it, the response is 422 withNúmero de Nota Fiscal é obrigatório.
Order under approval workflow
In an order with an approval workflow (approvalWorkflow: true) not yet approved, the only accepted status is CANCELED. Any other responds 422.
Cancellation reasons
orderReasonCanceled receives the reason id:
| Id | Reason | Id | Reason |
|---|---|---|---|
| 2 | 7-day withdrawal | 20 | Payment declined |
| 3 | Logistics problem | 21 | No response from the customer |
| 4 | Description error | 22 | No credit |
| 5 | Lost in transit | 23 | Expired |
| 6 | Lack of payment | 24 | Wrong customer |
| 7 | No response from the store | 26 | Wrong order |
| 8 | Out of stock | 27 | Integration failure |
| 9 | Different brand | 28 | Wrong seller |
| 10 | Damaged product | 29 | Chargeback |
| 11 | Wrong product | 30 | Fraud – Product recovered |
| 12 | Counterfeit part | 31 | Suspected fraud |
| 13 | Wrong store price | 32 | Assisted repurchase |
| 14 | Pre-order | 33 | Commercial approval denied |
| 15 | Incorrect price | 34 | Order canceled by the seller |
| 16 | Wrong composition | 35 | Quote edited |
| 17 | Shipping delay | ||
| 18 | Duplicate order | ||
| 19 | Test purchase |
Who can cancel
When the order was born in another store — you are the supplier, not the origin —, cancellation depends on the origin store having enabled cancellation by the seller.
It is its configuration, not yours: until it enables it, your CANCELED responds 422, and it is the origin store itself that cancels. With the permission on, cancellation works normally.
An order originated in your own store does not go through this check.
The store must be enabled
Updating orders by the origin store depends on a configuration of the store itself. Without it, the request responds 422 without touching the order. The release is done by CWS.
Responses
- 401
Missing, malformed or expired token.
- 404
The order does not exist or is not in your scope.