Introduction
Welcome to Hayde API documentation. This document is designed to provide a comprehensive overview of our API endpoints, and how they may be utilized for efficient and effective interactions with our system.
To use the Hayde API you need the following:
- To obtain the apiKey, individuals or entities are required to send a formal request via email to integrations@hayde.menu. The request should include pertinent information such as the company name, the authorized representative of the company, and a detailed explanation outlining the necessity for accessing the API.
- Base url is: https://socialmediamenus.com/api
- In our api you need to add 'Content-Type': 'application/json' to headers.
- The response will be inside an object that contains a data variable.
Response: {
"data": {
"payload": "some payload",
"status": 200
}
}Authentication
Our system utilizes bearer token authentication. This ensures a secure communication process within our system. Please ensure to include your token in the header of each request to authenticate. Failure to do so will result in an error and your request will not be processed. Once you generated a token it will be valid for 1 hour until expired.
Initial session
In order to initiate a session and acquire an authorization token, individuals must utilize the endpoint /authorize. Upon submitting a POST request to this endpoint, it is imperative to include the apiKey field with the provided API key for authentication purposes.
The resulting response will furnish the authorization token necessary for subsequent interactions.
POST /authorize {
"data": {
"apiKey": "your_api_key_here"
}
}
Response: {
"token": "your_authorization_token"
}Use session token
Once you have obtained the authorization token, include it in the header of all your API requests to authenticate and access resources.
headers: {
"Content-Type": "application/json"
"Authorization": "Bearer your_authorization_token"
}Payments
- Create Order
- Collect Payment Information:
- Authenticated Users
- Unauthenticated Users
- Receive Payment Status Update
Create Order
When a customer requests to create an order, an Order object is created with a 'pending' status. The Order object represents an order that has not yet been paid. The status of the order will remain 'pending' until a webhook triggers an endpoint. The Point of Sale (POS) system can be chosen in the Back Office of the place. The items in the order contain only items from the cashier, who is also selected in the Back Office. We will create the order according to the POS system requirements. If there are any tasks that need to be completed beforehand, they will be handled in this step.
Authenticated user flow
- Authenticated user - Payment information is collected through the authenticated users saved payment methods. If the card is already tokenized, the backend will complete the order intent by calling the selected POS system to bill the customer. This involves calling the endpoint provided by the 3rd party payment integrator.
Unauthenticated user flow
- We ask from the customer an email address (which will we send the receipt to), name, we will create the id of the customer and saved it as anonymous in the browser level.
- Unauthenticated user/Card not tokenized yet - we will open an Iframe for the client to submit is payment information, this way we stand in the PCI complience.
Receive Payment Status Update
After a payment action completed or rejected or an error, the POS system should update our backend through a post request to /webhook/updateOrder, with the updated status, the request field are as follows:
POST /webhook/updateOrder {
"data": {
"status": success, error, reject - "Status of the payment, this can only be changed once"
"orderId": string - "Id"
"message": string - "In case of reject/error this will be what will be displayed to the user (optional)"
}
}Once the payment is complete, the order is sent directly to the cashier system.
