> ## 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**. Using the JavaScript library instead? See [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>

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

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

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

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

### 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: '4111111111111111',
      cardHolderName: 'Jane Smith',
      expirationMonth: 12,
      expirationYear: 2027,
      cvv: '123'
    }
  })
});
```

***

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