Preliminary Actions
First and foremost you must provide the IP address of the origin server Example:
UniversalDomain=HTTP://[Link]/
IP=[Link]
Check available currencies and get the id of each currency
POST HTTP: // [universalDomain] /bet_api.php
Body Params: {
accion: 'monedas_API'
}
Response:
{
id: numeric, -> necessary to create the user
abre: string, -> Currency abbreviation
moneda: string, -> name or description of the currency
pais, -> country to which the currency belongs,
simbolo, -> symbol or currency identifier
cod_pais -> country code
}
Create User
It is necessary to create the user, before performing any operation
POST https: // [universalDomain] /bet_api.php
Body Params: {
accion: 'API_crear_usuario',
user_n: string (20), -> user name or nick
nombre: string (20), name of user
pais: int (international telephone number, ex: 58 Venezuela, 51 Peru)
moneda: integer
ID: string (50) UPPERCASE (It is a unique number or password for each user, it must contain at least 15 alphanumeric
characters)
}
// The user was created
Response:
{
resp: 'OK',
id: numeric,
msg: 'User Created'
}
// If the User already exist
{
resp: 'err',
id: integer, (1 = User exist) (3 = IP Not registered)
msg: string ("User already exists") (IP not found)
}
Log in
start session
POST https: // [universalDomain] / betapi / bet_api.php
Body Params: {
accion: 'API_Login',
user_n: string (20), -> user name or nick
id: string (50) (Id or password with which user created)
}
Response:
Affirmative answer
{
resp: 'OK',
token: string,
}
// Open the link:
token = is the token provided at login
balance = is the current balance of the customer
*** The link must open inside an iframe otherwise it will show a blank page
[Link]
// Make a Bet
// When the player makes a bet, a request is made to the (cliente_Api)
POST https: // [yourserver_ip] / [you_end_point]
Body Params {
accion: 'venta_tck_API',
token: string,
id_tran: string,
monto: float ->amount
}
Response:
Negative (The player has no Balance)
{
resp: 'fo',
id: 'fo',
msg: string (* Reason for rejection)
}
//Affirmative
{
resp: 'ok',
balance: float, // The current balance of the client
saldo: float, // The Balance you had before making the bet
idtx: string // unique identifier or Id of the process by the API client for its control, this Value will be returned to the api client
to complete the process * OPTIONAL
}
// When the answer is affirmative, the BET made is saved and the Api client is informed of the culmination of the process
POST https: // [yourserver_ip] / [you_end_point]
Body Params {
action: 'final_tck_API',
serial: string,
monto: float total amount
id_tran: string,
hora: format unix or epoch datetime
id_us = numeric
idtx: string (the idtx provided by the client)
}
Response:
{
resp:'ok',
serial:string,
idtx:string,
id_us: numeric
}
Notification Change of Ticket Status
// 1.0 Notification is sent to the End Point that it has new tickets
GET https: // [yourserver_ip] / [you_end_point]? accion = status_tck & id = XXXXXXXXXXXXX
// 1.1 The API client must make a Request to the server
POST https: // [universalDomain] / betapi / bet_api.php
Body Params: {
accion: "status_tck_API",
id_operacion: id (The id that was sent in step 1.0)
}
Response:
Affirmative answer
{
resp: 'OK',
data:[
{
id: Numeric,
id_us: numeric, (UniversalHorse User Id)
monto: float,
estatus: Character ("G" Winner, "D" Return Play, "A" Void),
fecha: numeric (Unix or Epoch format),
serial: string (Serial of the ticket)
}
]
}
// 1.2 The API client confirms the reception
POST [Link] betapi/bet_api.php Body Params: { accion:"confirma_status_API", id_operacion:id (The id
that was sent in step 1.0 ) }
Response: { resp:'ok', id:numeric,
msg:'Confirmed' }
View Ticket Details
POST https: // [universalDomain] /betapi/bet_api.php
Body Params: {
accion: "ver_ticket_API",
serial: string
}
Response:
{
resp: 'ok',
serial: string,
total: float
moneda: int currency
tck: [{
apuesta: character, ("w" win, "p" place, "s" show, "ex" exact, "tr" trifecta, "su" superfect, "Pk2" Pick2, "Pk3" Pick3
pista: string, id of track
monto: float, amount
tipo_estatus: character ("G" Winner, "P" Lost, "D" Return, "A" Void, "J" In play) status type
dividendo: float ("If it is an SP bet, or Fixed Dividend),
carrera: integer, race
caballo: string (Horse or Horses involved in the bet)
}]
}
### Types of currencies available
POST https: // [universalDomain] /betapi/bet_api.php Body Params: {action: "coins_API"}
Response: [{id: integer, Open currency id: string, Abbreviation of the currency mode: string, Description of the currency type
symbol: string Symbol that represents the currency country: string Country abbreviation country code: numeric country code
according to the international telephone code}]
Additional Information on the Placement of the Bet
The Api client is the one who validates whether or not the player has the balance to make the Bet.
The consultation and completion of the Bet is done in two steps:
1.- A call is made to the client's endpoint with the amount of the Bet to validate if it has enough balance for the Bet.
2.- If so, the tck is saved and another request is sent to the end point to confirm that the tck was generated.
//Answer
// The response time by the client must be less than 1.5 seconds, otherwise the bet is canceled
// It must return whether or not the client has a balance to execute or complete the bet.
// The validation process of whether the client that makes the bet has a balance or not, remains on the part of the client_api
// POST request to the client's end point
action = "venta_tck_API" // Action to be executed
id_tran = "XXXXXXXXXXX" // Unique Id of the UniversalHorse
monto = 0000000000 // Total amount of the bet
// Responses to be provided by the client_API
// Affirmative Response json (The client has a balance, The API client should have already discounted the balance)
"resp": "ok" // The client has a balance to make the bet
"balance": "" // The current balance of the client
"saldo_ant": "" // The Balance I had before making the bet
"idtx": "alkks87238493" // Unique identifier or Id of the process by the API client for its control, this Value will be returned to
the api client to complete the process * OPTIONAL
// If affirmative, the tck is saved and the confirmation response is sent to the client by API
// POST request to the client's end point
accion = "final_tck_API" // The action being taken or function
serial = "XXXXXXXXX" // The unique Serial of each tck
monto = 0000000.00 // The total tck
id_tran = "XXXXX" // Id of the transaction or id_tck of UniversalHorse sent in the previous query
thora = 1234567899 // The time in UNIX or epoch format
id_us = 0000000 // The Id of the user registered in UniversalHorse
idtx = "XXXXXXXXX" // The ID sent by the API client for its control
// JSON Confirmation Response
"resp": "ok"
"serial":""
"idtx": ""
"id_us": ""
// Negative Response or No json balance
"resp": "fo" // fo the customer does not have enough balance
"Id": "fo" // The id or identifier of the error is fo
"msg": "Insufficient Balance" // It is optional, you can send any text
// When the answer is negative, the tck is not saved and the bet is canceled, no confirmation is sent