# Make decision

`POST /v3/session/{sessionId}/decision`

Section: Session Management. Base URLs: Playground https://playground-api.briqpay.com, Production https://api.briqpay.com. Auth: HTTP Basic.

This endpoint is part of the [Decisions](https://developer.briqpay.com/docs/payment-module.md#4-approve-the-purchase) flow.

The error messages has support for [markdown links](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#links) if you want the user to be able to read more or contact someone based on your error message.

## Path parameters

- `sessionId` (string, required): **Format:** UUID

## Headers

- `Content-Type` (string, one of: `"application/json"`)
- `Accept` (string, one of: `"application/json"`)
- `Authorization` (string): Format: "Basic <base64(username:secret)>"

## Request body

- `decision` (string, required, one of: `"allow"`, `"reject"`)
- `rejectionType` (string, one of: `"reject_session_with_error"`, `"notify_user"`): Required with { "decision": "reject" }. "reject_session_with_error" will close the session and display a message in the client in an overlay. "notify_user" will display a message in the client.
- `hardError` (object): Required with { "rejectionType": "reject_session_with_error" }. Provide an error message that will be shown in an overlay in the client.
  - `message` (string, required, max length 256)
- `softErrors` (array of object): Optional with { "rejectionType": "notify_user" }. Provide a list of error messages that will be shown to the user.
  - `message` (string, required)

## Request examples

### Allow

```bash
curl -X POST 'https://playground-api.briqpay.com/v3/session/{sessionId}/decision' \
  -H 'Authorization: Basic <base64(merchantId:secret)>' \
  -H 'Content-Type: application/json' \
  -d '{
  "decision": "allow"
}'
```

### Soft reject

```bash
curl -X POST 'https://playground-api.briqpay.com/v3/session/{sessionId}/decision' \
  -H 'Authorization: Basic <base64(merchantId:secret)>' \
  -H 'Content-Type: application/json' \
  -d '{
  "decision": "reject",
  "rejectionType": "notify_user",
  "softErrors": [
    {
      "message": "Registration rejected"
    }
  ]
}'
```

### Hard reject

```bash
curl -X POST 'https://playground-api.briqpay.com/v3/session/{sessionId}/decision' \
  -H 'Authorization: Basic <base64(merchantId:secret)>' \
  -H 'Content-Type: application/json' \
  -d '{
  "decision": "reject",
  "rejectionType": "reject_session_with_error",
  "hardError": {
    "message": "Registration rejected"
  }
}'
```

## Responses

### 204

No content.

### 400

- `error` (object)
  - `code` (string, one of: `"INVALID_CREDENTIALS"`, `"INVALID_DATA"`, `"UNKNOWN"`)
  - `message` (string)

### 403

- `error` (object)
  - `code` (string, one of: `"INVALID_CREDENTIALS"`, `"INVALID_API_KEY"`, `"AUTH_SECRET_EXPIRED"`)
  - `message` (string)

### 404

- `error` (object)
  - `code` (string, one of: `"SESSION_NOT_FOUND"`)
  - `message` (string)
