App de Logística para entregas

Bom dia.
Estou analisando a documentação das APIs para desenvolvimento de um app público. O app vai oferecer a cotação de frete durante o processo de venda e depois vai receber a solicitação de entrega via webhook. Depois vai buscar os dados do pedido e os dados da Nota Fiscal, para gerar o CTe de entrega ao cliente.
Não encontrei na documentação o que vou receber na notificação do webhook FULFILLMENTS_CREATE.
Além disso, depois que recebo a notificação nesse webhook, quais APIs devo utilizar para obter os dados do pedido e da nota fiscal?

Por favor, alguém saberia informar o que é retornado para o webhook quando um pedido de entrega é criado? Com base no que é retornado no webhook, quais APIs devo utilizar para obter os dados do pedido e da Nota Fiscal?

Desde já, agradeço.

Hi @Cesar_Antonio_Segate! The fulfillments/create webhook payload is documented in the webhook reference under the fulfillments section. It returns a serialized Fulfillment resource including id, order_id, status, tracking_company, shipment_status, destination (full shipping address), line_items, and more.

The key field for your workflow is order_id. Note that the webhook returns a numeric ID, so if you’re using the GraphQL Admin API you’ll need to construct the GID yourself (gid://shopify/Order/{order_id}). From there, the order query gives you everything you need (line items, financial details, shipping address, etc.).

For the shipping rate quoting part of your app, you’ll want to use the CarrierService API. You register a callback URL, and Shopify sends your endpoint a POST request at checkout with the origin address, destination address, and item details. Your app responds with a JSON object containing a rates array of available shipping options (each with service_name, service_code, total_price, currency, etc.). Note that the store needs to be on the Advanced plan or higher, the Shopify plan with yearly billing or the carrier service feature added as a monthly add-on, or a development store.

Regarding Nota Fiscal and CTe, Shopify doesn’t have a native resource for Brazilian tax documents. That data would need to come from an external tax compliance service, or you could store references in order metafields. This is a common pattern for logistics apps in Brazil.

I hope this helps point you in the right diretcion!

Thank you very much for your return, Donal. It helped a lot.

1 Like