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

# Validate a transaction

> Preview the discount that a BrandWallet point spend would produce on a basket without committing the transaction.

`POST /v1/transactions/validate` takes the same body as [POST /v1/transactions/process](/api/process-transaction) but does **not** commit. It previews the discount a point spend (`pointsToSpend`) would produce on the selected `card`, and validates the point balance.

```bash theme={null}
POST $BASE_URL/v1/transactions/validate
```

<Note>
  The discount fields (`discountAmount` / `discountedAmount`) are an **output** of this endpoint, not an input. Omit them from the request.
</Note>

## Request headers

<ParamField header="Authorization" type="string" required>
  Your active Bearer token: `Bearer <accessToken>`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Always `application/json`.
</ParamField>

## Request body

Same shape as [POST /v1/transactions/process](/api/process-transaction). At minimum, provide:

<ParamField body="customer" type="string" required>
  Customer id.
</ParamField>

<ParamField body="card" type="string" required>
  Selected card (customerpass id).
</ParamField>

<ParamField body="amount" type="number">
  Order total before discounts.
</ParamField>

<ParamField body="pointsToSpend" type="number">
  Loyalty points to preview against the order total.
</ParamField>

## Response fields (200 OK)

<ResponseField name="discountedAmount" type="number">
  Order total after the point discount.
</ResponseField>

<ResponseField name="discountAmount" type="number">
  Discount produced by the spent points.
</ResponseField>

<RequestExample>
  ```bash Request theme={null}
  curl --request POST \
    --url "$BASE_URL/v1/transactions/validate" \
    --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...' \
    --header 'Content-Type: application/json' \
    --data '{
      "customer": "3d8ec956-de2a-4d43-9c1e-74475b153362",
      "card": "41dd8263-288e-4b55-bf2e-6a82995a0441",
      "amount": 200,
      "pointsToSpend": 5
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "discountedAmount": 195,
    "discountAmount": 5
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "statuscode": 400,
    "errorcode": 400,
    "message": "_card_not_found",
    "description": "",
    "timestamp": 1754040000000,
    "path": "/v1/transactions/validate",
    "method": "POST"
  }
  ```
</ResponseExample>
