> For the complete documentation index, see [llms.txt](https://docs.sportradar.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sportradar.com/transaction30api/sandbox/user-manual/alt_stake.md).

# alt\_stake

**Goal:** Two-step **alt-stake** flow for **`customer_alt_stake`** on **`sr:match:15050881`**.

{% stepper %}
{% step %}

## Step 1: Submit without a reference

Create a UF decimal single with a cash stake for the `customer_alt_stake` end customer.

Do **not** set `context.ref`.

Expect a rejected response with code `-713`, message `Liability limit exceeded`, and an alt-stake suggestion for cash stake `950` EUR.
{% endstep %}

{% step %}

## Step 2: Submit with an alt-stake reference

Rebuild the ticket using the same customer and event. A new `ticketId` is fine.

Set `TicketContext.setRef(TicketRef.newAltStakeTicketRefBuilder()...)` using the prior ticket ID and signature. The sandbox accepts any non-empty demo values.

Expect an accepted response.
{% endstep %}
{% endstepper %}

## How to build the request (Java SDK)

```java
import com.sportradar.mbs.sdk.entities.channel.Channel;
import com.sportradar.mbs.sdk.entities.common.AcceptanceStatus;
import com.sportradar.mbs.sdk.entities.common.Bet;
import com.sportradar.mbs.sdk.entities.common.EndCustomer;
import com.sportradar.mbs.sdk.entities.common.TicketContext;
import com.sportradar.mbs.sdk.entities.odds.Odds;
import com.sportradar.mbs.sdk.entities.request.TicketRequest;
import com.sportradar.mbs.sdk.entities.response.TicketResponse;
import com.sportradar.mbs.sdk.entities.selection.Selection;
import com.sportradar.mbs.sdk.entities.stake.Stake;
import java.math.BigDecimal;
import com.sportradar.mbs.sdk.entities.ref.TicketRef;

// --- Step 1: no ref ---
TicketRequest step1 = TicketRequest.newBuilder()
    .setTicketId("tid-alt-stake-1")
    .setContext(TicketContext.newBuilder()
        .setLimitId(123L)
        .setChannel(Channel.newMobileChannelBuilder()
            .setLang("en")
            .setIp("127.0.0.1")
            .setDeviceId("deviceId123")
            .build())
        .setEndCustomer(EndCustomer.newBuilder().setId("customer_alt_stake").build())
        .build())
    .setBets(Bet.newBuilder()
        .setBetId("bet-1")
        .setSelections(Selection.newUfSelectionBuilder()
            .setProductId("3").setEventId("sr:match:15050881")
            .setMarketId("m1").setOutcomeId("o1")
            .setOdds(Odds.newDecimalOddsBuilder().setValue(new BigDecimal("2.0")).build())
            .build())
        .setStake(Stake.newCashStakeBuilder().setAmount(new BigDecimal("10")).setCurrency("EUR").build())
        .build())
    .build();
TicketResponse r1 = mbsSdk.getTicketProtocol().sendTicket(step1);
// REJECTED, code -713; betDetails[0].getSuggestion() is alt-stake cash 950 EUR

// --- Step 2: alt-stake ref ---
TicketRequest step2 = TicketRequest.newBuilder()
    .setTicketId("tid-alt-stake-2")
    .setContext(TicketContext.newBuilder()
        .setLimitId(123L)
        .setChannel(Channel.newMobileChannelBuilder()
            .setLang("en")
            .setIp("127.0.0.1")
            .setDeviceId("deviceId123")
            .build())
        .setEndCustomer(EndCustomer.newBuilder().setId("customer_alt_stake").build())
        .setRef(TicketRef.newAltStakeTicketRefBuilder()
            .setTicketId("tid-alt-stake-1")
            .setTicketSignature("sandbox-signature")
            .build())
        .build())
    .setBets(Bet.newBuilder()
        .setBetId("bet-1")
        .setSelections(Selection.newUfSelectionBuilder()
            .setProductId("3").setEventId("sr:match:15050881")
            .setMarketId("m1").setOutcomeId("o1")
            .setOdds(Odds.newDecimalOddsBuilder().setValue(new BigDecimal("2.0")).build())
            .build())
        .setStake(Stake.newCashStakeBuilder().setAmount(new BigDecimal("950")).setCurrency("EUR").build())
        .build())
    .build();
TicketResponse r2 = mbsSdk.getTicketProtocol().sendTicket(step2);
// ACCEPTED, code 0
```

## Wire JSON — Step 1 (no ref)

```json
{
  "operatorId": 9985,
  "correlationId": "corr-1",
  "timestampUtc": 1710000000000,
  "operation": "ticket-placement",
  "version": "3.0",
  "content": {
    "type": "ticket",
    "ticketId": "tid-alt-stake-1",
    "context": {
      "limitId": 123,
      "channel": {
        "type": "mobile",
        "lang": "en",
        "ip": "127.0.0.1",
        "deviceId": "deviceId123"
      },
      "endCustomer": { "id": "customer_alt_stake" }
    },
    "bets": [{
      "betId": "bet-1",
      "selections": [{
        "type": "uf",
        "eventId": "sr:match:15050881",
        "marketId": "m1",
        "outcomeId": "o1",
        "productId": "3",
        "odds": { "type": "decimal", "value": "2.0" }
      }],
      "stake": [{ "type": "cash", "amount": "10", "currency": "EUR" }]
    }]
  }
}
```

## Wire JSON — Step 2 (alt-stake ref)

```json
{
  "operatorId": 9985,
  "correlationId": "corr-2",
  "timestampUtc": 1710000002000,
  "operation": "ticket-placement",
  "version": "3.0",
  "content": {
    "type": "ticket",
    "ticketId": "tid-alt-stake-2",
    "context": {
      "limitId": 123,
      "channel": {
        "type": "mobile",
        "lang": "en",
        "ip": "127.0.0.1",
        "deviceId": "deviceId123"
      },
      "endCustomer": { "id": "customer_alt_stake" },
      "ref": {
        "type": "alt-stake",
        "ticketId": "tid-alt-stake-1",
        "ticketSignature": "sandbox-signature"
      }
    },
    "bets": [{
      "betId": "bet-1",
      "selections": [{
        "type": "uf",
        "eventId": "sr:match:15050881",
        "marketId": "m1",
        "outcomeId": "o1",
        "productId": "3",
        "odds": { "type": "decimal", "value": "2.0" }
      }],
      "stake": [{ "type": "cash", "amount": "950", "currency": "EUR" }]
    }]
  }
}
```

| Field name                            | Value                                        | Mandatory / Optional          | Data type       | Ignored by sandbox   |
| ------------------------------------- | -------------------------------------------- | ----------------------------- | --------------- | -------------------- |
| `operatorId`                          | `9985`                                       | Mandatory                     | integer         | Yes                  |
| `correlationId`                       | `"corr-1"`                                   | Mandatory                     | string          | No (echoed in reply) |
| `timestampUtc`                        | `1710000000000`                              | Mandatory                     | integer         | Yes                  |
| `operation`                           | `"ticket-placement"`                         | Mandatory                     | string          | No                   |
| `version`                             | `"3.0"`                                      | Mandatory                     | string          | No (echoed in reply) |
| `content`                             | *(object)*                                   | Mandatory                     | object          | No                   |
| `content.type`                        | `"ticket"`                                   | Mandatory                     | string          | No                   |
| `content.ticketId`                    | step ids above                               | Mandatory                     | string          | No (echoed)          |
| `content.context`                     | *(object)*                                   | Mandatory                     | object          | No                   |
| `content.context.limitId`             | `123`                                        | Mandatory                     | integer         | Yes                  |
| `content.context.channel`             | *(object)*                                   | Mandatory                     | object          | Yes                  |
| `content.context.channel.type`        | `"mobile"`                                   | Mandatory                     | string          | Yes                  |
| `content.context.channel.lang`        | `"en"`                                       | Mandatory                     | string          | Yes                  |
| `content.context.channel.ip`          | `"127.0.0.1"`                                | Optional                      | string          | Yes                  |
| `content.context.channel.deviceId`    | `"deviceId123"`                              | Optional                      | string          | Yes                  |
| `content.context.endCustomer`         | *(object)*                                   | Mandatory (sandbox)           | object          | No                   |
| `content.context.endCustomer.id`      | `"customer_alt_stake"`                       | Mandatory (sandbox)           | string          | No (routing)         |
| `content.context.ref`                 | omitted (step 1) / alt-stake object (step 2) | Optional / Mandatory (step 2) | object          | No (routing)         |
| `content.context.ref.type`            | `"alt-stake"` (step 2)                       | Mandatory when ref present    | string          | No (routing)         |
| `content.bets[].selections[].type`    | `"uf"`                                       | Mandatory                     | string          | No (routing)         |
| `content.bets[].selections[].eventId` | `"sr:match:15050881"`                        | Mandatory                     | string          | No (routing)         |
| `content.bets[].stake`                | *(1 stake)*                                  | Mandatory                     | array of object | No                   |
| `content.bets[].stake[].type`         | `"cash"`                                     | Mandatory                     | string          | No (routing)         |
| `content.bets[].stake[].amount`       | `"10"`                                       | Mandatory                     | string          | Yes                  |
| `content.bets[].stake[].currency`     | `"EUR"`                                      | Mandatory                     | string          | Yes                  |

{% hint style="info" %}
`endCustomer` / `endCustomer.id` are optional in the Ticket 3.0 schema but **mandatory for this sandbox scenario** (routing). **Ignored by sandbox** means the field is not used for routing and not used when building the reply (schema-only for the WebSocket / Ticket 3.0 envelope).
{% endhint %}

## Expected response

{% tabs %}
{% tab title="Step 1" %}

| Java getter    | Expected value                                                |
| -------------- | ------------------------------------------------------------- |
| `getStatus()`  | `AcceptanceStatus.REJECTED`                                   |
| `getCode()`    | `-713`                                                        |
| `getMessage()` | `"Liability limit exceeded"`                                  |
| Suggestion     | type `alt-stake`, cash stake amount `"950"`, currency `"EUR"` |

```json
{
  "correlationId": "corr-1",
  "timestampUtc": 1710000001000,
  "operation": "ticket-placement",
  "version": "3.0",
  "content": {
    "type": "ticket-reply",
    "ticketId": "tid-alt-stake-1",
    "status": "rejected",
    "code": -713,
    "message": "Liability limit exceeded",
    "signature": "sandbox-signature",
    "betDetails": [{
      "betId": "bet-1",
      "code": -713,
      "message": "Liability limit exceeded",
      "suggestion": {
        "type": "alt-stake",
        "stake": [{ "type": "cash", "amount": "950", "currency": "EUR" }]
      },
      "selectionDetails": [{
        "code": -713,
        "message": "Liability limit exceeded",
        "selection": {
          "type": "uf",
          "eventId": "sr:match:15050881",
          "marketId": "m1",
          "outcomeId": "o1",
          "productId": "3",
          "odds": { "type": "decimal", "value": "2.0" }
        }
      }]
    }]
  }
}
```

{% endtab %}

{% tab title="Step 2" %}

| Java getter    | Expected value              |
| -------------- | --------------------------- |
| `getStatus()`  | `AcceptanceStatus.ACCEPTED` |
| `getCode()`    | `0`                         |
| `getMessage()` | `"accepted"` (sandbox)      |

```json
{
  "correlationId": "corr-2",
  "timestampUtc": 1710000003000,
  "operation": "ticket-placement",
  "version": "3.0",
  "content": {
    "type": "ticket-reply",
    "ticketId": "tid-alt-stake-2",
    "status": "accepted",
    "code": 0,
    "message": "accepted",
    "signature": "sandbox-signature",
    "betDetails": [{
      "betId": "bet-1",
      "code": 0,
      "message": "accepted",
      "selectionDetails": [{
        "code": 0,
        "message": "accepted [sandbox=customer=customer_alt_stake,oddsFormat=decimal,ref=alt-stake]",
        "selection": {
          "type": "uf",
          "eventId": "sr:match:15050881",
          "marketId": "m1",
          "outcomeId": "o1",
          "productId": "3",
          "odds": { "type": "decimal", "value": "2.0" }
        }
      }]
    }]
  }
}
```

{% endtab %}
{% endtabs %}

## Common mistakes

| Mistake                               | Result                         |
| ------------------------------------- | ------------------------------ |
| Step 2 without `ref.type` `alt-stake` | Stays on step-1 reject path    |
| Wrong customer                        | Route mismatch                 |
| Expecting `-703` instead of `-713`    | Alt-stake step 1 uses **-713** |

See also: [Error responses](broken://pages/3cdf760ce49fd6992d47d7772f4a4b9f67f0519f#error-responses) in the parent manual.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sportradar.com/transaction30api/sandbox/user-manual/alt_stake.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
