> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs-dev.truemed.com/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.truemed.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.truemed.com/_mcp/server.

# Capture Session

POST https://dev-api.truemed.com/payments/v1/payment_session/{business_id}/capture
Content-Type: application/json

The `capture_payment_session` endpoint should be called after [`create_payment_session`](/api-reference/payment-sessions/create-payment-session)
has been called with `kind` of `authorization` as outlined in [Manual/Delayed Capture](/guides/setup/api/payment-sessions/manual-delayed-capture).

The failure or success status is communicated to the partner via a [`payment_session_complete`](/api-reference/payment-sessions/payment-session-completed-webhook)
webhook as before.

## Request Notes

* **`total_amount`** *(Required)* - The amount in cents to charge, including any tax and fees you're collecting. Captures together can't exceed the session's `total_amount`; to collect more, void and create a new session.
* **`item_details`** *(Required)* - The units in this capture, each referencing an `item_id` from the session's `order_items`.
  * Without multi-capture, an item keeps the same per-unit cost (`total / quantity`) in every capture, and `total_amount` must equal the sum of the `total` values, except on a single capture of the whole order, the only capture that may also carry order-level shipping, fees and discounts.
* **`final`** *(Optional, defaults to `true`)* - `false` keeps the rest of the authorization for a later capture. It requires [`multicapture_available`](/api-reference/payment-sessions/payment-session-completed-webhook) to be `true` on the authorized `payment_session_complete` webhook; otherwise the request fails with `ValidationError`.
  * A final capture releases whatever it doesn't collect.
  * To close without collecting more, send `total_amount: 0` with empty `item_details` after at least one earlier capture, or [void the session](/api-reference/payment-sessions/void-payment-session).
* **`amount_details`** and **`item_details[].amount_details`** *(Optional, multi-capture only)* - The charges and discounts this capture carries, in the same shape as at session creation. Other sessions reject them with `InvalidItemizedData`.

## Multi-capture sessions

Multi-capture must be enabled for your integration by Truemed Support. See [Capturing in multiple parts](/guides/setup/api/payment-sessions/manual-delayed-capture#capturing-in-multiple-parts) for setup and integration guidance.

After authorization, split a session only when [`multicapture_available`](/api-reference/payment-sessions/payment-session-completed-webhook) is `true` on the `payment_session_complete` webhook. When it's `false`, a `final: false` capture is rejected and a final capture releases whatever it doesn't collect.

Each capture may include any remaining quantity of an order item, down to a single unit, and items may be captured in any order. Across all captures, the total quantity for an `item_id` cannot exceed its quantity in the original order.

Send `final: false` when more captures will follow. `final: true` closes the session and releases any uncollected amount. A capture also closes the session if it collects the entire remaining balance.

**Without `amount_details`**, Truemed infers the order-level part:

* `total_amount` can be up to these units' session totals plus the net order-level money still owed on the session (`order_level_charges_remaining` less `order_level_discounts_remaining`).
* Below the units' totals, the session's order-level discounts are applied: up to these items' share on a non-final capture, up to all that remain on a final. Anything lower is money you chose not to collect, and it can't be captured later.

**With `amount_details`**, you declare it. If a session's first capture sends no `amount_details`, later captures can't send them either; a final capture without `amount_details` collects what's left. A session whose first capture declares can mix declared and inferred captures.

* `amount_details` can be declared at the top level of the capture or per item.
* At the item level, the unit price × `quantity`, plus its charges, minus its discounts, must equal its `total`. A discount declared on an item belongs to that item.
* At the capture level, the items' totals plus its charges minus its discounts must equal `total_amount`.
* In a capture that declares `amount_details` at either level, an item that omits `amount_details` or sends `amount_details: {}` uses the item-level charges and discounts provided to [`create_payment_session`](/api-reference/payment-sessions/create-payment-session). Its `total` must equal the unit price × `quantity`, plus the captured units' share of those charges, minus their share of those discounts. At the capture level, omitting `amount_details` or sending `amount_details: {}` declares no order-level charges or discounts.
* Declared charges must fit within [`order_level_charges_remaining`](/api-reference/payment-sessions/payment-session-completed-webhook), and declared discounts must fit within [`order_level_discounts_remaining`](/api-reference/payment-sessions/payment-session-completed-webhook); the two are checked separately. An item's discount beyond what's left is money you chose not to collect on that item; a capture-level one is rejected.

**Partial quantities:** the cumulative limit is the captured units' proportional share of `max_capture_amount`, rounded half up, plus up to one cent per captured unit, and never more than `max_capture_amount`. For example, when `max_capture_amount` is `1000` and `quantity` is `3`, the item's captures may total up to `334` after one unit, `669` after two, and `1000` after all three. See [Partial quantities: why a rounding rule, and which one](/guides/setup/api/payment-sessions/manual-delayed-capture#partial-quantities-why-a-rounding-rule-and-which-one).

**Card minimum:** no card is charged less than \$0.50 in one capture, so a capture under \$0.50 in total is rejected.

## Response Notes

### Success Case

HTTP Status: `200`

* **`id`** - The ID of the payment session that was captured, the same value that `create_payment_session` returned.
* **`capture_id`** - The ID of this capture. Pass it as `capture_id` to [Create Refund](/api-reference/payment-sessions/create-refund) to refund against this capture. The same ID is returned if the endpoint is called again with the same `idempotency_key`. It is omitted for a zero-amount final capture, which only releases the uncaptured remainder.

### Bad Request

HTTP Status: `400`

If a field is missing or the request otherwise can't be processed, we'll return a `400` with the following fields:

* **`error`** - can be one of:
  * `MissingField`: One of the required fields is not present in the request.
  * `TotalAmountInvalid`: The amount can't be accepted: more than these items and the order-level money still owed allow, more than is still authorized, negative, under \$0.50, a zero amount where it isn't allowed, or declared amounts that don't add up to `total_amount` or don't fit the order-level charges or discounts still unused. On a multi-capture session the `message` explains what to change. A rejected capture records nothing.
  * `PaymentSessionDoesNotExist`: The `payment_session_id` does not exist.
  * `ServerError`: There was an internal server error. Requests can be retried as long as the `idempotency_key` is the same.
  * `SessionVoided`: The session has already been voided via a call to [`/payment_session/{payment_session_id}/void`](/api-reference/payment-sessions/void-payment-session).
  * `SessionExpired`: The auth hold has expired and we were unable to recharge the customer for the amount requested.
  * `SessionPending`: The user hasn't completed the Truemed checkout flow (survey, CC entry form).
  * `SessionCaptured`: You're attempting to capture a payment\_session that has already been captured. This error **will never** be returned if reissuing a capture call **with the same idempotency key** - the return value will be the same as the first call.
  * `ImmediateCapture`: The payment session wasn't created with `kind=authorization`.
  * `InvalidItemizedData`: An `item_details` entry is invalid (a bad quantity or total, or more than is left of the item), an item's declared `amount_details` don't add up to its `total`, `amount_details` on a session without multi-capture, or, on a multi-capture session, the same `item_id` sent twice, or `amount_details` on a capture after the session's first capture declared none. The `message` names the item and the value.
  * `ValidationError`: `final: false` on a session without multi-capture.
  * `InvalidRequestParameter`: `amount_details` is malformed, for example `total_discounts` without `discounts_details`.
* **`message`** - Indication of which field was missing, details on how the total amount was invalid, or details on voided sessions.

Reference: https://docs-dev.truemed.com/api-reference/payment-sessions/capture-payment-session

## Authentication

- `x-truemed-api-key` header (required) — Sales channel API key for merchant server-to-server authentication

## Servers

- `https://dev-api.truemed.com` (Development server, default)
- `https://api.truemed.com` (Production server)

## Request

### Path parameters

- `business_id` (string, required) — The UUID of the payment session returned by create_payment_session.

### Body (application/json)

This endpoint expects a PaymentSessionCaptureRequest.

- `idempotency_key` (string, required) — Allows the endpoint to be called multiple times. It must be unique to the capture session.
- `item_details` (list of CaptureItemDetails, required) — A list of items being captured in the capture request.
- `total_amount` (integer, required) — The total amount in cents to charge the user, inclusive of taxes and fees being collected by the partner. Must be less than or equal to the total_amount passed in when creating the payment session. If an amount more than the initial authorization should be captured, void the initial auth hold and create a new one.
- `amount_details` (PaymentSessionAmountDetails, optional, nullable) — Order-level charges and discounts this capture carries beyond its items, in the session-creation shape. The items' totals plus charges minus discounts must equal `total_amount`. To declare no charges or discounts, send a zero total with an empty details list. Multi-capture sessions only, and only when the session's first capture declared amounts: once a capture sends none, later captures are rejected if they do.
- `final` (boolean, optional, default: true) — Defaults to `true`, which releases whatever this capture doesn't collect. `false` keeps the rest authorized for a later capture; it needs multi-capture (see `multicapture_available`).

## Response

### 200

Successful response

- `id` (string, required) — The ID of the payment session that was captured, the same value returned by create_payment_session. Use `capture_id` to identify this capture.
- `capture_id` (string, optional, nullable) — The ID of this capture. Pass it as `capture_id` to the refund endpoint to refund against this capture. The same ID is returned if the endpoint is called again with the same idempotency_key. Omitted for a zero-amount final capture, which only releases the uncaptured remainder and cannot be refunded.

## Errors

### 400 Bad Request Error

Bad Request

- `error` (enum, required)
  - Allowed values: `ImmediateCapture`, `InvalidRequestParameter`, `SessionCaptured`, `SessionExpired`, `SessionPending`, `SessionVoided`, `TotalAmountInvalid`, `ValidationError`
- `message` (string, required)

### 404 Not Found Error

Not Found

- `error` (enum, required)
  - Allowed values: `NotFound`
- `message` (string, required)

### 405 Method Not Allowed Error

Method Not Allowed

- `error` (enum, required)
  - Allowed values: `MethodNotAllowed`
- `message` (string, required)

### 500 Internal Server Error

Internal Server Error

- `error` (enum, required)
  - Allowed values: `ServerError`
- `message` (string, required)

### 501 Not Implemented Error

Not Implemented

- `error` (enum, required)
  - Allowed values: `NotImplemented`
- `message` (string, required)

## Types

### CaptureItemDetails

- `item_id` (string, required) — ID that uniquely identifies the item within the Payment; optionally specified when creating the payment and retrievable from payment session status or list payment sessions. On a multi-capture session, list each item once per request.
- `quantity` (integer, required) — The quantity to capture for this order_item, up to the quantity_capturable for the item, retrievable from payment session status or list payment sessions.
- `total` (integer, required) — The total amount in cents to capture for this order_item. Without `amount_details`, up to the item's total_capturable, retrievable from payment session status or list payment sessions; with them, it also includes the order-level money declared on the item. In a capture that declares amounts, an item sent without `amount_details`, or with an empty object, declares the charges and discounts its units were created with.
- `amount_details` (PaymentSessionAmountDetails, optional, nullable) — This item's charges and discounts in this capture, in the session-creation shape. The unit price times `quantity`, plus charges, minus discounts, must equal `total`. To declare no charges or discounts, send a zero total with an empty details list. Multi-capture sessions only, and only when the session's first capture declared amounts.

### PaymentSessionAmountDetails

- `additional_charges_details` (list of PaymentSessionAmountDetail, optional, nullable) — An array of individual additional charge line items with names and amounts.
- `discounts_details` (list of PaymentSessionAmountDetail, optional, nullable) — An array of individual discount line items with names and amounts.
- `total_additional_charges` (integer, optional, nullable) — The total amount of additional charges (e.g., shipping, tax), in cents.
- `total_discounts` (integer, optional, nullable) — The total amount of discounts applied, in cents.

### PaymentSessionAmountDetail

- `amount` (integer, required) — The amount in cents for this discount or charge.
- `name` (string, required) — The name or description of the discount or charge.

## Examples

### Manual capture

**Request**

```json
{
  "idempotency_key": "cf917de7-ecc2-4839-9084-37d747f1ef6f",
  "item_details": [
    {
      "item_id": "vitamin-d3-60ct",
      "quantity": 2,
      "total": 400
    }
  ],
  "total_amount": 402
}
```

**Response**

```json
{
  "id": "305dc304-e815-48b9-b029-0b23626c7f41",
  "capture_id": "01a146dd-0bad-7520-80c0-dc3ee7f34ad5"
}
```

**SDK Code**

```python Manual capture
import requests

url = "https://dev-api.truemed.com/payments/v1/payment_session/305dc304-e815-48b9-b029-0b23626c7f41/capture"

payload = {
    "idempotency_key": "cf917de7-ecc2-4839-9084-37d747f1ef6f",
    "item_details": [
        {
            "item_id": "vitamin-d3-60ct",
            "quantity": 2,
            "total": 400
        }
    ],
    "total_amount": 402
}
headers = {
    "x-truemed-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Manual capture
const url = 'https://dev-api.truemed.com/payments/v1/payment_session/305dc304-e815-48b9-b029-0b23626c7f41/capture';
const options = {
  method: 'POST',
  headers: {'x-truemed-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"idempotency_key":"cf917de7-ecc2-4839-9084-37d747f1ef6f","item_details":[{"item_id":"vitamin-d3-60ct","quantity":2,"total":400}],"total_amount":402}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

### Multi-capture (inferred): first shipment

**Request**

```json
{
  "idempotency_key": "898d2f6c-3a37-490f-bfac-7934cc7c9af8",
  "item_details": [
    {
      "item_id": "insoles-pair",
      "quantity": 2,
      "total": 5400
    }
  ],
  "total_amount": 5763,
  "final": false
}
```

**Response**

```json
{
  "id": "80a702cb-d54b-460b-bea4-e7a16ccbfb26",
  "capture_id": "01a146dd-0cfb-7201-9043-ea776a611ca6"
}
```

**SDK Code**

```python Multi-capture (inferred): first shipment
import requests

url = "https://dev-api.truemed.com/payments/v1/payment_session/80a702cb-d54b-460b-bea4-e7a16ccbfb26/capture"

payload = {
    "idempotency_key": "898d2f6c-3a37-490f-bfac-7934cc7c9af8",
    "item_details": [
        {
            "item_id": "insoles-pair",
            "quantity": 2,
            "total": 5400
        }
    ],
    "total_amount": 5763,
    "final": False
}
headers = {
    "x-truemed-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Multi-capture (inferred): first shipment
const url = 'https://dev-api.truemed.com/payments/v1/payment_session/80a702cb-d54b-460b-bea4-e7a16ccbfb26/capture';
const options = {
  method: 'POST',
  headers: {'x-truemed-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"idempotency_key":"898d2f6c-3a37-490f-bfac-7934cc7c9af8","item_details":[{"item_id":"insoles-pair","quantity":2,"total":5400}],"total_amount":5763,"final":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

### Multi-capture (inferred): final shipment

**Request**

```json
{
  "idempotency_key": "ef0a1140-f6e6-42fd-9531-f9f5ac48383c",
  "item_details": [
    {
      "item_id": "rain-jacket",
      "quantity": 1,
      "total": 8000
    }
  ],
  "total_amount": 8537,
  "final": true
}
```

**Response**

```json
{
  "id": "80a702cb-d54b-460b-bea4-e7a16ccbfb26",
  "capture_id": "01a146dd-0d83-7b83-84af-8e1d937fc101"
}
```

**SDK Code**

```python Multi-capture (inferred): final shipment
import requests

url = "https://dev-api.truemed.com/payments/v1/payment_session/80a702cb-d54b-460b-bea4-e7a16ccbfb26/capture"

payload = {
    "idempotency_key": "ef0a1140-f6e6-42fd-9531-f9f5ac48383c",
    "item_details": [
        {
            "item_id": "rain-jacket",
            "quantity": 1,
            "total": 8000
        }
    ],
    "total_amount": 8537,
    "final": True
}
headers = {
    "x-truemed-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Multi-capture (inferred): final shipment
const url = 'https://dev-api.truemed.com/payments/v1/payment_session/80a702cb-d54b-460b-bea4-e7a16ccbfb26/capture';
const options = {
  method: 'POST',
  headers: {'x-truemed-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"idempotency_key":"ef0a1140-f6e6-42fd-9531-f9f5ac48383c","item_details":[{"item_id":"rain-jacket","quantity":1,"total":8000}],"total_amount":8537,"final":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

### Multi-capture (declared): first shipment

**Request**

```json
{
  "idempotency_key": "64ef15f0-d0c7-4764-b111-66fa98e56b9d",
  "item_details": [
    {
      "item_id": "insoles-pair",
      "quantity": 2,
      "total": 5400,
      "amount_details": {
        "additional_charges_details": [],
        "discounts_details": [
          {
            "amount": 600,
            "name": "Insoles 10% off"
          }
        ],
        "total_additional_charges": 0,
        "total_discounts": 600
      }
    }
  ],
  "total_amount": 5860,
  "amount_details": {
    "additional_charges_details": [
      {
        "amount": 360,
        "name": "Sales tax"
      },
      {
        "amount": 500,
        "name": "Shipping"
      }
    ],
    "discounts_details": [
      {
        "amount": 400,
        "name": "WELCOME10"
      }
    ],
    "total_additional_charges": 860,
    "total_discounts": 400
  },
  "final": false
}
```

**Response**

```json
{
  "id": "00ca24ee-227b-4fea-b4e7-b8444ddb9ced",
  "capture_id": "01a14684-e03a-75d1-afdb-29307c0c4074"
}
```

**SDK Code**

```python Multi-capture (declared): first shipment
import requests

url = "https://dev-api.truemed.com/payments/v1/payment_session/00ca24ee-227b-4fea-b4e7-b8444ddb9ced/capture"

payload = {
    "idempotency_key": "64ef15f0-d0c7-4764-b111-66fa98e56b9d",
    "item_details": [
        {
            "item_id": "insoles-pair",
            "quantity": 2,
            "total": 5400,
            "amount_details": {
                "additional_charges_details": [],
                "discounts_details": [
                    {
                        "amount": 600,
                        "name": "Insoles 10% off"
                    }
                ],
                "total_additional_charges": 0,
                "total_discounts": 600
            }
        }
    ],
    "total_amount": 5860,
    "amount_details": {
        "additional_charges_details": [
            {
                "amount": 360,
                "name": "Sales tax"
            },
            {
                "amount": 500,
                "name": "Shipping"
            }
        ],
        "discounts_details": [
            {
                "amount": 400,
                "name": "WELCOME10"
            }
        ],
        "total_additional_charges": 860,
        "total_discounts": 400
    },
    "final": False
}
headers = {
    "x-truemed-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Multi-capture (declared): first shipment
const url = 'https://dev-api.truemed.com/payments/v1/payment_session/00ca24ee-227b-4fea-b4e7-b8444ddb9ced/capture';
const options = {
  method: 'POST',
  headers: {'x-truemed-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"idempotency_key":"64ef15f0-d0c7-4764-b111-66fa98e56b9d","item_details":[{"item_id":"insoles-pair","quantity":2,"total":5400,"amount_details":{"additional_charges_details":[],"discounts_details":[{"amount":600,"name":"Insoles 10% off"}],"total_additional_charges":0,"total_discounts":600}}],"total_amount":5860,"amount_details":{"additional_charges_details":[{"amount":360,"name":"Sales tax"},{"amount":500,"name":"Shipping"}],"discounts_details":[{"amount":400,"name":"WELCOME10"}],"total_additional_charges":860,"total_discounts":400},"final":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

### Multi-capture (declared): final shipment

**Request**

```json
{
  "idempotency_key": "bf7a6ea1-e171-4154-af15-cdd99b5e1f40",
  "item_details": [
    {
      "item_id": "rain-jacket",
      "quantity": 1,
      "total": 8000,
      "amount_details": {
        "additional_charges_details": [],
        "discounts_details": [],
        "total_additional_charges": 0,
        "total_discounts": 0
      }
    }
  ],
  "total_amount": 8440,
  "amount_details": {
    "additional_charges_details": [
      {
        "amount": 540,
        "name": "Sales tax"
      },
      {
        "amount": 500,
        "name": "Shipping"
      }
    ],
    "discounts_details": [
      {
        "amount": 600,
        "name": "WELCOME10"
      }
    ],
    "total_additional_charges": 1040,
    "total_discounts": 600
  },
  "final": true
}
```

**Response**

```json
{
  "id": "00ca24ee-227b-4fea-b4e7-b8444ddb9ced",
  "capture_id": "01a14684-e062-73a2-8fde-fb403690aa38"
}
```

**SDK Code**

```python Multi-capture (declared): final shipment
import requests

url = "https://dev-api.truemed.com/payments/v1/payment_session/00ca24ee-227b-4fea-b4e7-b8444ddb9ced/capture"

payload = {
    "idempotency_key": "bf7a6ea1-e171-4154-af15-cdd99b5e1f40",
    "item_details": [
        {
            "item_id": "rain-jacket",
            "quantity": 1,
            "total": 8000,
            "amount_details": {
                "additional_charges_details": [],
                "discounts_details": [],
                "total_additional_charges": 0,
                "total_discounts": 0
            }
        }
    ],
    "total_amount": 8440,
    "amount_details": {
        "additional_charges_details": [
            {
                "amount": 540,
                "name": "Sales tax"
            },
            {
                "amount": 500,
                "name": "Shipping"
            }
        ],
        "discounts_details": [
            {
                "amount": 600,
                "name": "WELCOME10"
            }
        ],
        "total_additional_charges": 1040,
        "total_discounts": 600
    },
    "final": True
}
headers = {
    "x-truemed-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Multi-capture (declared): final shipment
const url = 'https://dev-api.truemed.com/payments/v1/payment_session/00ca24ee-227b-4fea-b4e7-b8444ddb9ced/capture';
const options = {
  method: 'POST',
  headers: {'x-truemed-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"idempotency_key":"bf7a6ea1-e171-4154-af15-cdd99b5e1f40","item_details":[{"item_id":"rain-jacket","quantity":1,"total":8000,"amount_details":{"additional_charges_details":[],"discounts_details":[],"total_additional_charges":0,"total_discounts":0}}],"total_amount":8440,"amount_details":{"additional_charges_details":[{"amount":540,"name":"Sales tax"},{"amount":500,"name":"Shipping"}],"discounts_details":[{"amount":600,"name":"WELCOME10"}],"total_additional_charges":1040,"total_discounts":600},"final":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

### Multi-capture: close without collecting more

**Request**

```json
{
  "idempotency_key": "371eaf06-f8e7-4394-a0ad-d921cf115061",
  "item_details": [],
  "total_amount": 0,
  "final": true
}
```

**Response**

```json
{
  "id": "b0769448-56bf-438e-a582-746139b7e0db"
}
```

**SDK Code**

```python Multi-capture: close without collecting more
import requests

url = "https://dev-api.truemed.com/payments/v1/payment_session/b0769448-56bf-438e-a582-746139b7e0db/capture"

payload = {
    "idempotency_key": "371eaf06-f8e7-4394-a0ad-d921cf115061",
    "item_details": [],
    "total_amount": 0,
    "final": True
}
headers = {
    "x-truemed-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Multi-capture: close without collecting more
const url = 'https://dev-api.truemed.com/payments/v1/payment_session/b0769448-56bf-438e-a582-746139b7e0db/capture';
const options = {
  method: 'POST',
  headers: {'x-truemed-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"idempotency_key":"371eaf06-f8e7-4394-a0ad-d921cf115061","item_details":[],"total_amount":0,"final":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```