node-btcpay icon indicating copy to clipboard operation
node-btcpay copied to clipboard

Accessing The Invoice Data In The Redirect String?

Open johnjspiteri opened this issue 3 years ago • 3 comments

We have a landing page for when a user successfully completes the payment.

"localhost:8080/buy/pay-invoice/{{ invoice.id }}/complete"

Is it possible to dynamically access the invoice id?

TY

johnjspiteri avatar Nov 26 '21 08:11 johnjspiteri

Can you explain what you’re trying to do and how you’ve tried to implement it and had some problems? I’m finding it a bit difficult understanding your question.

takinbo avatar Nov 26 '21 19:11 takinbo

Sure.

In the Bitpay documentation the redirectURL string looks like this...

"redirectURL": "https://merchantwebsite.com/shop/return"

Our goal is to have the redirectURL string computed like this...

"redirectURL": "https://merchantwebsite.com/shop/{{ invoice.id }}/return"


Here is our current flow...

  1. User adds personal information ("/us/en/buy/crypto/create-invoice/personal")
  2. User selects the number of coins to purchase ("/us/en/buy/crypto/create-invoice/order") // We create the invoice
  3. User pays the invoice ("/us/en/buy/crypto/pay-invoice/U4v2czMgLdTXNaa5xmMiYi") // We use the invoice id in the url, so the user can refresh the page or send the link to another user
  4. User paid the invoice and hits our confirmation view ("/us/en/buy/crypto/pay-invoice/U4v2czMgLdTXNaa5xmMiYi/complete")

So ultimately, we want #4 to be computed because that view will also act as a statement of the transaction.

What do you think @takinbo?

johnjspiteri avatar Nov 27 '21 09:11 johnjspiteri

Also, we are creating our own UI and QR code for invoice in step #3

johnjspiteri avatar Nov 27 '21 09:11 johnjspiteri