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

# get_transaction_status

> Fetches the on-chain status of a transaction from StarkNet.

## Usage

```python theme={null}
from chipi_sdk import ChipiSDK, ChipiSDKConfig

sdk = ChipiSDK(config=ChipiSDKConfig(
    api_public_key="pk_prod_YOUR_KEY",
    api_secret_key="sk_prod_YOUR_KEY",
))

status = sdk.get_transaction_status(hash="0x...")
```

### Parameters

* `hash` (str): Transaction hash (`0x...`)
* `bearer_token` (str, optional): JWT token. Falls back to `api_secret_key`

### Return Value

Returns a `TransactionStatusResponse` with:

* `transaction_hash` (str): Transaction hash
* `status` (OnChainTxStatus): `RECEIVED`, `PENDING`, `ACCEPTED_ON_L2`, `ACCEPTED_ON_L1`, `REJECTED`, `REVERTED`, or `NOT_RECEIVED`
* `block_number` (int, optional): Block number if included
* `revert_reason` (str, optional): Reason if `REVERTED`

## Example Implementation

```python theme={null}
import time
from chipi_sdk import ChipiSDK, ChipiSDKConfig, OnChainTxStatus

sdk = ChipiSDK(config=ChipiSDKConfig(
    api_public_key="pk_prod_YOUR_KEY",
    api_secret_key="sk_prod_YOUR_KEY",
))

terminal = {OnChainTxStatus.ACCEPTED_ON_L1, OnChainTxStatus.REJECTED, OnChainTxStatus.REVERTED}

def wait_for_confirmation(tx_hash: str) -> OnChainTxStatus:
    while True:
        result = sdk.get_transaction_status(tx_hash)
        if result.status in terminal:
            if result.status == OnChainTxStatus.REVERTED:
                print(f"Reverted: {result.revert_reason}")
            return result.status
        time.sleep(3)
```

## Async Version

```python theme={null}
import asyncio

async def main():
    status = await sdk.aget_transaction_status("0x04abc...def")
    print(f"Status: {status.status}")

asyncio.run(main())
```
