---
page_source: https://juspay.io/in/docs/ec-api/docs/pre-auth-and-capture/capture-api
page_title: Capture API
---

## API Version: default


# Capture API



This will capture the transaction which is in the AUTHORIZED state. We support both **full-capture**  and **partial-capture**  (up to the amount pre-authorized).

> **Note**
> Partial Capture flow is currently supported only via CYBERSOURCE Gateway



* On successful **full capture** , the transaction is marked `CHARGED` and the order status is also `CHARGED`.
* On successful **partial capture** , the API accepts an additional `amount`  and `idempotence_key` parameters. While the transactions remain `CHARGED,` the order status updates to`PARTIAL_CHARGED.`
* 

Status Understanding:


| Payment Gateway Response | Juspay Transaction Status |
|---|---|
| Success | CHARGED |
| Failed | CAPTURE_FAILED |
| Accepted and pending by gateway | CAPTURE_INITIATED |
| Timeout/ No response from gateway | AUTHORIZED |
## Endpoints:
- Sandbox: https://payments.sandbox.juspay.in/v2/txns/{txn_uuid}/capture

- Production: https://payments.juspay.in/v2/txns/{txn_uuid}/capture

## Request Type: 
POST

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from Juspay dashboard
* Password: Empty string

Example:- Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: Base64 Encoded Username:Password, Mandatory
## Headers:

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Sample Request:

#### Full Capture Code Snippet:

```full capture
curl --request POST \
     --url https://api.juspay.in/v2/txns/txn_uuid/capture \
     --header 'accept: application/json' \
     --header 'x-routing-id: customer_1122'\
     --header 'authorization: Basic OUU4QxxxxxxxxxxxxUJDQTQzMEM2RkFDMjcyQjM5Og=='

```

#### Partial Capture Code Snippet:

```partial capture
curl --location https://api.juspay.in/v2/txns/txn_uuid/capture \
--header 'accept: application/json' \
--header 'x-routing-id: customer_1122'\
--header 'authorization: Basic OUU4QxxxxxxxxxxxxUJDQTQzMEM2RkFDMjcyQjM5Og=='
--data 'amount=10' \
--data 'idempotence_key=mozc6FzH1ovAs3DtkLi-1'
```

### Sample Response:

#### Full Capture:
```json
{
  "udf9": "",
  "udf8": "",
  "udf7": "",
  "udf6": "",
  "udf5": "",
  "udf4": "",
  "udf3": "",
  "udf2": "",
  "udf10": "",
  "udf1": "",
  "txn_uuid": "euld46jp7R1jE3tB8ss",
  "txn_id": "merchant_id-order_id-1",
  "status_id": 21,
  "status": "CHARGED",
  "return_url": "https://api.juspay.in",
  "refunded": false,
  "product_id": "",
  "payment_method_type": "CARD",
  "payment_method": "MASTERCARD",
  "payment_links": {
      "web": "https://api.juspay.in/merchant/pay/ord_7f609710bf6f4379b5917ee5afd8386b",
      "mobile": "https://api.juspay.in/merchant/pay/ord_7f609710bf6f4379b5917ee5afd8386b?mobile=true",
      "iframe": "https://api.juspay.in/merchant/ipay/ord_7f609710bf6f4379b5917ee5afd8386b"
  },
  "payment_gateway_response": {
      "txn_id": "merchant_id-order_id-1",
      "rrn": "",
      "resp_message": "Capture successful",
      "resp_code": "SUCCESS",
      "epg_txn_id": "14326152",
      "created": "2019-03-01T08:34:40Z",
      "auth_id_code": "NA"
  },
  "order_id": "92348923409",
  "merchant_id": "merchant_id",
  "id": "ord_7f609710bf6f4379b5917ee5afd8386b",
  "gateway_id": 70,
  "date_created": "2019-03-01T08:33:49Z",
  "customer_phone": null,
  "customer_id": "FUR14920977945",
  "customer_email": null,
  "currency": "INR",
  "card": {
      "using_saved_card": true,
      "saved_to_locker": false,
      "name_on_card": "test",
      "last_four_digits": "",
      "expiry_year": "2022",
      "expiry_month": "07",
      "card_type": "DEBIT",
      "card_reference": "aa301450fe38c65cd813a8c33897942b",
      "card_issuer": "HDFC Bank",
      "card_isin": "541919",
      "card_fingerprint": "6rds4re1p3678ftk333q64gs1g",
      "card_brand": "MASTERCARD"
  },
  "bank_error_message": "PRE_AUTH|Transaction Successful | Approved",
  "bank_error_code": "SUCCESS",
  "auth_type": "THREE_DS",
  "amount_refunded": 0,
  "amount": 10
}

},
"refunds":[ ]
}

```

#### Partial Capture:
```plaintext
{
  "udf9": "",
  "udf8": "",
  "udf7": "",
  "udf6": "",
  "udf5": "",
  "udf4": "",
  "udf3": "",
  "udf2": "",
  "udf10": "",
  "udf1": "",
  "txn_uuid": "euld46jp7R1jE3tB8ss",
  "txn_id": "merchant_id-order_id-1",
  "status_id": 21,
  "status": "PARTIAL_CHARGED",
  "return_url": "https://api.juspay.in",
  "refunded": false,
  "product_id": "",
  "payment_method_type": "CARD",
  "payment_method": "MASTERCARD",
  "payment_links": {
      "web": "https://api.juspay.in/merchant/pay/ord_7f609710bf6f4379b5917ee5afd8386b",
      "mobile": "https://api.juspay.in/merchant/pay/ord_7f609710bf6f4379b5917ee5afd8386b?mobile=true",
      "iframe": "https://api.juspay.in/merchant/ipay/ord_7f609710bf6f4379b5917ee5afd8386b"
  },
  "payment_gateway_response": {
      "txn_id": "merchant_id-order_id-1",
      "rrn": "",
      "resp_message": "Capture successful",
      "resp_code": "SUCCESS",
      "epg_txn_id": "14326152",
      "created": "2019-03-01T08:34:40Z",
      "auth_id_code": "NA"
  },
  "order_id": "92348923409",
  "merchant_id": "merchant_id",
  "id": "ord_7f609710bf6f4379b5917ee5afd8386b",
  "gateway_id": 70,
  "date_created": "2019-03-01T08:33:49Z",
  "customer_phone": null,
  "customer_id": "FUR14920977945",
  "customer_email": null,
  "currency": "INR",
  "card": {
      "using_saved_card": true,
      "saved_to_locker": false,
      "name_on_card": "test",
      "last_four_digits": "",
      "expiry_year": "2022",
      "expiry_month": "07",
      "card_type": "DEBIT",
      "card_reference": "aa301450fe38c65cd813a8c33897942b",
      "card_issuer": "HDFC Bank",
      "card_isin": "541919",
      "card_fingerprint": "6rds4re1p3678ftk333q64gs1g",
      "card_brand": "MASTERCARD"
  },
  "bank_error_message": "PRE_AUTH|Transaction Successful | Approved",
  "bank_error_code": "SUCCESS",
  "auth_type": "THREE_DS",
  "amount_refunded": 0,
  "amount": 10
}

},
"refunds":[ ]
}

```

## Path Parameters:

#### txn_uuid:
Transaction UUID
- Value: Example:- d64d1eff-551a-4e03-9858-b00b7cc36dae
- Tags: UUID, Mandatory

#### amount:
Amount to be captured
- Tags: double
## Body Parameters:
### Parameters:

#### amount:
- Description: > **Note**
> To be passed for Partial Capture Only.


- Value: value
- Tags: String, conditional

#### idempotence_key:
- Description: > **Note**
> To be passed for Partial Capture Only.
> 
> Special Characters Allowed -Hyphen or Minus, Underscore, Left Parenthesis, Right Curly Brace, Plus Sign, Tilde, Left Curly Brace, Period, Dot, Right Parenthesis


- Value: A123_456
- Tags: String, Conditional
## API Responses:
### 200:

#### json:
- Tags: Object
### 400:

#### status:
- Description: Bad Request
- Tags: string

#### error_message:
- Description: Cannot capture charged transaction
- Tags: string

#### error_code:
- Description: Invalid
- Tags: string
### 401:

#### status:
- Description: error
- Tags: string

#### error_code:
- Description: access_denied
- Tags: string

#### error_message:
- Description: Invalid Authentication
- Tags: string
