> For the complete documentation index, see [llms.txt](https://docs.bindpay.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindpay.xyz/api/transaction-status.md).

# Transaction Status

API Documentation for checking transaction status - don't hesitate to reach out for additional support at support\@bindpay.xyz

**Endpoint**

```
GET https://api.bindpay.xyz/v1/status
```

### Authentication

Include your API key in the request headers:

```
x-api-key: your_api_key
```

### Query Parameters

| Parameter       | Type   | Required | Description                                        |
| --------------- | ------ | -------- | -------------------------------------------------- |
| transactionId   | string | No       | The transaction ID returned from the quote request |
| sourceHash      | string | No       | The source transaction hash                        |
| destinationHash | string | No       | The destination transaction hash                   |

#### Notes

* **At least one of these parameters must be provided**
* TransactionId is returned at the top of each quote request.&#x20;

#### Example Request

{% tabs %}
{% tab title="cURL" %}
{% code lineNumbers="true" %}

```javascript
# Using Transaction ID
curl -X GET "https://api.bindpay.xyz/v1/status?transactionId=67299f9f617d20cb18b37640" \
  -H "x-api-key: your_api_key"

# Using Source Hash
curl -X GET "https://api.bindpay.xyz/v1/status?sourceHash=0x123..." \
  -H "x-api-key: your_api_key"

# Using Destination Hash
curl -X GET "https://api.bindpay.xyz/v1/status?destinationHash=0x456..." \
  -H "x-api-key: your_api_key"
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
import requests

def get_transaction_status(api_key, transaction_id=None, source_hash=None, destination_hash=None):
    url = "https://api.bindpay.xyz/v1/status"
    headers = {
        "x-api-key": api_key
    }
    
    params = {}
    if transaction_id:
        params["transactionId"] = transaction_id
    elif source_hash:
        params["sourceHash"] = source_hash
    elif destination_hash:
        params["destinationHash"] = destination_hash
    
    response = requests.get(url, headers=headers, params=params)
    return response.json()

# Example usage
api_key = "your_api_key"
result = get_transaction_status(api_key, transaction_id="67299f9f617d20cb18b37640")
print(result)
```

{% endcode %}
{% endtab %}

{% tab title="Rust" %}
{% code lineNumbers="true" %}

```rust
use reqwest;
use serde_json::Value;

async fn get_transaction_status(
    api_key: &str,
    transaction_id: Option<&str>,
    source_hash: Option<&str>,
    destination_hash: Option<&str>,
) -> Result<Value, reqwest::Error> {
    let client = reqwest::Client::new();
    let mut url = reqwest::Url::parse("https://api.bindpay.xyz/v1/status").unwrap();

    if let Some(id) = transaction_id {
        url.query_pairs_mut().append_pair("transactionId", id);
    } else if let Some(hash) = source_hash {
        url.query_pairs_mut().append_pair("sourceHash", hash);
    } else if let Some(hash) = destination_hash {
        url.query_pairs_mut().append_pair("destinationHash", hash);
    }

    let response = client
        .get(url)
        .header("x-api-key", api_key)
        .send()
        .await?
        .json()
        .await?;

    Ok(response)
}

// Example usage
#[tokio::main]
async fn main() {
    let api_key = "your_api_key";
    let result = get_transaction_status(
        api_key,
        Some("67299f9f617d20cb18b37640"),
        None,
        None
    ).await.unwrap();
    println!("{:#?}", result);
}
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}

<pre class="language-ruby" data-line-numbers><code class="lang-ruby"><strong>require 'net/http'
</strong><strong>require 'json'
</strong><strong>require 'uri'
</strong><strong>
</strong><strong>def get_transaction_status(api_key:, transaction_id: nil, source_hash: nil, destination_hash: nil)
</strong>  base_url = 'https://api.bindpay.xyz/v1/status'
<strong>  
</strong><strong>  query_params = {}
</strong><strong>  query_params['transactionId'] = transaction_id if transaction_id
</strong><strong>  query_params['sourceHash'] = source_hash if source_hash
</strong><strong>  query_params['destinationHash'] = destination_hash if destination_hash
</strong>  
<strong>  uri = URI(base_url)
</strong>  uri.query = URI.encode_www_form(query_params)
  
<strong>  request = Net::HTTP::Get.new(uri)
</strong><strong>  request['x-api-key'] = api_key
</strong><strong>  
</strong><strong>  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
</strong><strong>    http.request(request)
</strong><strong>  end
</strong><strong>  
</strong><strong>  JSON.parse(response.body)
</strong><strong>end
</strong>
<strong># Example usage
</strong><strong>api_key = 'your_api_key'
</strong>result = get_transaction_status(
  api_key: api_key,
<strong>  transaction_id: '67299f9f617d20cb18b37640'
</strong><strong>)
</strong><strong>puts result
</strong></code></pre>

{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
// Using fetch
async function getTransactionStatus({ 
  apiKey, 
  transactionId = null, 
  sourceHash = null, 
  destinationHash = null 
}) {
  const params = new URLSearchParams();
  if (transactionId) params.append('transactionId', transactionId);
  if (sourceHash) params.append('sourceHash', sourceHash);
  if (destinationHash) params.append('destinationHash', destinationHash);

  const response = await fetch(
    `https://api.bindpay.xyz/v1/status?${params}`,
    {
      method: 'GET',
      headers: {
        'x-api-key': apiKey
      }
    }
  );

  return await response.json();
}

// Example usage
const apiKey = 'your_api_key';
getTransactionStatus({ 
  apiKey, 
  transactionId: '67299f9f617d20cb18b37640' 
})
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

// Using axios
import axios from 'axios';

async function getTransactionStatus({ 
  apiKey, 
  transactionId = null, 
  sourceHash = null, 
  destinationHash = null 
}) {
  const params = {};
  if (transactionId) params.transactionId = transactionId;
  if (sourceHash) params.sourceHash = sourceHash;
  if (destinationHash) params.destinationHash = destinationHash;

  const response = await axios.get('https://api.bindpay.xyz/v1/status', {
    params,
    headers: {
      'x-api-key': apiKey
    }
  });

  return response.data;
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response

The API will respond with a JSON object containing the transaction details and status.

**Successful Response**

```json
{
    "requestSuccess": true,
    "transaction": {
        "id": "67299f9f617d20cb18b37640",
        "status": "Pending",
        "type": "Direct",
        "fromChain": "8453",
        "toChain": "8453",
        "fromToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "toToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "fromAmount": "9992999",
        "usdAmount": 10,
        "sourceTransactionHash": "0x123...", 
        "destinationTransactionHash": "0x456...", // Relevant for Cross-chain transfers
        "createdAt": "2024-11-05T04:31:27.751Z",
        "updatedAt": "2024-11-05T04:31:27.751Z"
    }
}
```

#### Transaction Status Types

| Status    | Description                                 |
| --------- | ------------------------------------------- |
| Pending   | Transaction is being processed              |
| Completed | Transaction has been successfully completed |
| Failed    | Transaction has failed                      |

#### Error Codes

| Status Code | Error Type            | Description                 |
| ----------- | --------------------- | --------------------------- |
| 400         | Bad Request           | Missing required parameters |
| 404         | Not Found             | Transaction not found       |
| 500         | Internal Server Error | Server error                |

#### Example Error Response

```json
{
    "success": false,
    "error": "error message"
}
```

#### Error Handling

* All timestamps are in ISO 8601 format
* Transaction hashes are only present after the transaction is processed
* The API uses rate limiting (100 requests per 15 minutes per IP)
* For cross-chain transfers, both source and destination hashes may be present
* For direct transfers, only sourceTransactionHash will be present when completed

For more information on error handling and response codes, please refer to our Error Handling documentation or get in contact with <support@bindpay.xyz>.
