# Order Status (CCSTATUS)

Look up the full transaction history of an order by the gateway's order ID or your own external reference.

Source: https://developer.inoviopay.com/api/status.html  
Markdown: https://developer.inoviopay.com/api/status.md

Check the status of an order. You can query using the Gateway's Order ID or your external reference ID.

**POST** `https://api.inoviopay.com/payment/pmt_service.cfm`

### Request Parameters

| Parameter | Description |
|---|---|
| `REQUEST_ACTION` (required) | Must be set to `CCSTATUS`. |
| `REQUEST_REF_PO_ID` (optional) | Lookup using the Gateway's `PO_ID`. |
| `REQUEST_REF_PO_ID_XTL` (optional) | Lookup using the Merchant's `XTL_ORDER_ID`. |

### Handling the Response

Unlike standard transaction responses, `CCSTATUS` returns a matrix format to accommodate the entire lifecycle of an order. The response contains two arrays: a `COLUMNS` array defining the fields, and a `DATA` array containing one or more rows of transaction events (e.g., the original authorization, subsequent captures, refunds, or chargebacks).

| Array Name | Description |
|---|---|
| `COLUMNS` | An ordered list of string values representing the field names (e.g., `REQUEST_ACTION`, `TRANS_STATUS_NAME`, `TRANS_VALUE`). |
| `DATA` | An array of arrays. Each inner array represents a distinct transaction event tied to the order. To parse the data, map the index of a value in the inner array to the corresponding index in the `COLUMNS` array. |

For example, in the response below, `COLUMNS[0]` is `REQUEST_ACTION` and `COLUMNS[1]` is `TRANS_STATUS_NAME`, so `DATA[0][0]` (`"CCAUTHCAP"`) and `DATA[0][1]` (`"APPROVED"`) describe the same event: the first row's request action and its status. The response below has three rows: the original `CCAUTHCAP`, a subsequent `CCCREDIT`, and a `CCCHARGEBACK`, each identified the same way by walking `COLUMNS` alongside the row.

**cURL**

```bash
curl -X POST "https://api.inoviopay.com/payment/pmt_service.cfm" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "request_action=CCSTATUS&req_username=api_user&req_password=P%40ssw0rd%21&site_id=12345&request_api_version=4.14&request_response_format=JSON&request_ref_po_id_xtl=INV-999"
```

**PHP**

```php
use Inovio\Gateway\{Credentials, InovioClient};
use Inovio\Gateway\Refs\Refs;

$client = new InovioClient(new Credentials('api_user', 'P@ssw0rd!', '12345'), 'SANDBOX');

$s = $client->status(Refs::xtlOrder('INV-999'));

echo 'legs=', count($s->transactions), "\n";
echo 'authorized=', $s->authorized->toWire(), "\n";
echo 'captured=', $s->captured->toWire(), "\n";
echo 'refunded=', $s->refunded->toWire(), "\n";
echo 'net=', $s->net->toWire(), "\n";              // captured - refunded
echo 'outstanding=', $s->outstanding->toWire(), "\n"; // authorized - captured
```

**Node**

```ts
import { InovioClient, Refs } from '@inovio/gateway-sdk';

const client = new InovioClient(
  { reqUsername: 'api_user', reqPassword: 'P@ssw0rd!', siteId: '12345' },
  { environment: 'SANDBOX' }
);

const s = await client.status(Refs.xtlOrder('INV-999'));

console.log('legs=', s.transactions.length);
console.log('authorized=', s.authorized?.amount);
console.log('captured=', s.captured?.amount);
console.log('refunded=', s.refunded?.amount);
console.log('net=', s.net?.amount);                 // captured - refunded
console.log('outstanding=', s.outstanding?.amount);  // authorized - captured
```

**Python**

```python
from inovio_gateway import Credentials, InovioClient, Refs

client = InovioClient(Credentials("api_user", "P@ssw0rd!", "12345"), environment="SANDBOX")

s = client.status(Refs.xtl_order("INV-999"))

print("legs=", len(s.transactions))
print("authorized=", s.authorized.to_wire())
print("captured=", s.captured.to_wire())
print("refunded=", s.refunded.to_wire())
print("net=", s.net.to_wire())                # captured - refunded
print("outstanding=", s.outstanding.to_wire())  # authorized - captured
```

**Java**

```java
import com.inoviopay.gateway.refs.Refs;
import com.inoviopay.gateway.result.OrderStatus;

OrderStatus s = client.status(Refs.xtlOrder("INV-999"));

System.out.println("legs=" + s.transactions().size());
System.out.println("authorized=" + s.authorized().toWire());
System.out.println("captured=" + s.captured().toWire());
System.out.println("refunded=" + s.refunded().toWire());
System.out.println("net=" + s.net().toWire());                 // captured - refunded
System.out.println("outstanding=" + s.outstanding().toWire());  // authorized - captured
```

**Response**

```json
{
  "COLUMNS": [
    "REQUEST_ACTION",
    "TRANS_STATUS_NAME",
    "TRANS_VALUE",
    "TRANS_ID",
    "CUST_ID",
    "XTL_CUST_ID",
    "PO_ID",
    "XTL_ORDER_ID",
    "BATCH_ID",
    "PROC_NAME",
    "MERCH_ACCT_ID",
    "CARD_BRAND_NAME",
    "PMT_ID",
    "PMT_L4",
    "PROC_UDF01",
    "PROC_UDF02",
    "PROC_AUTH_RESPONSE",
    "PROC_RETRIEVAL_NUM",
    "PROC_REFERENCE_NUM",
    "AVS_RESPONSE",
    "CVV_RESPONSE",
    "CURR_CODE_ALPHA",
    "CURR_NAME",
    "TRANS_ID"
  ],
  "DATA": [
    [
      "CCAUTHCAP",
      "APPROVED",
      125.50,
      485729103,
      9820193,
      "xtLCust88",
      8819203,
      "INV-882",
      88291,
      "Inovio Primary",
      110203,
      "Visa",
      3920192,
      "1111",
      "",
      "",
      "AUTH881",
      "B03C2B04-00A5-4179-A9D94F0CDD76197D",
      "REF847156508",
      "M",
      "M",
      "USD",
      "US Dollar",
      485729103
    ],
    [
      "CCCREDIT",
      "APPROVED",
      -25.00,
      485729104,
      9820193,
      "xtLCust88",
      8819203,
      "INV-882",
      88292,
      "Inovio Primary",
      110203,
      "Visa",
      3920192,
      "1111",
      "",
      "",
      "REF291",
      "C14D3C15-11B6-5280-B0E05G1DEE87208E",
      "REF847156509",
      "",
      "",
      "USD",
      "US Dollar",
      485729104
    ],
    [
      "CCCHARGEBACK",
      "APPROVED",
      -100.50,
      485729105,
      9820193,
      "xtLCust88",
      8819203,
      "INV-882",
      88293,
      "Inovio Primary",
      110203,
      "Visa",
      3920192,
      "1111",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "USD",
      "US Dollar",
      485729105
    ]
  ]
}
```
