Post
Topic
Board Project Development
Re: How to add custom (USD compare to Bitcoin) Bitcoin Payment on my website?
by
TryNinja
on 28/02/2020, 16:20:51 UTC
Thank you for your answer, but it's not exactly answer my question. I know how to accept bitcoin payment and to use bitcoin gateway. I try to get information of the exact price of bitcoin compare to dollar when my customer made an order. Also, I want the customer to choose how much USD / BTC he want to pay. So if he choose he want to pay me 900$ he will get information of how much Bitcoin he need to send equal to 900$.
You can probably do that easily with your the part of your code implementation. It's a very easy logic.

Get the price from a trusted source/exchange, get the amount he wants in USD and divide it by the price ($10 / $8700 = 0.00114 BTC) and generate an invoice from it. When he pays, see how much was paid in BTC and multiply by the current price (0.00114 * 8500 = $9.69). Add this amount to his balance.