> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# postPurchaseAbTestConclude

> End a running post-purchase A/B test: its winner takes its place in the live flow at once, for every order from now on, and this can't be undone. It is the only way a running test leaves the flow. Null if the test doesn't exist, or belongs to another store. POST_PURCHASE_FLOW_REVISION_STALE (409) when the flow changed since `expectedRevision`: a running test keeps running, so read the flow and call again with the new revision; INVALID_POST_PURCHASE_REQUEST (400) for a treatment that isn't in the test, or a test that hasn't started. CONVERSION_FEATURE_LOCKED (409) when post-purchase is locked for the store. POST_PURCHASE_FLOW_UNREADABLE (409) when the stored flow can't be read.

**Required scopes:** [`checkout_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-checkout_write)

## Arguments

**expectedRevision** `String!` *required*

The `postPurchaseFlowRevision` you reviewed.

**id** `ID!` *required*

The test.

**treatmentId** `ID!` *required*

The winning treatment.

## Returns

**postPurchaseAbTestConclude** `[PostPurchaseAbTest](/docs/api-reference/v3/reference/checkout/post-purchase-ab-test)`

An A/B test in the post-purchase flow. Add one by publishing a flow with a split step; end one with `postPurchaseAbTestConclude`.

**fields**

**controlTreatment** `[PostPurchaseAbTestTreatment](/docs/api-reference/v3/reference/checkout/post-purchase-ab-test-treatment)`

The arm the others are measured against.

**fields**

**id** `ID!` *required*

The treatment's id.

**name** `String!` *required*

Its name.

**weight** `Int!` *required*

Its share of orders, as a percentage of the test.

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When it was created.

**description** `String`

What it tests.

**endedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When it ended.

**id** `ID!` *required*

The test's id.

**locked** `Boolean!` *required*

Whether post-purchase is locked for the store, which refuses writes.

**name** `String!` *required*

Its name.

**startedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When it started.

**status** `[PostPurchaseAbTestStatus!](/docs/api-reference/v3/reference/checkout/post-purchase-ab-test-status)` *required*

Where it is in its life.

**treatments** `[\[PostPurchaseAbTestTreatment!\]!](/docs/api-reference/v3/reference/checkout/post-purchase-ab-test-treatment)` *required*

Its arms.

**fields**

**id** `ID!` *required*

The treatment's id.

**name** `String!` *required*

Its name.

**weight** `Int!` *required*

Its share of orders, as a percentage of the test.

**winningTreatment** `[PostPurchaseAbTestTreatment](/docs/api-reference/v3/reference/checkout/post-purchase-ab-test-treatment)`

The arm it concluded with.

**fields**

**id** `ID!` *required*

The treatment's id.

**name** `String!` *required*

Its name.

**weight** `Int!` *required*

Its share of orders, as a percentage of the test.

## Example

```graphql theme={null}
mutation {
  postPurchaseAbTestConclude(expectedRevision: "...", id: "...", treatmentId: "...") {
    createdAt
    description
    endedAt
    id
    locked
    name
    startedAt
    status
    # ...
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.