bindpay
  • Introduction
  • Use Cases
  • Active Chains
  • Suggested Settlements
  • Sanctioned Countries
  • API
    • Get Started
    • Request Quote
      • Guide
    • Executing a Quote
    • Transaction Status
    • Successful Transactions
  • Sub-Payees
    • Create Sub-Payee
    • Update Sub-Payee
    • Deactivate Sub-Payee
  • For Individuals
    • slipt app
Powered by GitBook
On this page
  • Authentication
  • Query Parameters
  1. API

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.

Example Request

# 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"
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)
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);
}
require 'net/http'
require 'json'
require 'uri'

def get_transaction_status(api_key:, transaction_id: nil, source_hash: nil, destination_hash: nil)
  base_url = 'https://api.bindpay.xyz/v1/status'
  
  query_params = {}
  query_params['transactionId'] = transaction_id if transaction_id
  query_params['sourceHash'] = source_hash if source_hash
  query_params['destinationHash'] = destination_hash if destination_hash
  
  uri = URI(base_url)
  uri.query = URI.encode_www_form(query_params)
  
  request = Net::HTTP::Get.new(uri)
  request['x-api-key'] = api_key
  
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end
  
  JSON.parse(response.body)
end

# Example usage
api_key = 'your_api_key'
result = get_transaction_status(
  api_key: api_key,
  transaction_id: '67299f9f617d20cb18b37640'
)
puts result
// 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;
}

Response

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

Successful Response

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

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

PreviousExecuting a QuoteNextSuccessful Transactions

Last updated 5 months ago