> 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/cancel_partial.md).

# cancel\_partial

**Goal:** Exercise the three partial-cancel sandbox steps for customer `customer_cancel_partial` (or magic ticketId `mock_cancel_partial`).

Sandbox modules: `cancel_partial_step1`, `cancel_partial_step2`, `cancel_partial_step3`.

## Routing

| Step | Details builder                          | Percentage | Expected message          |
| ---- | ---------------------------------------- | ---------- | ------------------------- |
| 1    | `newTicketPartialCancelDetailsBuilder()` | `0.5`      | `accepted;percentage=0.5` |
| 2    | `newTicketPartialCancelDetailsBuilder()` | `0.8`      | `accepted;percentage=0.8` |
| 3    | `newTicketCancelDetailsBuilder()` (full) | —          | `accepted`                |

Route with `mock_cancel_partial` as `ticketId`, or `meta.punter.id` = `"customer_cancel_partial"`.

## How to build the request (Java SDK)

{% stepper %}
{% step %}

### Build the `CancelRequest`

Use a unique `cancellationId` for each call.
{% endstep %}

{% step %}

### Send partial cancellation step 1

Use `CancelDetails.newTicketPartialCancelDetailsBuilder()` with percentage `0.5`.
{% endstep %}

{% step %}

### Send partial cancellation step 2

Use `CancelDetails.newTicketPartialCancelDetailsBuilder()` with percentage `0.8`.
{% endstep %}

{% step %}

### Send the full ticket cancellation

Switch to `CancelDetails.newTicketCancelDetailsBuilder()` for a full ticket cancel.
{% endstep %}
{% endstepper %}

Send each step with `mbsSdk.getTicketProtocol().sendCancel(request)`.

## Java example (all three steps)

```java
import com.sportradar.mbs.sdk.entities.cancellation.CancelDetails;
import com.sportradar.mbs.sdk.entities.common.AcceptanceStatus;
import com.sportradar.mbs.sdk.entities.request.CancelRequest;
import com.sportradar.mbs.sdk.entities.response.CancelResponse;
import java.math.BigDecimal;

// Step 1 — percentage 0.5
CancelResponse step1 = mbsSdk.getTicketProtocol().sendCancel(
    CancelRequest.newBuilder()
        .setCancellationId("cncl-p1")
        .setDetails(CancelDetails.newTicketPartialCancelDetailsBuilder()
            .setTicketId("mock_cancel_partial")
            .setTicketSignature("sandbox-signature")
            .setPercentage(new BigDecimal("0.5"))
            .build())
        .build());
// expect: ACCEPTED, message "accepted;percentage=0.5"

// Step 2 — percentage 0.8
CancelResponse step2 = mbsSdk.getTicketProtocol().sendCancel(
    CancelRequest.newBuilder()
        .setCancellationId("cncl-p2")
        .setDetails(CancelDetails.newTicketPartialCancelDetailsBuilder()
            .setTicketId("mock_cancel_partial")
            .setTicketSignature("sandbox-signature")
            .setPercentage(new BigDecimal("0.8"))
            .build())
        .build());
// expect: ACCEPTED, message "accepted;percentage=0.8"

// Step 3 — full ticket cancel
CancelResponse step3 = mbsSdk.getTicketProtocol().sendCancel(
    CancelRequest.newBuilder()
        .setCancellationId("cncl-p3")
        .setDetails(CancelDetails.newTicketCancelDetailsBuilder()
            .setTicketId("mock_cancel_partial")
            .setTicketSignature("sandbox-signature")
            .build())
        .build());
// expect: ACCEPTED, message "accepted"
```

## Wire JSON — step 1

```json
{
  "operatorId": 9985,
  "correlationId": "corr-1",
  "timestampUtc": 1710000000000,
  "operation": "ticket-cancel",
  "version": "3.0",
  "content": {
    "type": "cancel",
    "cancellationId": "cncl-p1",
    "details": {
      "type": "ticket-partial",
      "ticketId": "mock_cancel_partial",
      "ticketSignature": "sandbox-signature",
      "percentage": "0.5"
    }
  }
}
```

## Wire JSON — step 2

Same as step 1 with `cancellationId` `"cncl-p2"` and `"percentage": "0.8"`.

## Wire JSON — step 3

```json
{
  "operatorId": 9985,
  "correlationId": "corr-3",
  "timestampUtc": 1710000000000,
  "operation": "ticket-cancel",
  "version": "3.0",
  "content": {
    "type": "cancel",
    "cancellationId": "cncl-p3",
    "details": {
      "type": "ticket",
      "ticketId": "mock_cancel_partial",
      "ticketSignature": "sandbox-signature"
    }
  }
}
```

## Request fields

| Field name                        | Value                                                | Mandatory / Optional  | Data type | Ignored by sandbox   |
| --------------------------------- | ---------------------------------------------------- | --------------------- | --------- | -------------------- |
| `operatorId`                      | `9985`                                               | Mandatory             | integer   | Yes                  |
| `correlationId`                   | *(string)*                                           | Mandatory             | string    | No (echoed in reply) |
| `timestampUtc`                    | *(integer)*                                          | Mandatory             | integer   | Yes                  |
| `operation`                       | `"ticket-cancel"`                                    | Mandatory             | string    | No                   |
| `version`                         | `"3.0"`                                              | Mandatory             | string    | No (echoed in reply) |
| `content.type`                    | `"cancel"`                                           | Mandatory             | string    | No                   |
| `content.cancellationId`          | per step                                             | Mandatory             | string    | No (echoed in reply) |
| `content.details.type`            | `"ticket-partial"` (steps 1–2) / `"ticket"` (step 3) | Mandatory             | string    | No (routing)         |
| `content.details.ticketId`        | `"mock_cancel_partial"`                              | Mandatory (sandbox)   | string    | No (routing; echoed) |
| `content.details.percentage`      | `"0.5"` / `"0.8"`                                    | Mandatory (steps 1–2) | string    | No (routing)         |
| `content.details.ticketSignature` | `"sandbox-signature"`                                | Mandatory             | string    | Yes                  |

Magic map: `mock_cancel_partial` → `customer_cancel_partial`. Percentage facet is the float parsed from the string (`0.5` / `0.8`).

## Expected responses

| Step | `getStatus()` | `getCode()` | `getMessage()`            |
| ---- | ------------- | ----------- | ------------------------- |
| 1    | `ACCEPTED`    | `0`         | `accepted;percentage=0.5` |
| 2    | `ACCEPTED`    | `0`         | `accepted;percentage=0.8` |
| 3    | `ACCEPTED`    | `0`         | `accepted`                |

Example wire reply (step 1; content type `"cancel-reply"`):

```json
{
  "correlationId": "corr-1",
  "timestampUtc": 1710000001000,
  "operation": "ticket-cancel",
  "version": "3.0",
  "content": {
    "type": "cancel-reply",
    "cancellationId": "cncl-p1",
    "ticketId": "mock_cancel_partial",
    "status": "accepted",
    "code": 0,
    "message": "accepted;percentage=0.5",
    "signature": "sandbox-signature"
  }
}
```

## Common mistakes

| Mistake                             | Result                                                                                                                                   |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Percentage `0.6` / `0.9` on cancel  | Those percentages belong to [`cashout_partial`](broken://pages/7768693dede2f674b5ad2ca3178bc9b41b1fd30b); cancel falls through to `-999` |
| Step 3 still using `ticket-partial` | Does not match step 3 route (`ticket` + `customer_cancel_partial`)                                                                       |
| Wrong magic id                      | Fallback or a different cancel scenario                                                                                                  |

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/cancel_partial.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.
