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

# Transaction Status

> Check the status of previous transactions.

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

Query the status of a previously submitted charge or authorization. Useful for reconciliation and handling timeout scenarios.

**Endpoint**: `POST /PaymentGateway/status`

## Check by Transaction ID

Look up a transaction using the gateway's transaction ID (returned from charge/authorize):

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/status', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Api-Key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      refTransId: 'txn_abc123',
      paymentGatewayAccountName: 'stripe-production'
    })
  });

  const result = await response.json();
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.orchestrasolutions.com/PaymentGateway/status \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: YOUR_API_KEY" \
    -d '{
      "refTransId": "txn_abc123",
      "paymentGatewayAccountName": "stripe-production"
    }'
  ```

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

  response = requests.post(
      'https://api.orchestrasolutions.com/PaymentGateway/status',
      headers={
          'Content-Type': 'application/json',
          'X-Api-Key': 'YOUR_API_KEY'
      },
      json={
          'refTransId': 'txn_abc123',
          'paymentGatewayAccountName': 'stripe-production'
      }
  )
  ```
</CodeGroup>

## Check by Your Reference

Look up a transaction using your custom reference (`myRef` from the original request):

```javascript theme={null}
const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/status', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    myRef: 'order-12345',
    paymentGatewayAccountName: 'stripe-production'
  })
});
```

<Note>
  Using `myRef` requires that you passed a custom reference when creating the original transaction.
</Note>

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

## Response

```json theme={null}
{
  "operationType": "Status",
  "operationResultCode": "Success",
  "operationResultDescription": "Transaction found",
  "gatewayName": "Stripe",
  "gatewayReference": "txn_abc123",
  "gatewayResultCode": "succeeded",
  "gatewayResultDescription": "Payment completed",
  "amount": 25.00,
  "currency": "USD"
}
```

## Use Cases

### Handling Timeouts

If a charge request times out, check the status before retrying to avoid duplicate charges:

```javascript theme={null}
async function chargeWithRetry(chargeData) {
  try {
    const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/charge', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-Api-Key': 'YOUR_API_KEY'
      },
      body: JSON.stringify({
        ...chargeData,
        myRef: `order-${Date.now()}`  // Always include a reference
      }),
      signal: AbortSignal.timeout(30000)
    });
    return await response.json();
  } catch (error) {
    if (error.name === 'TimeoutError') {
      // Check if the transaction went through
      const status = await fetch('https://api.orchestrasolutions.com/PaymentGateway/status', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': 'YOUR_API_KEY'
        },
        body: JSON.stringify({
          myRef: chargeData.myRef,
          paymentGatewayAccountName: chargeData.paymentGatewayAccountName
        })
      });
      return await status.json();
    }
    throw error;
  }
}
```

### Daily Reconciliation

Verify transaction statuses against your records:

```javascript theme={null}
async function verifyTransaction(transactionId, gatewayAccount) {
  const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/status', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Api-Key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      refTransId: transactionId,
      paymentGatewayAccountName: gatewayAccount
    })
  });

  const result = await response.json();
  return {
    found: result.operationResultCode === 'Success',
    status: result.gatewayResultCode,
    amount: result.amount
  };
}
```

## Related

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