{
  "id": "Sale",
  "type": "object",
  "required": [ "id", "attributes", "type" ],
  "properties": {
    "type": {
      "type": "string",
      "constant": "sale"
    },
    "id": {
      "type": "string",
      "minLength": 1
    },
    "attributes": {
      "type": "object",
      "properties": {
        "create_time": {
          "type": "integer"
        },
        "update_time": {
          "type": "integer"
        },
        "state": {
          "type": "string",
          "enum": ["created", "approved", "failed", "canceled", "expired", "pending"]
        },
        "payer": {
          "type": "object",
          "properties": {
            "payment_method": {
              "type": "string"
            },
            "payer_info": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string"
                },
                "first_name": {
                  "type": "string"
                },
                "last_name": {
                  "type": "string"
                },
                "payer_id": {
                  "type": "string"
                },
                "shipping_address": {
                  "type": "object"
                }
              }
            }
          }
        },
        "transactions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "details": {
                    "type": "object"
                  }
                }
              },
              "item_list": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["name"],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "price": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            },
            "related_resources": {
              "type": "object",
              "properties": {
                "sale": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "payment_mode": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "protection_eligibility": {
                      "type": "string"
                    },
                    "transaction_fee": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        }
                      }
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "links": {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      }
    }
  }
}
