3

I working on coinpayment gateway I want to generate qr code with address and amount. How to pass amount in google chart api with address?

This code is perfect working for bitcoin:

<img width="220" height="220" src="https://blockchain.info/qr?data=ethereum:<?php echo $result['result']['address']; ?>?amount=<?php echo $result['result']['amount']; ?>%26label=example%2520label">

But these both are not getting amount with address

<center><img width="220" height="220" alt="bitcoin" src="http://chart.apis.google.com/chart?cht=qr&chs=500x500&chl=Ethereum:<?php echo $result['result']['address']; ?>&chld=H|0"></center>

<center><img width="220" height="220" alt="bitcoin" src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=ethereum:0x<?php echo $result['result']['address']; ?>&choe=UTF-8"></center>`
wowkin2
  • 5,895
  • 5
  • 23
  • 66
Mukesh Kumar
  • 57
  • 2
  • 7

4 Answers4

1

I think it's impossible, because even big coin accepting sites like "coinpayments.net" 's qr payment code doesn't include the amount. (But if paid with bitcoin or other currency it does.) Sorry to let you down but the best you could do is

src="https://chart.googleapis.com/chart?chs=300&300&chld=L|2&cht=qr&chl=ethereum:<?php echo $result['result']['address']; ?>"

the link will look somthing like

https://chart.googleapis.com/chart?chs=225x225&chld=L|2&cht=qr&chl=ethereum:0x9610a371F94BE34D4D0CB9c35D621d657133c0e5

no one seems to include their amount...

Tera
  • 121
  • 3
  • 12
0

I have successfully implemented this package: ethereum-qr-code.

It implements the EIP67 standard which uses a value field for the amount-to-pay and an ethereum field for the ETH address.

However, actual usage of the QR protocol is currently very fractured and gives different and unexpected results based on which wallet the user uses.

Some problems we have found with some Ethereum wallets:

  • imToken, BRD wallet, Lykke require a QR field: amount to be ETH

  • Trust wallet requires a QR field: amount to be wei instead of ETH!

  • Toshi wallet crashes on QR code scan (at time of writing 2018-07-24)

  • None of the wallets we tried use the value field...

I have requested the feature to add the option of amount on Github here. And I have myself forked the package here and changed the field called value to amount.

mesqueeb
  • 5,277
  • 5
  • 44
  • 77
0

There is obviously no standard since it's decentralized but the format I have seen used a lot (including by coinbase) is this: ethereum:{0xAddress}?value={wei} without the curly brackets of course

Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
-1

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

ZhaoRachi
  • 49
  • 6