{
  "info": {
    "_postman_id": "8d1fe0bd-fdfb-5504-ad9f-82010930df2d",
    "name": "Monato · Lottery",
    "description": "Monato's Lottery API 1.0.0. Generated from `products/lottery/lottery-openapi.yaml`.\n\nSelect the Monato Sandbox environment and fill in your credentials, then send any request.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Retrieve current lottery draw information",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{finBaseUrl}}/api/v1/lottery_tickets/new?payee_id=550e8400-e29b-41d4-a716-446655440000",
          "host": [
            "{{finBaseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "lottery_tickets",
            "new"
          ],
          "query": [
            {
              "key": "payee_id",
              "value": "550e8400-e29b-41d4-a716-446655440000",
              "description": "Unique identifier of the lottery service (it will be provided by Monato).\nMust be a valid UUID v4 format.",
              "disabled": false
            }
          ]
        },
        "description": "Returns the active/current lottery draw information. \n\n**This is the first step required before purchasing a lottery ticket.**\n\nThe response includes:\n- Current draw number and date\n- Pricing information (base price, rematch, second rematch) in cents\n- Sales period (begin_sales, end_sales) in HH:MM:SS format\n- Board limits (minimum_number_of_boards, maximum_number_of_boards)\n\n**Implementation Notes:**\n- Use the `draw_number` from the response in the purchase request\n- Validate `combination_count` against `minimum_number_of_boards` and `maximum_number_of_boards`\n- Use pricing information to calculate `total_amount` for purchase\n- All prices are in cents (e.g., 1500 = $15.00 MXN)",
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{finAccessToken}}",
              "type": "string"
            }
          ]
        }
      },
      "response": [
        {
          "name": "200 example-1",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets/new?payee_id=550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets",
                "new"
              ],
              "query": [
                {
                  "key": "payee_id",
                  "value": "550e8400-e29b-41d4-a716-446655440000",
                  "description": "Unique identifier of the lottery service (it will be provided by Monato).\nMust be a valid UUID v4 format.",
                  "disabled": false
                }
              ]
            }
          },
          "code": 200,
          "status": "Current lottery draw successfully retrieved",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"draw_number\": \"7327\",\n  \"draw_date\": \"13/01/2026\",\n  \"base_price\": 1500,\n  \"min_price\": 1500,\n  \"max_price\": 3780000,\n  \"rematch\": 1000,\n  \"second_rematch\": 500,\n  \"begin_sales\": \"08:00:00\",\n  \"end_sales\": \"23:59:59\",\n  \"minimum_number_of_boards\": 1,\n  \"maximum_number_of_boards\": 6\n}"
        },
        {
          "name": "401 unauthorized",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets/new?payee_id=550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets",
                "new"
              ],
              "query": [
                {
                  "key": "payee_id",
                  "value": "550e8400-e29b-41d4-a716-446655440000",
                  "description": "Unique identifier of the lottery service (it will be provided by Monato).\nMust be a valid UUID v4 format.",
                  "disabled": false
                }
              ]
            }
          },
          "code": 401,
          "status": "Authentication failed",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"errors\": [\n    \"Access denied\"\n  ]\n}"
        },
        {
          "name": "422 invalid-input",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets/new?payee_id=550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets",
                "new"
              ],
              "query": [
                {
                  "key": "payee_id",
                  "value": "550e8400-e29b-41d4-a716-446655440000",
                  "description": "Unique identifier of the lottery service (it will be provided by Monato).\nMust be a valid UUID v4 format.",
                  "disabled": false
                }
              ]
            }
          },
          "code": 422,
          "status": "Invalid input or company not found",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"error\": \"Invalid input\"\n}"
        },
        {
          "name": "422 company-not-found",
          "originalRequest": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets/new?payee_id=550e8400-e29b-41d4-a716-446655440000",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets",
                "new"
              ],
              "query": [
                {
                  "key": "payee_id",
                  "value": "550e8400-e29b-41d4-a716-446655440000",
                  "description": "Unique identifier of the lottery service (it will be provided by Monato).\nMust be a valid UUID v4 format.",
                  "disabled": false
                }
              ]
            }
          },
          "code": 422,
          "status": "Invalid input or company not found",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"error\": \"Company not found\"\n}"
        }
      ]
    },
    {
      "name": "Purchase a lottery ticket",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{finBaseUrl}}/api/v1/lottery_tickets",
          "host": [
            "{{finBaseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "lottery_tickets"
          ]
        },
        "description": "Creates a lottery ticket purchase for a specific draw. The system processes the bet payment.\n\n**Prerequisites:**\n- Must call `/api/v1/lottery_tickets/new` first to get current draw information\n- Use `draw_number` from the draw info response\n- Validate `combination_count` against draw info limits\n\n**Betting Rules:**\n- A ticket can have minimum 1 bet (board/combination) and maximum 6 bets\n- Each bet costs the `base_price` from draw info (in cents, e.g., 1500 = $15.00 MXN)\n- Rematch option adds `rematch` price per bet (in cents, e.g., 1000 = $10.00 MXN per bet)\n- Second rematch option adds `second_rematch` price per bet (in cents, e.g., 500 = $5.00 MXN per bet)\n- Second rematch **requires** rematch to be enabled\n\n**Price Calculation:**\n```\ntotal = base_price * combination_count\nIF rematch: total += rematch * combination_count\nIF second_rematch AND rematch: total += second_rematch * combination_count\ntotal_amount = STRING(total)  // Must be string representation of integer in cents\n```\n\n**Implementation Notes:**\n- `total_amount` must match the calculated price based on draw info\n- `payer_reference` must be unique per transaction (use UUID or timestamp-based ID)\n- Store `receipt` information for ticket validation and customer records\n- `security_number` is used for anti-fraud validation",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"payee_id\": \"9432e22b-7e41-4c9e-8d59-9a73e9532342\",\n  \"payer_reference\": \"1234567890\",\n  \"ticket\": {\n    \"draw_number\": \"4294\",\n    \"combination_count\": 5,\n    \"rematch\": true,\n    \"second_rematch\": true,\n    \"total_amount\": \"15000\"\n  },\n  \"branch\": {\n    \"name\": \"Test Branch\",\n    \"city\": \"Test City\",\n    \"street\": \"Test Street\",\n    \"neighborhood\": \"Test Neighborhood\"\n  }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{finAccessToken}}",
              "type": "string"
            }
          ]
        }
      },
      "response": [
        {
          "name": "200 example-1",
          "originalRequest": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets"
              ]
            }
          },
          "code": 200,
          "status": "Lottery ticket successfully purchased",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"client_id\": 123,\n  \"ticket\": {\n    \"rematch\": true,\n    \"second_rematch\": true,\n    \"draw_number\": \"1234\",\n    \"total_amount\": \"10000\",\n    \"combination_count\": 5\n  },\n  \"branch\": {\n    \"city\": \"Ciudad de Mexico\",\n    \"name\": \"Abarrotes Don Pepe\",\n    \"street\": \"Av. Insurgentes Sur 1234\",\n    \"neighborhood\": \"Del Valle\"\n  },\n  \"status\": \"processed\",\n  \"payment\": {\n    \"id\": \"f9e8d7c6-b5a4-3210-fedc-ba0987654321\",\n    \"payer_account\": \"1234567890\",\n    \"payee_id\": \"9432e22b-7e41-4c9e-8d59-9a73e9532342\",\n    \"amount\": 100,\n    \"currency\": \"MXN\",\n    \"status\": \"completed\",\n    \"pay_type\": \"gambling\"\n  },\n  \"receipt\": {\n    \"combination_numbers\": \"10,27,36,41,52,56\",\n    \"transaction_date\": \"22/12/2025 20:19:57\",\n    \"store_id\": \"26226\",\n    \"pos_id\": \"1\",\n    \"foreign_pos_id\": \"1\",\n    \"transaction_number\": \"432930881\",\n    \"reference_number\": \"801500019-35600002\",\n    \"session_id\": \"80150001900\",\n    \"security_number\": \"HQTNM5-HY9YF%-QS5NZ4-Q8&Z4&-HMJ#8\",\n    \"serial_number\": \"4815-052713529-200818\",\n    \"creation_date\": 1769621353354,\n    \"ticket_image\": \"iVBORw0KGgoAAAANSUhEUgAAAAUA...\"\n  }\n}"
        },
        {
          "name": "401 unauthorized",
          "originalRequest": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets"
              ]
            }
          },
          "code": 401,
          "status": "Authentication failed",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"errors\": [\n    \"Access denied\"\n  ]\n}"
        },
        {
          "name": "422 invalid-input",
          "originalRequest": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets"
              ]
            }
          },
          "code": 422,
          "status": "Invalid input or company not found",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"error\": \"Invalid input\"\n}"
        },
        {
          "name": "422 company-not-found",
          "originalRequest": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{finBaseUrl}}/api/v1/lottery_tickets",
              "host": [
                "{{finBaseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "lottery_tickets"
              ]
            }
          },
          "code": 422,
          "status": "Invalid input or company not found",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "_postman_previewlanguage": "json",
          "body": "{\n  \"error\": \"Company not found\"\n}"
        }
      ]
    }
  ]
}
