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

# Authorize & Capture

> Hold funds on a card and capture them later.

<Info>
  This page is part of the **REST API Guides**. Using the JavaScript library instead? See [Payments Library Guides](/guides/library/setup).
</Info>

**Prerequisites:** [API key](/getting-started/generate-api-key) and [Payment Gateway Account](/getting-started/add-payment-provider) configured.

Authorization places a hold on funds without capturing them immediately. Use capture, void, or refund to complete the transaction lifecycle.

<Note>
  Some payment processors require additional parameters. See the [Additional Guidance](/guides/rest-api/gateway-requirements) section for processor-specific requirements.
</Note>

## When to Use Authorize

* **Physical goods**: Authorize at checkout, capture when shipped
* **Variable amounts**: Authorize an estimate, capture the actual amount
* **Verification**: Confirm a card is valid before providing a service
* **Hotels/rentals**: Authorize a hold, capture the final bill

## Authorize

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/authorize', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Api-Key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      amount: 50.00,
      currency: 'USD',
      paymentGatewayAccountName: 'stripeProduction',
      card: {
        cardNumber: '4111111111111111',
        cardHolderName: 'Jane Smith',
        expirationMonth: 12,
        expirationYear: 2027,
        cvv: '123'
      }
    })
  });

  const result = await response.json();
  // Save the transaction ID for capture/void/refund
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.orchestrasolutions.com/PaymentGateway/authorize \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: YOUR_API_KEY" \
    -d '{
      "amount": 50.00,
      "currency": "USD",
      "paymentGatewayAccountName": "stripeProduction",
      "card": {
        "cardNumber": "4111111111111111",
        "cardHolderName": "Jane Smith",
        "expirationMonth": 12,
        "expirationYear": 2027,
        "cvv": "123"
      }
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.orchestrasolutions.com/PaymentGateway/authorize',
      headers={
          'Content-Type': 'application/json',
          'X-Api-Key': 'YOUR_API_KEY'
      },
      json={
          'amount': 50.00,
          'currency': 'USD',
          'paymentGatewayAccountName': 'stripeProduction',
          'card': {
              'cardNumber': '4111111111111111',
              'cardHolderName': 'Jane Smith',
              'expirationMonth': 12,
              'expirationYear': 2027,
              'cvv': '123'
          }
      }
  )
  ```
</CodeGroup>

<Card title="Authorize API Reference" icon="code" href="/api-reference/paymentgateway/perform-a-payment-gateway-authorize-operation">
  Complete parameter reference for authorize requests
</Card>

<Warning>
  Save the transaction ID from the response. You'll need it for capture, void, or refund operations.
</Warning>

### Authorize with Failover

Orchestra's multi-gateway failover automatically retries an authorization on a backup gateway if the primary fails. For authorize requests, failover isn't a field you pass in the request body: it's configured on your Payment Gateway Account setup.

<Card title="Contact Support" icon="headset" href="mailto:support@orchestrasolutions.com">
  Email **[support@orchestrasolutions.com](mailto:support@orchestrasolutions.com)** to enable multi-gateway failover for your authorize requests.
</Card>

<Warning>
  When using failover with authorize, check which gateway processed the transaction in the response. Use the same gateway for the subsequent capture, void, or refund.
</Warning>

See [Multi-Gateway Failover](/guides/rest-api/multi-gateway-failover) for how Orchestra's failover mechanism works, including a self-serve example on the eWallet checkout session endpoint.

***

## Capture

Capture an existing authorization to complete the transaction. Uses **PUT** method.

<Note>
  Capture requires re-sending the `currency`, `card`, and other details from the original authorization.
</Note>

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/capture', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
      'X-Api-Key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      refTransId: 'original-transaction-id',
      amount: 45.00,
      currency: 'USD',
      paymentGatewayAccountName: 'stripeProduction',
      card: {
        cardNumber: '4111111111111111',
        cardHolderName: 'Jane Smith',
        expirationMonth: 12,
        expirationYear: 2027,
        cvv: '123'
      }
    })
  });
  ```

  ```bash cURL theme={null}
  curl -X PUT https://api.orchestrasolutions.com/PaymentGateway/capture \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: YOUR_API_KEY" \
    -d '{
      "refTransId": "original-transaction-id",
      "amount": 45.00,
      "currency": "USD",
      "paymentGatewayAccountName": "stripeProduction",
      "card": {
        "cardNumber": "4111111111111111",
        "cardHolderName": "Jane Smith",
        "expirationMonth": 12,
        "expirationYear": 2027,
        "cvv": "123"
      }
    }'
  ```

  ```python Python theme={null}
  response = requests.put(
      'https://api.orchestrasolutions.com/PaymentGateway/capture',
      headers={
          'Content-Type': 'application/json',
          'X-Api-Key': 'YOUR_API_KEY'
      },
      json={
          'refTransId': 'original-transaction-id',
          'amount': 45.00,
          'currency': 'USD',
          'paymentGatewayAccountName': 'stripeProduction',
          'card': {
              'cardNumber': '4111111111111111',
              'cardHolderName': 'Jane Smith',
              'expirationMonth': 12,
              'expirationYear': 2027,
              'cvv': '123'
          }
      }
  )
  ```
</CodeGroup>

<Card title="Capture API Reference" icon="code" href="/api-reference/paymentgateway/perform-a-payment-gateway-capture-operation">
  Complete parameter reference for capture requests
</Card>

***

## Completing the Transaction

After authorizing, you have three options:

| Action      | When to Use                              |
| ----------- | ---------------------------------------- |
| **Capture** | Ready to fulfill - collect the funds     |
| **Void**    | Cancel before capture - release the hold |
| **Refund**  | Return funds after capture               |

For void and refund operations, see [Refunds & Voids](/guides/rest-api/refunds-voids).

***

## Authorization Expiration

Authorizations expire if not captured (typically 7-30 days depending on card network). After expiration, the hold is released and you'll need a new authorization.

<Warning>
  Don't rely on authorization expiration to release holds. If you're not going to capture, void the authorization explicitly.
</Warning>

## Related

<CardGroup cols={2}>
  <Card title="Refunds & Voids" icon="rotate-left" href="/guides/rest-api/refunds-voids">
    Cancel or reverse transactions
  </Card>
</CardGroup>
