<p>My tool, <a href="https://cashaddress.github.io/paymentbridge.html" rel="nofollow noreferrer">PaymentBridge</a>? It aims to solve your question. It's completely client-side, safe to use, but don't broadcast the transaction after creating it. Paste it when it asks you for the transaction. Good luck!</p>

<p>And, there you go: <a href="https://github.com/bitpay/jsonPaymentProtocol/blob/master/specification.md" rel="nofollow noreferrer">https://github.com/bitpay/jsonPaymentProtocol/blob/master/specification.md</a></p>

<p>Have you set the <code>Content-Type</code> to <code>application/payment</code>?</p>

CC BY-SA 3.0
2018-03-26T16:10:06.093Z
Good find on the bitpay spec on github. It seems "Accept: application/payment-request" is exactly the "magic header" I was looking for. I cannot test it now bc the link is now invalid, but I have tentatively accepted your answer. While I do not intend to use your service bc I hate relying on an online service more then necessary, your source code link gave me the info I needed to develop my own local version with bash+curl. For anyone else who may also have this question but who is not willing/able to do the conversion themselves, I tentatively recommend the service linked in this answer.
memtha
CC BY-SA 3.0
2018-03-25T05:54:18.787Z
2018-03-25T06:04:05.727Z
2018-03-25T06:04:05.727Z
MCCCS
<p>The payment protocol is only usable from the GUI (i.e. <code>bitcoin-qt</code>). It is supposed to be an interactive protocol so you cannot use it from the command line which is non-interactive (in the sense that you issue commands and get a response back instead of issue command and interact within the context of that command).</p>

CC BY-SA 3.0
2018-03-26T15:58:00.150Z
This is pretty much what I expected: no built-in cli compatibility. Thx.
memtha
CC BY-SA 3.0
2018-03-25T05:30:41.777Z
2018-03-25T05:30:41.777Z
Ava Chow
<p>Reading between the lines it <em>seems</em> Bitpay <em>may have</em> done this to allow payment with cash when you receive a payment request for Bitcoin.</p>

<p>You may find that there is some code magic in the redirect you experienced that would open/inform your wallet automatically if it has an installed URI handler. bitcoin: links often work on smartphones too but it depends on the wallet to install such handling.</p>

<p>According to Bitpay:  </p>

<blockquote>
  <p><a href="https://support.bitpay.com/hc/en-us/articles/115005559826-How-do-I-pay-without-a-payment-bitcoin-address-" rel="nofollow noreferrer">https://support.bitpay.com/hc/en-us/articles/115005559826-How-do-I-pay-without-a-payment-bitcoin-address-</a></p>
  
  <h2>C. Open the Payment In Your Wallet</h2>
  
  <p>If your wallet is on the device you're using to view the invoice, you can open the payment in your wallet by tapping "Open in wallet". Confirm everything is correct, and you can send the payment from your wallet. </p>
</blockquote>

<p>This "Open in wallet" link should reveal the actual details even if it does not open in your wallet.</p>

<p><em>I cannot test this without an actual Bitpay link.</em></p>

CC BY-SA 3.0
2018-03-26T15:59:08.780Z
I found that article in my brief search. Unfortunately all I was able to get was another link to the same bitcoin: uri. Question updated with link, though it has now expired.
memtha
CC BY-SA 3.0
2018-03-25T05:50:53.393Z
2018-03-26T18:21:00.233Z
2018-03-26T18:21:00.233Z
Willtech
<p>I have a full node running bitcoin-core 0.16 bitcoind (not bitcoin-qt). Today I tried and failed to pay a bitpay "secure" payment protocol uri invoice via the cli. The uri was in the form <code>bitcoin:?r=<a href="https://bitpay.com/i/" rel="nofollow noreferrer">https://bitpay.com/i/</a>...</code> with no visible bitcoin address or amount. (Guess people can't be trusted to copy-paste the address correctly?). Not surprisingly, the usual <code>sendtoaddress</code> method called the uri invalid.</p>

<p>I curled the address hoping to get the real payment details so I could enter them manually, but I just got a 301 redirect to a page on bitpay.com saying the invoice has not been paid. Guess they filter on uagent or some other header.</p>

<p>I also googled it but only found explanations of what the payment protocol is, why bitpay is using it, and how to do it with popular UI wallets. Nothing about cli.</p>

<p>Does anyone know if/how this is possible with cli/rpc only? Or perhaps the magic header bitpay looks for to distinguish a wallet app from a browser so I can get the real address? If not, I plan to open a ticket with bitcoin core devs on adding it.</p>

<p><strong>Update:</strong></p>

<p>bitpay link as requested: <code>bitcoin:?r=<a href="https://bitpay.com/i/97ghKmFG8HVJNEbxkVefV" rel="nofollow noreferrer">https://bitpay.com/i/97ghKmFG8HVJNEbxkVefV</a></code> though it has now been payed (via bitcoin-qt ui) so its usefulness may now be limited.</p>

CC BY-SA 3.0
2018-03-25T05:42:13.407Z
You may find that there is some code magic in the redirect you experienced that would open/inform your wallet automatically if it has an installed URI handler. bitcoin: links often work on smartphones too but it depends on the wallet to install such handling. If it is not too much to ask concerning privacy, can you share the full bitcoin:URI?
Willtech
CC BY-SA 3.0
2018-03-26T16:01:36.050Z
@Willtech question updated with link
memtha
<bitcoin-core><json-rpc><bitcoin-cli><bip70-payment-protocol>
Is there a rpc/cli method for payment protocol in bitcoin-core?
memtha
# Is there a rpc/cli method for payment protocol in bitcoin-core?

(Asked by: username_0 on 2018-03-25)

I have a full node running bitcoin-core 0.16 bitcoind (not bitcoin-qt). Today I tried and failed to pay a bitpay "secure" payment protocol uri invoice via the cli. The uri was in the form `bitcoin:?r=https://bitpay.com/i/...` with no visible bitcoin address or amount. (Guess people can't be trusted to copy-paste the address correctly?). Not surprisingly, the usual `sendtoaddress` method called the uri invalid.

I curled the address hoping to get the real payment details so I could enter them manually, but I just got a 301 redirect to a page on bitpay.com saying the invoice has not been paid. Guess they filter on uagent or some other header.

I also googled it but only found explanations of what the payment protocol is, why bitpay is using it, and how to do it with popular UI wallets. Nothing about cli.

Does anyone know if/how this is possible with cli/rpc only? Or perhaps the magic header bitpay looks for to distinguish a wallet app from a browser so I can get the real address? If not, I plan to open a ticket with bitcoin core devs on adding it.

**Update:**

bitpay link as requested: `bitcoin:?r=https://bitpay.com/i/97ghKmFG8HVJNEbxkVefV` though it has now been payed (via bitcoin-qt ui) so its usefulness may now be limited.

**Tags:** bitcoin-core, json-rpc, bitcoin-cli, bip70-payment-protocol

> **Comments:**
> **username_1**: You may find that there is some code magic in the redirect you experienced that would open/inform your wallet automatically if it has an installed URI handler. bitcoin: links often work on smartphones too but it depends on the wallet to install such handling. If it is not too much to ask concerning privacy, can you share the full bitcoin:URI?  
> **username_0**: @username_1 question updated with link  

---

## 3 answers

### Answer by username_2 on 2018-03-25. Score: 0 | Accepted answer

My tool, [PaymentBridge](https://cashaddress.github.io/paymentbridge.html)? It aims to solve your question. It's completely client-side, safe to use, but don't broadcast the transaction after creating it. Paste it when it asks you for the transaction. Good luck!

And, there you go: <https://github.com/bitpay/jsonPaymentProtocol/blob/master/specification.md>

Have you set the `Content-Type` to `application/payment`?

> **Comments:**
> **username_0**: Good find on the bitpay spec on github. It seems "Accept: application/payment-request" is exactly the "magic header" I was looking for. I cannot test it now bc the link is now invalid, but I have tentatively accepted your answer. While I do not intend to use your service bc I hate relying on an online service more then necessary, your source code link gave me the info I needed to develop my own local version with bash+curl. For anyone else who may also have this question but who is not willing/able to do the conversion themselves, I tentatively recommend the service linked in this answer.  

---

### Answer by username_3 on 2018-03-25. Score: 1

The payment protocol is only usable from the GUI (i.e. `bitcoin-qt`). It is supposed to be an interactive protocol so you cannot use it from the command line which is non-interactive (in the sense that you issue commands and get a response back instead of issue command and interact within the context of that command).

> **Comments:**
> **username_0**: This is pretty much what I expected: no built-in cli compatibility. Thx.  

---

### Answer by username_1 on 2018-03-25. Score: 0

Reading between the lines it *seems* Bitpay *may have* done this to allow payment with cash when you receive a payment request for Bitcoin.

You may find that there is some code magic in the redirect you experienced that would open/inform your wallet automatically if it has an installed URI handler. bitcoin: links often work on smartphones too but it depends on the wallet to install such handling.

According to Bitpay:

> <https://support.bitpay.com/hc/en-us/articles/115005559826-How-do-I-pay-without-a-payment-bitcoin-address->
>
> ## C. Open the Payment In Your Wallet
>
> If your wallet is on the device you're using to view the invoice, you can open the payment in your wallet by tapping "Open in wallet". Confirm everything is correct, and you can send the payment from your wallet.

This "Open in wallet" link should reveal the actual details even if it does not open in your wallet.

*I cannot test this without an actual Bitpay link.*

> **Comments:**
> **username_0**: I found that article in my brief search. Unfortunately all I was able to get was another link to the same bitcoin: uri. Question updated with link, though it has now expired.  

---

