> ## 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.

# Refunds & Voids

> Return funds with refunds or cancel authorizations with voids via the REST API.

<Info>
  This page is part of the **REST API Guides**. Card capture happens in the frontend through the Payments Library; see the [Payments Library Guides](/guides/library/setup).
</Info>

**Prerequisites:** [API key](/getting-started/generate-api-key), [Payment Gateway Account](/getting-started/add-payment-provider), and an existing transaction to refund or void.

Use void to cancel an authorization before capture, or refund to return funds after a transaction has been captured.

## When to Use Each

| Operation | Use When |
| - | - |
| **Void** | Cancel an authorization before capturing funds |
| **Refund** | Return funds after a charge or capture has completed |

<Note>
  Voids release the hold on the customer's card immediately. Refunds may take 5-10 business days to appear on the customer's statement.
</Note>

## Void

Cancel an authorization before capturing. Uses **DELETE** method.

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

The standard integration voids a token captured by the Payments Library. Reference it in the `cardNumber` field with an `@` prefix; `cvv` is optional and can be left out for a tokenized card.

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

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

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

  response = requests.delete(
      'https://api.orchestrasolutions.com/PaymentGateway/void',
      headers={
          'Content-Type': 'application/json',
          'X-Api-Key': 'YOUR_API_KEY'
      },
      json={
          'refTransId': 'original-transaction-id',
          'amount': 50.00,
          'currency': 'USD',
          'paymentGatewayAccountName': 'stripeProduction',
          'card': {
              'cardNumber': '@YOUR_TOKEN',
              'cardHolderName': 'Jane Smith',
              'expirationMonth': 12,
              'expirationYear': 2027
          }
      }
  )
  ```
</CodeGroup>

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

***

## Refund

Refund a captured transaction. Uses **PUT** method.

The standard integration refunds a token captured by the Payments Library (for example with the library's `CHARGE_AND_TOKENIZE` operation or via [String Tokens](/guides/rest-api/tokenization)). Pass it in `card.cardNumber` with an `@` prefix; there is no dedicated token field on refund or void.

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

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

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

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

<Note>
  The token replaces the card number only. You must still send `cardHolderName`, `expirationMonth`, and `expirationYear`. When tokenizing through the library, these are returned alongside the token in `tokenAndMaskedCardModel.bankCard`.
</Note>

<Warning>
  Gateway-native tokens (`gatewayToken` from [Gateway Tokenization](/guides/rest-api/gateway-tokenization)) are not accepted on refund or void. The `userToken` field exists only on charge and authorize. Use a String Token (`@` prefix) here instead.
</Warning>

### Partial Refunds

You can refund less than the original amount:

```javascript theme={null}
// Original charge was $100.00
// Refund only $25.00
const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/refund', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    refTransId: 'original-transaction-id',
    amount: 25.00,  // Partial refund
    currency: 'USD',
    paymentGatewayAccountName: 'stripeProduction',
    card: {
      cardNumber: '@YOUR_TOKEN',
      cardHolderName: 'Jane Smith',
      expirationMonth: 12,
      expirationYear: 2027
    }
  })
});
```

***

## Sending Raw Card Details (Non-Standard)

<Warning>
  These examples show raw card details for completeness. Sending raw card data means it passes through your systems and puts you in PCI DSS scope. The standard integration captures the card with the Payments Library and references it here as a token (an `@TOKEN` value in the `cardNumber` field); see [Void](#void) and [Refund](#refund) above.
</Warning>

### Void

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

  ```bash cURL theme={null}
  curl -X DELETE https://api.orchestrasolutions.com/PaymentGateway/void \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: YOUR_API_KEY" \
    -d '{
      "refTransId": "original-transaction-id",
      "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.delete(
      'https://api.orchestrasolutions.com/PaymentGateway/void',
      headers={
          'Content-Type': 'application/json',
          'X-Api-Key': 'YOUR_API_KEY'
      },
      json={
          'refTransId': 'original-transaction-id',
          'amount': 50.00,
          'currency': 'USD',
          'paymentGatewayAccountName': 'stripeProduction',
          'card': {
              'cardNumber': '4111111111111111',
              'cardHolderName': 'Jane Smith',
              'expirationMonth': 12,
              'expirationYear': 2027,
              'cvv': '123'
          }
      }
  )
  ```
</CodeGroup>

### Refund

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

## Related

<CardGroup cols={2}>
  <Card title="Authorize & Capture" icon="lock" href="/guides/rest-api/authorize-capture">
    Full transaction lifecycle
  </Card>

  <Card title="Transaction Status" icon="magnifying-glass" href="/guides/rest-api/transaction-status">
    Check refund status
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.