0

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.

0

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:
https://api.blockcypher.com/v1/btc/main/txs/ca1662e85e137fae3ec13dace7f4bf64801a1ebdc8433150566b2ae838498a8a
Response:

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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