1

I am writing a java webserver that can use bitcoin as a payment method. Thanks to the helpful advice in this question, I am able to generate payment addresses for various signed up vendors. I am now taking that address and creating a Payment Request using the bitcoinJ library. I would like, however, to have this request as a meaningful URL still, so the web browser or client making the payment can do something with it. That is to say, I create the payment request on the server and return it to the client. The client can then put that request in their wallet of choice and make a payment.

Is the payment request able to work that way? I saw this post on stackoverflow that indicates that it can, however I haven't been able to see anything within the API I am using that can do that. Is that a limitation of the specification, the library I'm using, or is it possible to do?

S. Buda
  • 145
  • 5

1 Answers1

1

You can. If you make a Bitcoin URI with the r parameter, it will interpret that as a url to fetch the PaymentRequest from.

Documentation on this feature is frustratingly sparse, so I'm having trouble figuring out how to implement all of the details, though.

Nick ODell
  • 29,396
  • 11
  • 72
  • 130
  • Yeah, I've been observing that frustration too. Hopefully this will start moving me in the right direction, though. – S. Buda Apr 21 '15 at 14:09
  • So, correct me if I'm wrong, but it looks to me like, if I use the r parameter, it will come back to my server to try to handle the bitcoin payment, rather than using a payment address.

    However, that seems like it won't work to me if my server is not actually handling bitcoins. I should still be able to use the uri (as indicated https://electrum.org/bitcoin_URIs.html) without the r parameter, but then I'll need some sort of check to coinbase to see if the payment goes through? Which I guess that would mean that a payment request isn't quite what I need, but rather BIP21 is sufficient?

    – S. Buda Apr 21 '15 at 19:44
  • @S.Buda If you don't need any of the features in BIP70, then you should use BIP21 instead, yeah. – Nick ODell Apr 21 '15 at 20:10
  • In that case, (and even messing around with BIP70 this seems to work), I found it easier to not worry about all that extra clutter with the bitcoinJ api. I used it to create a payment address, and then wrote a function that created the URI I needed as a string and will then send that URI back to the client. Thanks for the help, again. – S. Buda Apr 21 '15 at 20:29