2

I am trying to set up sort of a BitPay system where

1) A user selects how much money they want to send (price in BTC).
2) The system gives the user an amount of money they need to pay and the address they need to send to.
3) The system checks if money is sent from the user's Bitcoin address, to the receiving address with the amount of bitcoins specified
4) If all is good, display a message or whatever, if not display error

How can I do this?

  • I feel that this question is too broad. With the many aspects to consider, it is very hard to answer concisely, while the question already sums up a rough answer. This question would work better if split up to several more specific questions instead, when the asker has worked out more details of what he is actually aiming for. Alternatively, this may work better on a forum style platform that facilitates the discussion of an evolving topic. Suggesting to close as "too broad". – Murch Jun 3 '15 at 15:40
  • Rereading this, this question makes little sense whatsoever. BitPay is a payment provider. Why would the user select how much money they want to send? If the price is in Bitcoin, why would the system need to calculate anything at all? Why would the system care what address the payment originated from? Payments should be rather identified through the recipient address than the "sender". – Murch Dec 1 '17 at 16:50
5

Since you say "sort of a BitPay system", I assume you don't want to use BitPay.

You can start with dissecting some of the work people have done in the space on repositories such as bitwasp or bitcoin-php. This is probably more than you need, however the building blocks are there for what you want to do if you wanted all of the logic to live in php.

If you want to actually generate addresses, here is a good place to start.

Here's a quick stab at a workflow that I think would be pretty straightforward to develop.

User enters value in their currency. Querying an exchange rate table such as the one on Blockchain.info, display the amount in Bitcoin. You could generate a QR code using PHP QR as well as displaying a link to click/address to copy/paste, then verify that the transaction was completed using Blockchain.info or something else.

Or.... you could just use Blockchain.info's free tool, but I assume you have a reason why you want to build your own solution.

In the case that I'm mistaken and you do actually want to use BitPay, you would probably use either the Bill or the Invoice method of the BitPay API.

  • I didnt want to use BitPay because i wanted to make something myself, and for my tool I need PHP to do something after payment is received, which do you recommend I use? – phpuser Jun 2 '15 at 11:38
  • So how much do you want to do yourself? In order to receive a payment via a website, all you need is to paste a receiving address in plain text on the page. That would work right? Taking steps towards automation, you need an inputfield for currency, convert to BTC, display an address, and finally update that page with a success flag. You could use call the chain.com API once someone hits submit and then every few seconds check to see if the transaction has posted. If you don't want to use any API to monitor the receiving address, then you probably need to start digging into bitwasp. – RyanP Jun 2 '15 at 19:23
  • I sort of want it like this but completely automated 1) User opens page, and inserts their username and bitcoin address they are paying from 2) User enters amount of BTC to add (in BTC decimals not USD) 3) User sends the BitCoin, page checks if a payment for (amount of btc) has been sent from (users bitcoin address) 4) if so echo "Payment received $username"; else keep checking for payment What would the best option for this be? I am very new to this – phpuser Jun 3 '15 at 4:00
  • 2
    I would suggest that instead of the user entering their sending bitcoin address (which you really shouldn't care about), you provide new receiving addresses for each transaction, or includes an invoice # or something in the description of the transaction. I definitely recommend using Chain.com's API to check that the transaction occurred. Other than that, I don't think you need anything else if there's no USD>BTC conversion. – RyanP Jun 3 '15 at 15:05
  • I'm trying out the BlockChain API github project you sent me and im trying out, its very broken but im working out thanks alot! – phpuser Jun 3 '15 at 15:24
1

You can use GoUrl.io PHP Bitcoin Open source Payment class.

Github - https://github.com/cryptoapi/Payment-Gateway

PHP Examples - https://gourl.io/bitcoin-payment-gateway-api.html

0

I prefer www.payb.tc this is getting small percentage only. No additional fees.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.