Skip to main content

Purchase flow tutorial

Main concepts

Order

An order is a json object that represents a Onebox transaction.

Order Status

The following diagram shows the order status transitions (from create to confirm). :

Order id and order code

An Order contains two identifiers to take into account:

id: Delivered once an order is created. It must be provided via ob-order-id header to interact with the rest of API calls.

code: This identifier is delivered when an order goes to PRE_CONFIRM status. In case to confirm the order, this attribute will become the unique identifier.

tip

For confirmed orders, you are ready to interact with api-orders with this code identifier

From create to confirm

POST /orders - Create an order

curl --location --request POST 'https://{{api-domain}}/distribution-api/v1/orders' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{access_token}}'

POST /orders/seats - Adding numbered seats

curl --location --request POST 'https://{{api-domain}}/distribution-api/v1/orders/seats' \
--header 'Accept: application/json' \
--header 'ob-order-id: {{id}}' \
--header 'Authorization: Bearer {{access_token}}'
--header 'Content-Type: application/json' \
--data-raw '{
"seats": [{
"id": 0,
"session_id": 0
}
]
}'

POST /orders/seats-auto - Adding not numbered or numbered seats automatically

curl --location --request POST 'https://{{api-domain}}/distribution-api/v1/orders/seats-auto' \
--header 'Accept: application/json' \
--header 'ob-order-id: {{id}}' \
--header 'Authorization: Bearer {{access_token}}'
--header 'Content-Type: application/json' \
--data-raw '{
"price_type_id":0,
"session_id": 0,
"quantity": 1
}'

POST /orders/buyer-data - Buyer data attributes

curl --location --request POST 'https://{{api-domain}}/distribution-api/v1/orders/buyer-data' \
--header 'Accept: application/json' \
--header 'ob-order-id: {{id}}' \
--header 'Authorization: Bearer {{access_token}}'
--header 'Content-Type: application/json' \
--data-raw '{
"email":"email@email.com"
}'

POST /orders/pre-confirm - Pre confirm a BASKET order

curl --location --request POST 'https://{{api-domain}}/distribution-api/v1/orders/pre-confirm' \
--header 'Accept: application/json' \
--header 'ob-order-id: {{id}}' \
--header 'Authorization: Bearer {{access_token}}'
--header 'Content-Type: application/json' \
--data-raw '{}'

POST /orders/confirm - Confirm a PRE_CONFIRM order

curl --location --request POST 'https://{{api-domain}}/distribution-api/v1/orders/confirm' \
--header 'Accept: application/json' \
--header 'ob-order-id: {{id}}' \
--header 'Authorization: Bearer {{access_token}}'
--header 'Content-Type: application/json' \
--data-raw '{}'