Working on a project right now and I want to have a pay with bitcoin button where the user pays a bitcoin amount pegged to a set dollar value, with a uniquely generated bitcoin address for each purchase. We want to make it so that the instant the payment is visible on the blockchain, the order will go through.
How do we go about implementing this kind of code (Using javascript and firebase), and how do we make the order go through once the payment is accepted? Will blockchain API help for all of this?
Kind of new to web development and this kind of stuff, so any help is greatly appreciated!
Want it to pop up like this:
Note to mods: Also posted here:
https://bitcointalk.org/index.php?topic=1672715.0Please let me know where it belongs.
I've done this in PHP, but not JS or Firebase. In short, you're probably better off getting a developer to code it for you. I don't recommend using blockchain.info or another wallet service, they often get DDoS'd causing a disruption and some API limits. You're better off running a node and doing your code through it and there's no limitations.
Basic process:
Generate new address from wallet
Calculate fiat/usd/etc to BTC
Store address, btc amount, usd amount, order number, customer data in database
Display address, qrcode, and btc amount requested
Have a backend process check addresses in the database that are unconfirmed
Once the address is funded with the amount, run the action that you want to for a successful transaction
Save the bitcoin tx into the database once you get the number of confirmations you want.
Notify the customer by email, etc that the amount was received
Update your admin panel for any transaction data