# Tutorial: Receiving Orders
This page describes the steps necessary to receive sales orders from Peppol using the SalesOrder
endpoint.
# Prerequisite
- Your partyId is registered by us in Peppol with
Order Only
support. If you have sufficient rights you could use the Peppol endpoint to register the partyId in Peppol yourself. Otherwise contact us.
# Step 1: Register hook
To receive the order, you'll need to subscribe to the "OrderReceived" topic. For this example, we are going to use a webhook.
Use the PUT hook API call as shown below. In topics
you can specify for which events you wish to receive a webhook.
Example body:
{
"id": "hook1",
"name": "webhook",
"action": "https://webhook.site/a81a0be5-8aad-4110-a40c-aa41a2c6e9ac#secureKey",
"topics": [
"OrderReceived"
],
"isActive": true
}
More information regarding webhooks can be found on the hooks page.
# Step 2: Receive hooks
Now you can receive order events on your endpoint.
The webhook will look like:
Example webhook body:
{
"topic": "OrderReceived",
"partyId": "{your partyId}",
"hookId": "orderreceived",
"documentId": "fe44b98f-fa53-4578-be74-0d5458777a56",
"message": "'Order' received.",
"details": {
"protocol": "As4",
"returnedMessageId": "fe44b98f-fa53-4578-be74-0d5458777a56@econnect.eu",
"sender": "{sender}",
"accessPoint": "C=NL, O=eConnect International B.V., OU=PEPPOL TEST AP, CN=PNL000052",
"id": "34",
"documentTypeId": "urn:oasis:names:specification:ubl:schema:xsd:Order-2::Order##urn:fdc:peppol.eu:poacc:trns:order:3::2.1",
"profileId": "urn:fdc:peppol.eu:poacc:bis:order_only:3",
"receiver": "{your partyId}",
"messageId": "e5a0e07b-767e-4768-bd01-e787ad61d4f2@econnect.eu",
"refToMessageId": null
},
"createdOn": "2021-12-07T11:00:13.3623791+00:00",
"sentOn": "2021-12-07T11:00:13.5448088+00:00"
}
You should use the documentId
in the sales orders endpoint to download the received order. Eg: GET /api/v1/{your partyId}/salesOrder/fe44b98f-fa53-4578-be74-0d5458777a56/download
.