<p>If for you it's ok to use 3rd parties' services, a simple google search will present to you several plug-ins that suit your purpose.</p>

<p>If you want to do it by yourself, here is how you may want to tackle this endevour:</p>

<ol>
<li><p>you must have an HD wallet (aka deterministic wallet compliant with BIP 32).</p></li>
<li><p>you put your XPUB in your server and you use it to generate dynamically the public keys that will be shown to your customers.</p></li>
<li><p>You want to make sure that every customer sees a different public address, so that when you receive a payment you will know who paid for what. If you always use the same public address (besides compromising the privacy of all parties involved in the transaction) you won't have any way to know which customer paid for what product. More on this point later.</p></li>
<li><p>in HD wallets new key pairs and public addresses are generated using the XPUB in conjunction with an HD path such as this: M/44'/0'/0'/0/x. Every time a new customer sees the payment page , in order to show him or her a new address, you need to change the 'x' (child) value. For example the first customer will see an address which corresponds to HD path M/44'/0'/0'/0/0 , the second customer will see the public address which corresponds to M/44'/0'/0'/0/1 and the third one will see M/44'/0'/0'/0/2 and so forth. You can go on for millions of addresses, but you need to put in place some mechanism that allows you to keep track of the last child number. You can do that on a JSON file on your server or through your DB.</p></li>
<li><p>if you want to apply some sort of automated business logic you need to monitor the blockchain to listen to incoming payments to the addresses you created. Sure enough, purchase data must be saved into your DB along with the bitcoin public address created for that specific purchase. This will come handy later when you will need to automatically  confirm the purchase to the customer and deliver the order.</p></li>
<li><p>You may want to use a websocket to listen to unconfirmed payments (in mempool) received by the address shown in the webpage that the cusomer is seeing. As soon as a payment is detected , with a dozen lines of JS you ll be able to print a "thank you" message on the customer's screen.</p></li>
<li><p>Monitor the blockchain for confirmed payments (at least one confirmation, but 3 confirmations is safer) received by the addresses you generated. When you see a new confirmed payment you can confirm the purchase to the customer by email and ship your product to him or her.</p></li>
</ol>

<p>As a final piece of recomendation, you should set up some sort of count down or other mechanism that limits the validity of the address you generated and prices quoted. This is vital to protect yourself and your customer from the tremendous price swings of BTC against major fiats.</p>

<p>I hope that this helped you :-)</p>

CC BY-SA 4.0
2019-07-23T15:12:26.750Z
2019-07-23T15:12:26.750Z
Mario Mazzola
<p>I am looking to set up a simple single page store. This store should respect the privacy of users by not requiring personal information where none is needed. I want to retain control of the funds, I don't want to sign up with an exchange, but want payments to go directly to my wallet. How can I achieve that?</p>

CC BY-SA 4.0
2019-07-21T16:57:11.927Z
Product recommendations are off topic here, as they tend to be outdated quickly. However, try BTCPayServer.
Pieter Wuille
CC BY-SA 4.0
2019-07-21T19:27:40.180Z
Hi Courtney, I've edited your question to focus on the problem you're trying to solve. Please feel free to revert or amend my edit to best represent your issue.
Murch
<website-integration><ecommerce>
How can I set up a simple single page store that accepts Bitcoin payments?
Courtney
# How can I set up a simple single page store that accepts Bitcoin payments?

(Asked by: username_0 on 2019-07-21)

I am looking to set up a simple single page store. This store should respect the privacy of users by not requiring personal information where none is needed. I want to retain control of the funds, I don't want to sign up with an exchange, but want payments to go directly to my wallet. How can I achieve that?

**Tags:** website-integration, ecommerce

> **Comments:**
> **username_1**: Product recommendations are off topic here, as they tend to be outdated quickly. However, try BTCPayServer.  
> **username_2**: Hi username_0, I've edited your question to focus on the problem you're trying to solve. Please feel free to revert or amend my edit to best represent your issue.  

---

## 1 answers

### Answer by username_3 on 2019-07-23. Score: 0

If for you it's ok to use 3rd parties' services, a simple google search will present to you several plug-ins that suit your purpose.

If you want to do it by yourself, here is how you may want to tackle this endevour:

1. you must have an HD wallet (aka deterministic wallet compliant with BIP 32).
2. you put your XPUB in your server and you use it to generate dynamically the public keys that will be shown to your customers.
3. You want to make sure that every customer sees a different public address, so that when you receive a payment you will know who paid for what. If you always use the same public address (besides compromising the privacy of all parties involved in the transaction) you won't have any way to know which customer paid for what product. More on this point later.
4. in HD wallets new key pairs and public addresses are generated using the XPUB in conjunction with an HD path such as this: M/44'/0'/0'/0/x. Every time a new customer sees the payment page , in order to show him or her a new address, you need to change the 'x' (child) value. For example the first customer will see an address which corresponds to HD path M/44'/0'/0'/0/0 , the second customer will see the public address which corresponds to M/44'/0'/0'/0/1 and the third one will see M/44'/0'/0'/0/2 and so forth. You can go on for millions of addresses, but you need to put in place some mechanism that allows you to keep track of the last child number. You can do that on a JSON file on your server or through your DB.
5. if you want to apply some sort of automated business logic you need to monitor the blockchain to listen to incoming payments to the addresses you created. Sure enough, purchase data must be saved into your DB along with the bitcoin public address created for that specific purchase. This will come handy later when you will need to automatically confirm the purchase to the customer and deliver the order.
6. You may want to use a websocket to listen to unconfirmed payments (in mempool) received by the address shown in the webpage that the cusomer is seeing. As soon as a payment is detected , with a dozen lines of JS you ll be able to print a "thank you" message on the customer's screen.
7. Monitor the blockchain for confirmed payments (at least one confirmation, but 3 confirmations is safer) received by the addresses you generated. When you see a new confirmed payment you can confirm the purchase to the customer by email and ship your product to him or her.

As a final piece of recomendation, you should set up some sort of count down or other mechanism that limits the validity of the address you generated and prices quoted. This is vital to protect yourself and your customer from the tremendous price swings of BTC against major fiats.

I hope that this helped you :-)


---

