There are a lot of options that you can make, depending on your ability to technology:
-
https://btcpayserver.org/: The best way, gives you a lot of options, you better try them.
-
https://coingate.com/bitcoin-pos: It is an excellent alternative and you can withdraw money to your account in addition to many options.
-
https://bitpay.com/: One of the worst options.
Did I understand your point exactly? Many services offer you this feature.
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$.
All the links provided do that.
If you want to just make a conversion tool that says x BTC = y USD or vice versa you need to link to an exchange's api to fetch the pricing data, then just multiply or divide depending on what currency gets inputted. But if you want a program that does that plus generates a payment invoice just use btcpayserver. (but again at least 2 of the links provided will do that, I've never heard of coingate but they probably do as well.)
Edit* instead of linking to an exchange you can link to the payment gateway's api and pull data from that.