My team is working for a community of members who make donations in BTC to support a cause from time to time. The donations the details are stored in a database and displayed on their personal profiles.

I am currently looking out for an api that will give me an information about the status of a particular transaction. i.e. whether or not the transaction is confirmed.

  • Did you find any answer? Commented Jun 20, 2023 at 6:09

3 Answers 3


Almost all block explorer APIs have this functionality among their transaction API calls. You should check out their API documentation for more details and see which one is easier for you to use.
Here is an example from blockcypher API using the first non-coinbase transaction of one of the latest blocks:

  "confirmations": 2,

If the transaction is still in the mempool (unconfirmed) the value above shows as 0.

Note that if the purpose is unimportant things such as showing donations using a block explorer is fine, otherwise if the purpose is receiving payments (eg. for a sale) it is a much better idea to use a different method such as running your own full or SPV node.


To answer your question specifically:

  • ideally query your own Bitcoin full node with gettransaction (possible if you can at least import xpubs to watch only wallets)
  • query public block explorers
  • query public Electrum servers

On a broader note though, your problem seems to be already solved by open source tools like BTCPay Server or CypherpunkPay.


To detect transaction status in JSON format for the given bitcoin address on blockchain.info, you can follow these steps:

Send a GET request to the following URL: https://blockchain.info/address/157vxTThwznZQPGmUuSzqGci5DCZAdRDap?format=json

This will return a JSON object containing information about the given Bitcoin address, including the transactions associated with it. Look for the "txs" field in the JSON response.

The "txs" field contains an array of transaction objects. Each transaction object contains a "hash" field that uniquely identifies the transaction, as well as a "confirmations" field that indicates the number of confirmations the transaction has received. A confirmation occurs when a new block is added to the blockchain that includes the transaction.

If the value of the "confirmations" field is zero, the transaction is unconfirmed and its status is pending. If the value is greater than zero, the transaction is confirmed and its status is completed.

So, to detect the transaction status, you need to check the "confirmations" field of each transaction object in the "txs" field. If the "confirmations" field is zero, the transaction is unconfirmed, otherwise, it's confirmed.

  • If you don't have "confirmations" in response. Check "block_height", If not present or null the result is unconfirmed and it's present and has number the result is confirmed.
  • This should be the accepted answer. I should also add that to get the number of confirms itself, fetch the latest block height from blockchain.info and subtract block_height from it, then add 1. (confirmations field is no longer returned in the API it seems). Commented Jun 21, 2023 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.