Cancel an order (Order Cancellation)

Cancel an existing order via the API: endpoint, flow and supplier response.

An order that has already been sent can be cancelled by the buyer via an Order Cancellation. The supplier receives the cancellation and can accept or reject it. Order Cancellations are part of the Peppol Advanced Ordering profile.

Endpoint
POST /api/v1/{partyId}/purchaseOrder/{documentId}/cancel

The {partyId} is the Peppol identifier of the buyer. The {documentId} is the ID of the original order you want to cancel. This is the document ID you received when the order was sent.

Note: A cancellation is a request, not a guarantee. The supplier can reject the cancellation, for example if the order is already in production. The cancellation is only final after receiving an Order Response with status code AP (accepted).

Flow
  1. Buyer sends a cancellation request via the cancel endpoint
  2. Supplier receives the cancellation via the OrderCancellationReceived webhook
  3. Supplier assesses whether the cancellation can be carried out
  4. Supplier sends an Order Response back: AP (accepted) or RE (rejected)
  5. Buyer receives the response via the OrderResponseReceived webhook
Receiving as a supplier

Set up a webhook on the OrderCancellationReceived topic:

{
  "action": "https://jouw-endpoint.nl/order-cancellations",
  "topics": ["OrderCancellationReceived"],
  "secret": "jouw-geheime-sleutel"
}

Download the cancellation document to review the reason for cancellation:

GET /api/v1/{partyId}/salesOrder/{documentId}/download
Webhook topics
TopicDirectionWhenOrderCancellationSentBuyerCancellation has been successfully deliveredOrderCancellationReceivedSupplierCancellation has been receivedOrderResponseReceivedBuyerSupplier has responded to the cancellationOrderResponseSentSupplierResponse to the cancellation has been sent
Responding to a cancellation

As a supplier, you respond to a cancellation via the Order Response endpoint. The relevant status codes are:

CodeMeaningAPCancellation accepted, order will not be fulfilledRECancellation rejected, order remains active
Frequently asked questions
Which `documentId` do I use in the cancel endpoint?

Use the document ID of the original order that you received from the PSB when sending (POST .../purchaseOrder/send). The path is POST /api/v1/{partyId}/purchaseOrder/{documentId}/cancel, where {partyId} is the Peppol identifier of the buyer.

Is a cancellation immediately final once the request succeeds?

No. A cancellation is a request. The supplier can reject it, for example if the order is already being fulfilled. Only when you receive an Order Response with code AP is the cancellation accepted according to the flow.

How does Order Cancellation fit into the Advanced Ordering profile?

Order Cancellation is part of Advanced Ordering: the supplier receives OrderCancellationReceived, can download the cancellation document and responds via Order Response with AP (accepted) or RE (rejected). The buyer follows the result via, among others, OrderResponseReceived.


View the full API specification at psb.econnect.eu for the exact request and response structure.

Try it in the API