# Capture a payment

`POST https://app.shuttleglobal.com/c/api/instances/{instance_key}/payments/{payment_id}/capture`

Capture funds for a previously authorized payment. You must have created a payment with action=AUTH first.

You can capture the full authorized amount or a partial amount. Multiple partial captures are supported
on some gateways, up to the total authorized amount.

## Authentication

- basicAuth: Basic Authentication using secret key
- bearerAuth: OAuth 2.0 Bearer Token Authentication

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `payment_id` | path | string | yes | The authorisation's payment ID (`pay_...`) or transaction ID (`tr_...`), or the `alt_key` you gave it (case-insensitive). The record must be an authorisation, otherwise 404 `Payment not found`. An `alt_key` resolves to the newest authorisation with an amount still open, ignoring failed attempts. |

## Request body (`application/json`), required

- `amount` (string): Amount to capture. If not specified, the full authorization amount will be captured.
- `description` (string): Optional description for the capture

## Responses

### 200: Capture processed

```json
{
  "capture": {
    "id": "ca_11842_10006",
    "payment": "pay_11842_10005",
    "amount": "20",
    "status": "SUCCESS",
    "reference": "REF-00010006",
    "gateway_reference": "ch_1GVaKJFi2CnH4uN3AmXTKHwB",
    "gateway_status": "APPROVED",
    "source_transaction": "tr_11842_10005",
    "created": "2020-04-08T09:36:19.000Z",
    "processed": "2020-04-08T09:36:20.000Z"
  }
}
```

### 400: Bad request - invalid capture parameters

```json
{
  "code": "string",
  "message": "string"
}
```

### 401: Unauthorised: the API key is missing or not valid

```json
{
  "code": "UNAUTHORIZED",
  "message": "Unauthorised"
}
```

### 404: Payment not found or not eligible for capture

```json
{
  "code": "string",
  "message": "string"
}
```

## Example request

```sh
curl --request POST \
  --url https://app.shuttleglobal.com/c/api/instances/YOUR_INSTANCE_KEY/payments/PAYMENT_ID/capture \
  --header 'Authorization: Basic <base64 of SECRET_KEY:>' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": "50.00",
  "description": "Partial capture for shipped items"
}'
```

Reference page: https://docs.shuttleglobal.com/platforms/reference/operations/capturepayment/