-
Notifications
You must be signed in to change notification settings - Fork 0
Data Model
sblabreu edited this page May 7, 2020
·
3 revisions
In this document we describe the model for payloads sent from merchants to the public API. This payload represents a cart and contains details about the merchant's client.
An example of this payload is:
{
"merchant_id": "1234",
"cart_id": "9roj8f70TUEU",
"client_address": "0xab96032f5a7Efe3F95622c5B9D98D50F96a91756",
"total_items": 3,
"total_price": "15.00",
"items": [
{
"product_name": "product_1",
"product_id": "1",
"product_price": "5.00"
},
{
"product_name": "product_2",
"product_id": "2",
"product_price": "5.00"
},
{
"product_name": "product_3",
"product_id": "3",
"product_price": "5.00"
}
]
}
The relative JSON Scheme is:
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The Root Schema",
"description": "The root schema comprises the entire JSON document.",
"required": [
"cart_id",
"client_address",
"total_items",
"total_price",
"items"
],
"properties": {
"cart_id": {
"$id": "#/properties/cart_id",
"type": "string",
"title": "The Cart_id Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"9roj8f70TUEU"
]
},
"client_address": {
"$id": "#/properties/client_address",
"type": "string",
"title": "The Client_address Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"0xab96032f5a7Efe3F95622c5B9D98D50F96a91756"
]
},
"total_items": {
"$id": "#/properties/total_items",
"type": "integer",
"title": "The Total_items Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
3
]
},
"total_price": {
"$id": "#/properties/total_price",
"type": "string",
"title": "The Total_price Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"15.00"
]
},
"items": {
"$id": "#/properties/items",
"type": "array",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": [],
"items": {
"$id": "#/properties/items/items",
"type": "object",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{
"product_id": "1",
"product_name": "product_1",
"product_price": "5.00"
},
{
"product_price": "5.00",
"product_id": "2",
"product_name": "product_2"
},
{
"product_id": "3",
"product_name": "product_3",
"product_price": "5.00"
}
],
"required": [
"product_name",
"product_id",
"product_price"
],
"properties": {
"product_name": {
"$id": "#/properties/items/items/properties/product_name",
"type": "string",
"title": "The Product_name Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"product_1"
]
},
"product_id": {
"$id": "#/properties/items/items/properties/product_id",
"type": "string",
"title": "The Product_id Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"1"
]
},
"product_price": {
"$id": "#/properties/items/items/properties/product_price",
"type": "string",
"title": "The Product_price Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"5.00"
]
}
}
}
}
}
}