This page provides you with information on how to manage your sales.
Index:
Read and search sales
Create and update sales
Delete sales
Read and search sales
Use the following endpoint to search and read the sales we have in the system.
Description | Read and search sales |
HTTP Method | GET |
URL | |
Headers | X-Tenant:
Authorization: Bearer |
Rate limit | 60 requests per minute |
JSON request (example) | none |
JSON response (example) |
|
Paging and filtering (example) |
The paging and filters can be combined.
Filtering:
# Search by email https://api.midway.la/api/consumer/[email protected] # Search by phone https://api.midway.la/api/consumer/sales?phone=+54911xxxxxxxx # Search by store https://api.midway.la/api/consumer/sales?store=tienda01 # Search by source https://api.midway.la/api/consumer/sales?source=vtex # Search by channel https://api.midway.la/api/consumer/sales?channel=online # Search by id https://api.midway.la/api/consumer/sales?sale_id=sale_001 # Search by creation dates. https://api.midway.la/api/consumer/sales?created_at_from=2024-01-01&created_at_to=2024-06-01 Paging:
https://api.midway.la/api/consumer/sales?source=tienda01&sale_id=sale_001&page=2&per_page=250 |
Create and update sales
Use the following endpoint to create and update the sales of your company in our system, we use the parameter “source” + “sale_id” to create in case the combination does not exist and if it does exist it will be updated. You can send many sales in one request.
Descripción | Create and update sales. |
HTTP Method | POST |
URL | |
Headers | X-Tenant:
Authorization: Bearer |
Rate limit | 60 requests per minute |
Max records | 5000 per request |
Reference | See the SalesDTO table below. |
JSON request (example) |
|
JSON response (example) | status code 204 |
Paging and filtering (example) | none |
Delete sales
Use the following endpoint to delete the sales of your company in our system, we use the parameter “source” + “sale_id” to delete. You can send many sales in one request to delete.
Descripción | Delete sales. |
HTTP Method | DELETE |
URL | |
Headers | X-Tenant:
Authorization: Bearer |
Rate limit | 60 requests per minute |
JSON request (example) |
|
JSON response (example) | status code 204 |
Paging and filtering (example) | none |
The parameters that have “*” are required.
SalesDTO
Parameter | Type | Description |
source* | string | The source is from which application the information comes from (vtex, prestashop, system,crm, etc). |
sales* | List <SaleDTO> | The sales field is the list of sales to be uploaded in bulk. |
SaleDTO
Parameter | Type | Description |
sale_id* | string | The sale_id field is the id of the sale in the external system. |
channel* | string | The channel field of the sale need to be online or offline. |
created_at* | string | The date relate to the creation of the sale in UTC (Y-m-d H:i:s eg 2024-10-01 09:00:00). |
updated_at* | string | The date relate to the last updated of the sale in UTC (Y-m-d H:i:s eg 2024-10-01 15:00:00). |
store | string | The store of the sale. |
seller | string | The seller of the sale. |
status* | string | The status field of the sale need to be pending, invoiced, cancelled, refunded or credit_note. |
customer* | CustomerDTO | The customer field is to upload the information relate to the customer like name, email, etc. |
items* | List <ItemDTO> | The items field is to upload the information relate to the items. |
payments* | List <PaymentDTO> | The payments field is to upload the information relate to the payments like the value and the system. |
shippings | ShippingsDTO | The shippings field is to upload the information relate to the shipping like name, adress, city, providence, etc. |
summary* | SummaryDTO | The summary field is to upload the information relate to sale like total items, subtotal, total, discount, tax, etc. |
CustomerDTO
Parameter | Type | Description |
email* | string | The email of the customer. |
firstname | string | The firstname of the customer. |
lastname | string | The lastname of the customer. |
phone | string | The phone of the customer. |
ItemDTO
If you are sending refunded or credit_note information, you must set the values to negative.
Parameter | Type | Description |
id* | string | The id of the product. |
sku* | string | The sku of the product. |
name* | string | The name of the product. |
price* | Float | The final price of the product on the sale. |
quantity* | Integer | The quantity of the product that was bought. |
categories | List | The list of categories that the product belong. |
PaymentDTO
If you are sending refunded or credit_note information, you must set the values to negative.
If you are sending refunded or credit_note information, you must set the values to negative.
Parameter | Type | Description |
name* | string | The name of the system used to charged. |
value* | string | The value of the amount of money charged. |
bin | string | The Bank Identification Number (BIN) of the card used to pay |
bank | string | The name of the bank that issued the card. |
ShippingsDTO
Parameter | Type | Description |
name* | string | The name of the shipping method. |
address* | string | The address of customer. |
city* | string | The city of the address. |
province* | string | The province of the address. |
country* | string | The country of the address. |
trips | integer | The number of trips the sale needs to deliver all the products. |
SummaryDTO
If you are sending refunded or credit_note information, you must set the values to negative.
Parameter | Type | Description |
items* | integer | The total items bought. |
subtotal* | float | The subtotal of the sale. |
tax* | float | The tax of the sale. |
shipping* | float | The cost of shipping of the sale. |
discount* | float | The discount of the sale. |
total* | float | The total of the sale. |
