Skip to main content

Flows

info

The capabilities mentioned on this page must be registered with the EPOS Capabilities API prior to initiating an Order and Pay flow, learn more here.

The following diagram demonstrates how the Order and Pay product will interact with Dojo and the POS system for creating orders and completing payments:

Step-by-step: Order and Pay

Step 1: Customer creates order to Dojo

The first stage of the Order and Pay flow is triggered when a customer, having accessed a list of venue products using the Dojo Order and Pay interface, creates an order by adding one or more items to the basket and advancing to the payment screen.

Step 2: Dojo creates a Payment Intent and authorises the payment

Once the order has been initiated via the Order and Pay interface, Dojo will pre-authorise the payment by creating a Payment Intent and initiating a checkout flow for the customer. This payment is to be captured once the POS has confirmed the order. This also generates a paymentIntentId which will be used to track the payment details, as well as an externalId which represents Dojo's orderId and will need to be referenced on further updates.

Step 3: Dojo creates an order on the POS

POST REST /v1/orders

REQUEST
RESPONSE
WS CreateOrderV1

Main page: Orders

The next step in is for Dojo to create the customer order within the POS, using the CreateOrder capability. The request will contain fields such as item data, type of order and payment details, including the payment intent. It may also contain any additional modifiers or discounts, for example, if specified.

The POS should respond to Dojo with a 200 response to confirm that this has been received.

Step 4: Dojo captures the payment and informs the POS of the payment update

POST REST /v1/events

REQUEST
RESPONSE
WS HandleEventV1

Main page: Dojo Events

Dojo will now capture the pre-authorised payment. Once captured, Dojo will use the HandleEvent capability to inform the POS that an update has been made to the payment.

Step 5: POS checks the Payment Intent

GET GET /paymentIntentId/{paymentIntentId}
Main page: Check payment intent status

As the HandleEvent capability does not confirm payment information, the POS will now need to check the payment intent by using the Dojo API's Retrieve Payment Intent call. The POS can use this call to retrieve the final result of the transaction along with any additional payment and customer information captured. The Payment Intent will also include an externalId matching the Order ID stored by the POS.

Step 6: POS records the payment and updates the order status

POST REST /epos/events
Main page: POS Events

Once the payment has been recorded and the POS has updated its internal order ID, it should make a POST using the Dojo API's events endpoint with an eventType of OrderUpdated.

Step 7: Dojo checks order status and updates customer

GET REST /v1/orders/{orderId}

REQUEST
RESPONSE
WS GetOrderByIdV1

Main page: Orders

Once informed of the order update, Dojo will check the status of the order by calling the Orders capability with a GET request. After confirming the order status, Dojo will inform the customer of the outcome through the Order and Pay interface.