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

<p>You can start with dissecting some of the work people have done in the space on repositories such as <a href="https://github.com/Bit-Wasp/BitWasp" rel="nofollow noreferrer">bitwasp</a> or <a href="https://github.com/mikegogulski/bitcoin-php" rel="nofollow noreferrer">bitcoin-php</a>. 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.</p>

<p>If you want to actually generate addresses, <a href="https://github.com/zamgo/PHPCoinAddress" rel="nofollow noreferrer">here is a good place to start</a>.</p>

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

<p>User enters value in their currency.
Querying an exchange rate table such as the one on <a href="https://blockchain.info/api/exchange_rates_api" rel="nofollow noreferrer">Blockchain.info</a>, display the amount in Bitcoin. 
You could generate a <a href="http://phpqrcode.sourceforge.net/qrsample.php?data=bitcoin%3A1AmN7cxZ7UAGqBG257Ewkh662XBCjSSYQJ%3Famount%3D1%26label%3Dryanp%26message%3DDonation%2520for%2520being%2520so%25cool&amp;ecc=M&amp;matrix=3" rel="nofollow noreferrer">QR code</a> using <a href="http://phpqrcode.sourceforge.net/index.php" rel="nofollow noreferrer">PHP QR</a> 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.</p>

<p>Or.... you could just use <a href="https://github.com/blockchain/receive_payment_php_demo" rel="nofollow noreferrer">Blockchain.info's free tool</a>, but I assume you have a reason why you want to build your own solution.</p>

<p>In the case that I'm mistaken and you do actually want to use BitPay, you would probably use either the <a href="https://bitpay.com/api#resource-Bills" rel="nofollow noreferrer">Bill</a> or the <a href="https://bitpay.com/api#resource-Invoices" rel="nofollow noreferrer">Invoice</a> method of the <a href="https://bitpay.com/api#resource-Invoices" rel="nofollow noreferrer">BitPay API</a>.</p>

CC BY-SA 3.0
2015-06-02T11:38:38.287Z
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
CC BY-SA 3.0
2015-06-02T19:23:30.350Z
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
CC BY-SA 3.0
2015-06-03T04:00:18.710Z
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
CC BY-SA 3.0
2015-06-03T15:05:32.343Z
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
CC BY-SA 3.0
2015-06-03T15:24:46.913Z
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
CC BY-SA 3.0
2015-06-03T15:30:01.793Z
If you're looking at the Blockchain.info APIs, start here https://blockchain.info/api/api_receive . It's true that many of the github projects are out of date and need some love.
RyanP
CC BY-SA 3.0
2015-06-02T05:53:19.083Z
2017-03-06T22:24:02.070Z
2017-03-06T22:24:02.070Z
RyanP
<p>You can use GoUrl.io PHP Bitcoin Open source Payment class.</p>

<p>Github - <a href="https://github.com/cryptoapi/Payment-Gateway" rel="nofollow noreferrer">https://github.com/cryptoapi/Payment-Gateway</a></p>

<p>PHP Examples - <a href="https://gourl.io/bitcoin-payment-gateway-api.html" rel="nofollow noreferrer">https://gourl.io/bitcoin-payment-gateway-api.html</a></p>

CC BY-SA 3.0
2016-11-16T09:16:35.717Z
2016-11-16T09:16:35.717Z
Igor
<p>I prefer <a href="https://www.payb.tc" rel="nofollow noreferrer">www.payb.tc</a> this is getting small percentage only. No additional fees.</p>

CC BY-SA 4.0
2019-06-07T17:52:31.400Z
2019-06-07T17:52:31.400Z
kodmanyagha
<p>First of all, you don't need any third parties to accept Bitcoin. It kinda defeats the purpose of cryptocurrency. Secondly, using an API and storing any secret keys on your server will create potential risks. All private keys must be stored offline, you don't need them to accept the payment.</p>
<p>All BTC transactions are public. All you need is to store few pre-generated public keys for rotation, once payment has been made you have 2 options:</p>
<ol>
<li>monitor your public address for the amount expected, once it's there check for the number of confirmations:</li>
</ol>
<p><a href="https://blockchain.info/rawaddr/%7B$YOUR_PUBLIC_KEY%7D" rel="nofollow noreferrer">https://blockchain.info/rawaddr/{$YOUR_PUBLIC_KEY}</a></p>
<ol start="2">
<li>if payer able to provide an optional hash of the transaction use this to confirm payment after say 3 confirmation:</li>
</ol>
<p><a href="https://blockchain.info/rawtx/%7B$PAYER_PROVIDED_TRANSACTION_HASH%7D" rel="nofollow noreferrer">https://blockchain.info/rawtx/{$PAYER_PROVIDED_TRANSACTION_HASH}</a></p>
<p>This one returns JSON with all the details you need. You can also use another data provider.</p>
<p>Hope it helps!</p>

CC BY-SA 4.0
2020-10-21T08:30:56.133Z
2020-10-21T08:30:56.133Z
M Karodine
<p>I am trying to set up sort of a BitPay system where</p>

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

<p>How can I do this?</p>

CC BY-SA 3.0
2015-06-03T15:40:26.383Z
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
CC BY-SA 3.0
2017-12-01T16:50:23.263Z
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
<blockchain><php><bitpay>
How to accept payments with Blockchain in PHP
phpuser
# How to accept payments with Blockchain in PHP

(Asked by: username_0 on 2015-06-02)

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?

**Tags:** blockchain, php, bitpay

> **Comments:**
> **username_1**: 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".  
> **username_1**: 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".  

---

## 4 answers

### Answer by username_2 on 2015-06-02. Score: 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](https://github.com/Bit-Wasp/BitWasp) or [bitcoin-php](https://github.com/mikegogulski/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](https://github.com/zamgo/PHPCoinAddress).

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](https://blockchain.info/api/exchange_rates_api), display the amount in Bitcoin.
You could generate a [QR code](http://phpqrcode.sourceforge.net/qrsample.php?data=bitcoin%3A1AmN7cxZ7UAGqBG257Ewkh662XBCjSSYQJ%3Famount%3D1%26label%3Dryanp%26message%3DDonation%2520for%2520being%2520so%25cool&ecc=M&matrix=3) using [PHP QR](http://phpqrcode.sourceforge.net/index.php) 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](https://github.com/blockchain/receive_payment_php_demo), 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](https://bitpay.com/api#resource-Bills) or the [Invoice](https://bitpay.com/api#resource-Invoices) method of the [BitPay API](https://bitpay.com/api#resource-Invoices).

> **Comments:**
> **username_0**: 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?  
> **username_2**: 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.  
> **username_0**: 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  
> **username_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.  
> **username_0**: 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!  
> **username_2**: If you're looking at the Blockchain.info APIs, start here https://blockchain.info/api/api_receive . It's true that many of the github projects are out of date and need some love.  

---

### Answer by username_3 on 2016-11-16. Score: 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>


---

### Answer by username_4 on 2019-06-07. Score: 0

I prefer [www.payb.tc](https://www.payb.tc) this is getting small percentage only. No additional fees.


---

### Answer by username_5 on 2020-10-21. Score: 0

First of all, you don't need any third parties to accept Bitcoin. It kinda defeats the purpose of cryptocurrency. Secondly, using an API and storing any secret keys on your server will create potential risks. All private keys must be stored offline, you don't need them to accept the payment.

All BTC transactions are public. All you need is to store few pre-generated public keys for rotation, once payment has been made you have 2 options:

1. monitor your public address for the amount expected, once it's there check for the number of confirmations:

[https://blockchain.info/rawaddr/{$YOUR\_PUBLIC\_KEY}](https://blockchain.info/rawaddr/%7B$YOUR_PUBLIC_KEY%7D)

2. if payer able to provide an optional hash of the transaction use this to confirm payment after say 3 confirmation:

[https://blockchain.info/rawtx/{$PAYER\_PROVIDED\_TRANSACTION\_HASH}](https://blockchain.info/rawtx/%7B$PAYER_PROVIDED_TRANSACTION_HASH%7D)

This one returns JSON with all the details you need. You can also use another data provider.

Hope it helps!


---

