BitcoinCash tags that maintain fiat exchange rates

Enter a receiving address and an amount with a currency-code supported by Coinbase. A QR Code will be generated that will maintain its BCH exchange rate over time.



Save Image
What does this do?

This service generates printable QR Codes (Payment URLs) whose value amounts can be specified in fiat (e.g. USD). When a user scans these QR Codes/Payment URLs into their wallet, the fiat amount specified is converted to its BCH equivalent using Coinbase Exchange Rates.

This helps mitigate BCH price volatility relative to fiat. If $1USD is the amount specified on the QR Code, this will always be converted to its BCH equivalent at the time the user scans it, meaning that in real-life self-serve scenarios the QR Codes will not need constant reprinting.

Some examples of where this may be useful are given below:

Market Stalls

A QR Code could be printed and attached to each product, allowing customers to self-serve.

Beer Fridge

A QR Code could be placed on a fridge encouraging beer-bandits to reimburse the cost of the beer(s) they stole.

Bills

A QR Code could be placed on a bill with Webhook+Metadata to allow payment in BCH.

API

CashTags is just a URL with query parameters attached. For example:
https://v1.tags.infra.cash?to=YOUR_ADDRESS&a=10USD

The following URL Query Parameters are supported:

NameParameterDescription
TotoBitcoin Cash Address that the funds should be sent to.
AmountaThe amount to send with a currency code appended (if no currency code is given amount will be in sats).
Memom Memo to show on Invoice.
(Unfortunately, it does not look the Bitcoin.com Wallet displays BIP70 Payment Request memos at this point in time)
Memo Paidmp Memo to show once invoice is paid.
If set to "auto" will generate a reference number between 0-9999 which can be used as an order number for things like food-stands.
(As with the above, it does not look the Bitcoin.com Wallet displays BIP70 PaymentAck memos at this point in time)
Webhookwh An optional webhook URL that can be triggered when transaction is broadcasting/broadcast/confirmed.
Webhook is synchronous and the transaction will be aborted if a 200 response is not returned.
Webhook DatadAn optional data parameter that will be sent in the webhook above.

To make it so that this QR Code can be opened with a Bitcoin Cash Wallet, this link should then be prefixed with the bitcoincash:?r= protocol handler and the query parameters URL Encoded (see encodeURIComponent).

bitcoincash:?r=https://v1.tags.infra.cash%3Fto%3Dqqx7mqmz2984s3p7r5wzhmm6lulrh3axl5pfsrgnm3%26a%3D1USD

For those that would like to create their own custom flow (e.g. for bulk printing), the below Javascript snippet can be used.

// USE DASHES INSTEAD OF SPACES FOR MEMO TO ENSURE COMPATIBILITY WITH BITCOIN.COM WALLET
function generateCashTagURL(to, amount, options = {}, server = 'https://v1.tags.infra.cash') {
  options = Object.assign({
    to: to,
    a: amount
  }, options)

  const url = new URL(server)

  Object.keys(options).forEach(param => {
    url.searchParams.append(param, options[param])
  })

  return `bitcoincash:${url.origin}${encodeURIComponent(url.searchParams.toString())}`
}
Under the hood

The link generates a BIP70/JSONPaymentProtocol invoice on-the-fly each time it is scanned (with the given address/amount) leveraging CashPayServer.

This means that the amount given (e.g. 1USD) is converted as per the rates stored in CashPayServer which leverages CoinBase's exchange rates, refreshed every 5 minutes.

Fundamentally, the endpoint generates an invoice using CashPayServer and then simply 'proxies' the response back to the user's wallet. All other interactions are handled by CashPayServer itself.

Disclaimer

No warranty of any form is provided. As such, this service should be used for testing purposes only. For those that wish to use it beyond test-cases, it is advised that you self-host an instance of both CashTags and CashPayServer.

If you need help with this, feel free to contact me.