Ticket buy

From BetgamesTV
Jump to navigation Jump to search

Method for buying tickets.

"bets" is an array of "bet" objects. Each bet should have 4 fields:

  • "odd_code" - the code of odd to place bet on.
  • "odd_value" - current value of an odd.
  • "amount" - amount of the bet.
  • "items" - an array of item numbers, or false. Depends on odd. When odd requires some items to be selected, then this array should contain exact number of items.

Returns ticket barcode and individual bets information if succeeded. Otherwise returns an array of error strings. Bet information contains some data, which could be printed on ticket:

  • "draw_code" - code number of the draw, for which the bet was accepted.
  • "draw_time" - Unix timestamp of the draw start time.
  • "draw_round_name" - name of the round, for live games only.

Request example:

{
  "partner_id": 1424,
  "method": "ticket_buy",
  "language": "ru",
  "timestamp": 1425390869,
  "signature": "4e4c293148af9301c82d3b5bf1068b969819880a8e279d76a7dcb09de7440cff",
  "params": {
    "shop_id": 234,
    "currency": "eur",
    "bets": [
      {
        "odd_code": 701,
        "odd_value": 5.7,
        "amount": 1,
        "items": [
          1
        ]
      },
      {
        "odd_code": 701,
        "odd_value": 5.7,
        "amount": 1,
        "items": [
          1
        ]
      }
    ]
  }
}

Response example:

{
  "partner_id": 1424,
  "method": "ticket_buy",
  "language": "ru",
  "timestamp": 1428501755,
  "signature": "25f4ab6428d76c16de51237bf490ecd85bf89f7bf4f103ec9cc88b9d3f042692",
  "params": {
    "shop_id": 234,
    "currency": "eur",
    "bets": [
      {
        "odd_code": 701,
        "odd_value": 5.7,
        "amount": 1,
        "items": [
          1
        ]
      },
      {
        "odd_code": 701,
        "odd_value": 5.7,
        "amount": 1,
        "items": [
          1
        ]
      }
    ]
  },
  "response": {
    "barcode": "150408528456",
    "errors": false,
    "bets": [
      {
        "draw_code": "71504080122",
        "draw_time": 1428501900,
        "draw_round_name": ""
      },
      {
        "draw_code": "71504080122",
        "draw_time": 1428501900,
        "draw_round_name": ""
      }
    ]
  },
  "response_code": 200,
  "error_message": false
}

Error Response example:

{
  "partner_id": 1424,
  "method": "ticket_buy",
  "language": "ru",
  "timestamp": 1428501919,
  "signature": "078b3acf5fc4042fc046d25194f23b63bba40a0af82ed6d6adfbe01f327a3ee6",
  "params": {
    "shop_id": 234,
    "currency": "eur",
    "bets": [
      {
        "odd_code": 701,
        "odd_value": 5.7,
        "amount": 1,
        "items": [
          1
        ]
      },
      {
        "odd_code": 701,
        "odd_value": 5.7,
        "amount": 1,
        "items": [
          1
        ]
      }
    ]
  },
  "response": {
    "barcode": false,
    "errors": [
      "1. Тираж уже начался.",
      "2. Тираж уже начался."
    ],
    "bets": []
  },
  "response_code": 200,
  "error_message": false
}