0

This is probably a basic question but I can not find an answer.

We are developing a BTC payment process for a Point-of-Sale. We have managed to build this fine and can make requests (QR code) for a payment amount in BTC. for example 0.0001 BTC

We then check the blockchain for an equivalent transaction on our address of amount 0.0001 BTC.

This works.

But seems unreliable. What if there were to be multiple transactions at around the same time for the same amount. I really want to be able to insert a unique identifier/order number or memo into the QR code request which then gets passed onto the transaction. This would link the request to the payment with a unique id. Is there a way to do this? It seems odd if there is not? Or is there another obvious way that I am missing?

We are using https://api.blockcypher.com to get the transaction details. Which look like below. There does not appear to be any kind of a "memo" parameter, although wallets and QR generators allow you to add such.

{
      "tx_hash": "8bbe058b46f2f9a7e1709ca4a3ff731ba2227d23f2edf11eb8710dfcd6b1e502",
      "block_height": 685568,
      "tx_input_n": -1,
      "tx_output_n": 0,
      "value": 16692,
      "ref_balance": 3417334,
      "spent": false,
      "confirmations": 4,
      "confirmed": "2021-05-30T22:09:51Z",
      "double_spend": false
    },
4

The only right way of of doing this is generating a new address for every expected payment, and then waiting until you've received that amount on that address.

3
  • 2
    Came here to write that. Use a new address for each invoice.
    – Murch
    May 30 at 23:15
  • Thanks... I guess thats a whole area we have missed out. At the moment assumption is that we store a fixed public address. Are there simple/free api's to generate multiple addesses on the fly for this purpose?
    – dacology
    May 30 at 23:26
  • 2
    Most wallets software will even make it hard for you to reuse addresses. When you request an address, you get a new one. Integrated POS systems like BTCPayServer do the same. May 31 at 1:13

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.