<p>The best way to encode an amount in an on-chain bitcoin QR code is to generate a QR code from a BIP 21 URI scheme.</p>
<p>For example, if you wanted the payer to send 1 bitcoin to address
<code>175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W</code>, you would encode the following string into a QR code and display it to the payer.</p>
<pre><code>bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1.0
</code></pre>
<p>Any payer using a BIP 21 compatible wallet will be able to scan a QR code of this format. It's important to be aware that this does <em>NOT</em> force the payer to pay this amount. This amount field is merely a suggestion to help wallets autofill or suggest an amount to pay. In other words, when accepting bitcoin payments you must still check your wallet software to make sure that the correct amount was payed, even if you encode it in a BIP 21 URI scheme.</p>
<p>View full BIP 21 scheme options here:
<a href="https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki" rel="nofollow noreferrer">https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki</a></p>
<p>View a non-comprehensive list of supported wallets/services here:
<a href="https://bitcoinqr.dev/" rel="nofollow noreferrer">https://bitcoinqr.dev/</a></p>
<hr />
<p>If you would like a stricter payment flow,  I suggest you look into supporting BOLT-11 invoices (which can be wrapped in a BIP 21 URI) using the lightning network. Lightning invoices require that the payer sends the exact specified amount for the payment to go through. Although accepting bitcoin lightning payments does require more infrastructure and maintenance overhead, it offers a superior receiving experience in this regard.</p>
<p>View BOLT 11 spec here: <a href="https://github.com/lightning/bolts/blob/master/11-payment-encoding.md" rel="nofollow noreferrer">https://github.com/lightning/bolts/blob/master/11-payment-encoding.md</a></p>

CC BY-SA 4.0
2022-09-10T15:24:32.960Z
2022-09-10T15:24:32.960Z
jpkiser
<p>Please refer to the title of my question.<br>
This is how I am generating QR code in PHP:</p>
<p><a href="https://chart.googleapis.com/chart?chs=250x250&amp;cht=qr&amp;chl=BTC_ADDRESS" rel="nofollow noreferrer">https://chart.googleapis.com/chart?chs=250x250&amp;cht=qr&amp;chl=BTC_ADDRESS</a></p>
<p>I want user to just scan and pay the amount of BTC set in the QR code
Is it possible ? Please help.
Thanks in Advance!</p>

CC BY-SA 4.0
2022-09-01T18:51:23.220Z
Does this answer your question? [Bitcoin QR codes: raw address or Bitcoin URI scheme](https://bitcoin.stackexchange.com/questions/21656/bitcoin-qr-codes-raw-address-or-bitcoin-uri-scheme) but see also [bip21](https://en.bitcoin.it/wiki/BIP_0021)
RedGrittyBrick
CC BY-SA 4.0
2022-09-01T19:38:54.317Z
Thanks. @RedGrittyBrick Can you please also suggest any API in PHP, that converts Euro to amount of BTC.  For example: 100 Euro to amount of BTC
abhishek sharma
<php><receiving><bip21-uri>
Can we pass amount of BTC in generating QR code?
abhishek sharma
# Can we pass amount of BTC in generating QR code?

(Asked by: username_0 on 2022-09-01)

Please refer to the title of my question.  
This is how I am generating QR code in PHP:

<https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=BTC_ADDRESS>

I want user to just scan and pay the amount of BTC set in the QR code
Is it possible ? Please help.
Thanks in Advance!

**Tags:** php, receiving, bip21-uri

> **Comments:**
> **username_1**: Does this answer your question? [Bitcoin QR codes: raw address or Bitcoin URI scheme](https://bitcoin.stackexchange.com/questions/21656/bitcoin-qr-codes-raw-address-or-bitcoin-uri-scheme) but see also [bip21](https://en.bitcoin.it/wiki/BIP_0021)  
> **username_0**: Thanks. @username_1 Can you please also suggest any API in PHP, that converts Euro to amount of BTC.  For example: 100 Euro to amount of BTC  

---

## 1 answers

### Answer by username_2 on 2022-09-10. Score: 1

The best way to encode an amount in an on-chain bitcoin QR code is to generate a QR code from a BIP 21 URI scheme.

For example, if you wanted the payer to send 1 bitcoin to address
`175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W`, you would encode the following string into a QR code and display it to the payer.

```
bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1.0

```

Any payer using a BIP 21 compatible wallet will be able to scan a QR code of this format. It's important to be aware that this does *NOT* force the payer to pay this amount. This amount field is merely a suggestion to help wallets autofill or suggest an amount to pay. In other words, when accepting bitcoin payments you must still check your wallet software to make sure that the correct amount was payed, even if you encode it in a BIP 21 URI scheme.

View full BIP 21 scheme options here:
<https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki>

View a non-comprehensive list of supported wallets/services here:
<https://bitcoinqr.dev/>

---

If you would like a stricter payment flow, I suggest you look into supporting BOLT-11 invoices (which can be wrapped in a BIP 21 URI) using the lightning network. Lightning invoices require that the payer sends the exact specified amount for the payment to go through. Although accepting bitcoin lightning payments does require more infrastructure and maintenance overhead, it offers a superior receiving experience in this regard.

View BOLT 11 spec here: <https://github.com/lightning/bolts/blob/master/11-payment-encoding.md>


---

