Orders
Description
This API is used to verify a token from a third-party service to allow a user to order a drink from the machine. If the verification is successful, the machine will dispense the drink. If the verification is unsuccessful, the machine will display the returned error message from the third-party service.
User Flow
- User orders a drink on the machine.
- User is prompted to scan QR Code / bardcode.
- User scans third-party provided QR Code / barcode with machine QR code reader.
- Machine will make a call to third-party specified callback URL to verify the token.
- If token is valid, machine will dispense the drink. If not, machine will display the returned error from third-party.
Request Template
Callback URL: POST https://api.example.com/orders (opens in a new tab)
{
"token": "1234567890",
"order": {
"id": "order-1",
"flavor": "apple",
"infusions": ["lCarnitine", "caffeine"],
"volume": 330,
"price": 40,
"currency": "ntd",
"createdAt": "2023-09-01T00:00:00Z",
"machine": "machine-1",
"organization": "organization-1",
}
}Notes:
- Volume is in mL
Third-party provided success response
HTTP Code: 200
{
"status": "success",
"message": "Order successfully placed",
}Third-party provided error response
HTTP Code: 400
{
"status": "error",
"message": "Payment not succcesful",
}