Docs

Lottery · Get started

Lottery quickstart

Get the active draw, calculate the price and buy your first lottery ticket.

This guide takes you from credentials to your first ticket in two calls.

Before you start

  • Access token. A Bearer token, from the Monato support team.
  • Payee ID. Your lottery service identifier, a UUID v4 provided by Monato.
  • Base URL. The examples use https://dev-api.finco.lat. Contact support for the URL of each environment.

Send your token on every request:

HTTP
Authorization: Bearer YOUR_ACCESS_TOKEN

1. Get the active draw

curl -X GET "https://dev-api.finco.lat/api/v1/lottery_tickets/new?payee_id=550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

You need draw_number, the prices and the board limits for the next step. Prices are in cents: 1500 is $15.00 MXN.

2. Calculate the total

Price calculation
let total = base_price * combination_count;
if (rematch) {
  total += rematch * combination_count;
}
if (second_rematch && rematch) {
  total += second_rematch * combination_count;
}
// Amounts must be strings
const total_amount = String(total);

With 5 combinations, rematch and second rematch: (1500 + 1000 + 500) × 5 = 15000 cents, or $150.00 MXN. Send "15000".

3. Buy the ticket

curl -X POST "https://dev-api.finco.lat/api/v1/lottery_tickets" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "payee_id": "550e8400-e29b-41d4-a716-446655440000",
    "payer_reference": "1234567890",
    "ticket": {
      "draw_number": "7327",
      "combination_count": 5,
      "rematch": true,
      "second_rematch": true,
      "total_amount": "15000"
    },
    "branch": {
      "name": "Abarrotes Don Pepe",
      "city": "Ciudad de México",
      "street": "Av. Insurgentes Sur 1234",
      "neighborhood": "Del Valle"
    }
  }'

The response includes the ticket, the payment and the receipt. See Buy a ticket for the full response.

Warning:

Store the receipt, especially the security_number. You need it for ticket validation and customer records.

Next steps