This topic aims to foster knowledge in our community, mainly regarding the orders module and more specifically about how Invoicing and Tracking works for orders on the VTEX platform via API and its integration with marketplaces.
There are two distinct ways to carry out this process:
The first way is divided into just 2 steps:
- The invoicing and tracking information is sent to our platform through the Order invoice notification API. When invoicing is done referencing the order items, that information must also be sent at this point.
- Tracking updates are continuously sent to our platform through the Update order tracking status API until the package has been delivered to the recipient and this is reported via the
isDelivered=truefield.
The second way has 3 steps and applies to cases where the ERP first sends only the information related to the order invoice, and then needs to update that information by adding tracking details in a later step. In this case, the following step-by-step process must be followed:
- Insert the invoice with billing information (without tracking information) through the Order invoice notification API. When invoicing is done referencing the order items, that information must also be sent at this point.
- Send the tracking code and other tracking information to the invoice already inserted in the previous step, using the Update order’s partial invoice (send tracking number) API.
- Continuously send tracking updates to our platform through the Update order tracking status API until the package has been delivered to the recipient and this is reported via the
isDelivered=truefield.
The parties responsible for making these requests are
ERP and
Carrier. Considering the ideal flow:
- Insert invoice →
ERP - Send tracking information →
Carrier - Send tracking updates →
Carrier
In order:
1.
Order Invoice Notification [POST]
In our logs, this workflow is called NotifyInvoice.
This is the method that should be used by the
ERP to insert the order billing information, where:
-
invoiceNumberis the order’s invoice number; -
invoiceValueis the value of the order’s invoice. It is worth noting that for the order to move to Invoiced status, this value must match the total order value; -
invoiceKeyis the access key; -
invoiceUrlis the invoice URL; -
embededInvoiceis the field where the order invoice XML must be inserted, and it is required for the order status to be updated in certified integration Marketplaces.
As a general rule, one request should be sent per invoice per order.
What happens if I send more than one
NotifyInvoicefor the same invoice?
Since this is a POST method, the previous invoice will be overwritten and information may be lost. The last update sent takes precedence.
2.
Update order’s partial invoice (send tracking number) [PATCH]
In our logs, this workflow is called UpdatePartialInvoice.
This is the method that should be used by the
carrier to insert the tracking and delivery information (as the name suggests), such as:
-
trackingNumberis the tracking code; -
trackingUrlshould be filled in with the tracking URL; -
dispatchedDateis the dispatch date; -
courieris the field dedicated to the carrier’s name.
As with the previous step, this data only needs to be sent once per invoice per order — unless it becomes necessary to update the tracking information that was sent (there is no need to use this method multiple times per invoice per order).
Since this is a PATCH method, only the tracking parameters of the invoice will be filled in — those that were left blank in the previous step’s request.
What happens if I send more than one
UpdatePartialInvoicefor the same invoice?
Since this API uses the PATCH method, only the parameters sent the second time will be overwritten. The other fields sent in the previous step remain unchanged.
3)
Update order tracking status [PUT]
In our logs, this workflow is called UpdateTrackingStatus.
This is the method that should be used by the
carrier to insert tracking updates. It is worth noting that it can be used multiple times, until the order has actually been delivered to its final recipient, where:
-
isDeliveredis the field that indicates whether the order has been delivered or not; -
deliveredDateis the delivery date; -
eventsis the array containing the location, date, and description of the updates.
Unlike the previous steps, multiple requests to this API are expected. Since this is a PUT method, each new update will be inserted into the order’s information under the courierStatus field. All updates sent are recorded — not just the most recent one — unlike the previous steps.
Important notes:
The NotifyInvoice resource is required to use this API request. It is included in the following access profiles: OMS - Full access and IntegrationProfile - Fulfillment Oms, among other standard roles available in the Admin. If you’d like to learn more, check out Roles.
Also, if you still have any questions on this topic, feel free to ask right here! ![]()
Karina Mota
Field Software Engineer | VTEX
