6

I'm creating a Bitcoin QR link with my website, but I want to be able to just link to a page that generates the QR code with the current USD price equivalent of BTC in the QR. I tried blockchain.info, but it only displays the QR code and I can't embed a price into it. How can this be done? I'm trying to use it on checkout where I can pass in a BTC address + USD price to the QR code generator and the user can just pay the exact amount needed without having to lookup how much to pay.

I know bitpay does this, but they also log every transaction to the government. So I rather just use a service that doesn't log anything.

1
  • If you say bitpay does it, just scan one or their QR codes with your phone (with a qr code scanning app) and look at the URL it decodes to. I'm guessing the answers below are correct though and it's not possible.
    – Jannes
    Jun 1, 2016 at 16:12

6 Answers 6

2

However it is possible to generate a bitcoin QR code with a given value in USD, but it is no use since high transaction fees and highly volatile nature of bitcoin. Still, you can use third party services like CoinGate which provides you a real time convertion of USD to almost all major crypto currencies. But CoinGate will show their own BTC address to receive and then they transfer it to your BTC address, so beware! Good luck!

9

You can't include the USD amount, but you certainly can include the btc amount in the QR code. The QR code essentially embeds a text like this:

bitcoin:1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv?amount=0.005

Note the amount here is the amount in BTC. You can generate a QR code for that text using gobitcoin.io. If you just want to insert an image, you can use googleapi.com to generate it. For example, a url like this:

https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=bitcoin:1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv?&amount=0.005

will generate a QR code like this:

enter image description here

4
  • 1
    how do you put in the USD amount into the qr code? I dont care about the usd/btc fluctuations. Jun 1, 2016 at 17:03
  • 3
    You can't put a USD amount as that's not part of the bitcoin QR code spec (BIP0021: github.com/bitcoin/bips/blob/master/bip-0021.mediawiki)
    – Jimmy Song
    Jun 1, 2016 at 17:27
  • 1
    You could create a dynamic QR code based on the current USD value. Something like this jsfiddle.net/74saant8
    – m1xolyd1an
    Jun 2, 2016 at 1:20
  • There's an error in your google chart example, it should be bitcoin:1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv?amount=0.005 (without the ampersand in this case)
    – ethmz
    May 24, 2018 at 12:32
1

Check out https://github.com/shesek/bitcoinuri. Make sure to read the warnings.

0

Due to how much the USD/BTC conversion rate can fluctuate, even within a small window of time, I don't think this is a good idea.

The problem is that you are now listing two separate prices in one QR code. Yes, they were the same at the time of generation, but that won't last. When payment is received, which price is the real one? The one in bitcoin, or the one in dollars?

If you are receiving payment in bitcoin, then it's best you simply list your price in bitcoin. It is usually the responsibility of wallet software to show the user any conversion to USD, and that depends on which exchange they are using as their oracle. The user may not have access to the same exchange as you, so bitcoin may be more or less expensive to them in USD. It's best to leave that conversion rate configuration up to your users, within their own wallet software.

2
  • 1
    ok then how do I embed a USD amount into the qr then? I don't mind the fluctuations Jun 1, 2016 at 17:02
  • Because it's a bad idea, a standard was never developed for embedding fiat prices. You could make one up, but that doesn't mean that wallets will know anything about it. What sort of reader do you expect to display this dollar amount? No bitcoin wallet will display your embedded dollar amount, and some may even be unable to read the QR code because of it. Trust me, this is a bad idea.
    – Jestin
    Jun 1, 2016 at 17:14
0

You can do it with javascript and using google's QR code URL.

First get the price from somewhere like bitcoinaverage.com
https://api.bitcoinaverage.com/ticker/global/USD/

Then divide the USD amount into the BTC price, restrict to 8 decimal places and stick it in the QR code URL.

Here I made a fiddle, just change usdValue variable to whatever you want. https://jsfiddle.net/74saant8/

0

You can make bitcoin qr code in one of a lot of mobile application. For bitcoin the scheme is like "bitcoin:address". You can also use website with generator to do it. Some websites eg. https://bitcoinqrcodegenerator.win add a nice bitcoin logo to the qr code to know that the code belongs to bitcoin.

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