Bitcoin Forum
November 07, 2024, 04:06:18 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Best Practice for accepting Bitcoin as Payment.  (Read 1103 times)
ravetrader (OP)
Member
**
Offline Offline

Activity: 119
Merit: 10


View Profile
March 10, 2015, 11:51:49 AM
 #1

Hi,

are any tutorials out there which could show me how to integrate bitcoins to a homepage as a payment method in the way of best practice (in the view of a secure, easy and fast process)

I want the people to provide their bitcoin address (in purpose of refunds), with that information an unique bitcoin-payment-address should be generated and shown to the user. No registration should be needed.

-Now which wallet should I use?
-How can i forward all payments automated to a secure cold storage?
-How can i monitor the payment status. (I would like to inform the user right on 0 confirmations, that the payment is pending (just like Blockchain.info does)

If i just generate Thousands of addressee with an armor offline wallet, store them in my database an then give them out to the user on request, would that be secure?  

thanks
EcuaMobi
Legendary
*
Offline Offline

Activity: 1876
Merit: 1475



View Profile
March 10, 2015, 12:09:21 PM
 #2

Hi,

are any tutorials out there which could show me how to integrate bitcoins to a homepage as a payment method in the way of best practice (in the view of a secure, easy and fast process)

I want the people to provide their bitcoin address (in purpose of refunds), with that information an unique bitcoin-payment-address should be generated and shown to the user. No registration should be needed.

-Now which wallet should I use?
-How can i forward all payments automated to a secure cold storage?
-How can i monitor the payment status. (I would like to inform the user right on 0 confirmations, that the payment is pending (just like Blockchain.info does)

If i just generate Thousands of addressee with an armor offline wallet, store them in my database an then give them out to the user on request, would that be secure?  

thanks


For this scenario I recommend you to use the blockchain.info API.

You can have a single address to forward every payment and that can be a cold storage. So no need to have funds on the server.
ravetrader (OP)
Member
**
Offline Offline

Activity: 119
Merit: 10


View Profile
March 10, 2015, 12:16:26 PM
 #3

i was thinking about that, but i found some negative reviews about that service, not sure if it will lead to some problems. So i was thinking about to set my own wallet/payment system.
EcuaMobi
Legendary
*
Offline Offline

Activity: 1876
Merit: 1475



View Profile
March 10, 2015, 12:19:18 PM
 #4

i was thinking about that, but i found some negative reviews about that service, not sure if it will lead to some problems. So i was thinking about to set my own wallet/payment system.

In that case you will need to install the bitcoin daemon. You can then code in PHP and connect to the wallet via Json-RPC.

You should forward most of the funds to an offline wallet for security. Just keep on the server what you'll need for refunds.
OpenOcean
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
March 12, 2015, 01:56:51 PM
 #5

As a professional merchent, coinkite would have a lot of security and easy of use. Great service that is under-advertised.
mistercoin
Legendary
*
Offline Offline

Activity: 1051
Merit: 1000


https://r.honeygain.me/XEDDM2B07C


View Profile WWW
March 12, 2015, 02:08:49 PM
 #6

If you want to avoid having to mess around with building your own gateway, try something like Bitpay or even Coinbase. They have gateways all ready to go, and easily integrated into websites VIA their API. I think there is also scripts and other quick ways to implement a secure gateway for payments VIA these sites. Coinpayments and a few other sites also have gateways, ready to go.

coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1186



View Profile WWW
March 12, 2015, 05:16:44 PM
 #7

Best way IMO is build your own mini payment gateway with blockchain.info API

Create a homepage/frontpage with your product, here's an example:

Code:
<html>
<title>Wooden Spoons</title>
<head>
<style>
.pr {
        border: 1px solid #666666;
        border-radius: 3px;
}
#footer{
        font-size: 10px;
        color: #666666;
}
</style>
</head>
<body>
<h1>Wooden Spoons</h1>
<p>Welcome to my custom made wooden spoons store. I carve the best wooden spoons on the planet.
The best wooden spoons need the best payment system, which is why I use bitcoin to process my
payments online. If you are new to bitcoin you can go to <a href="http://bitcoin.org">bitcoin.org</a>
to learn more and how to get started. </p>
<br>
<h2>Latest Wooden Spoons For Sale</h2>
<table>
<tr>
        <td class="pr"><center>Enchanted Spoon<br>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<a href="item1.php">Buy Now!</a>
        </center></td>
        <td class="pr"><center>Wizard Spoon<br>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<a href="item2.php">Buy Now!</a>
        </center></td>
        <td class="pr"><center>Monkey Spoon<br>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<a href="item3.php">Buy Now!</a>
        </center></td>
</tr>
<tr>
        <td class="pr"><center>Enchanted Spoon<br>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<a href="item1.php">Buy Now!</a>
        </center></td>
        <td class="pr"><center>Wizard Spoon<br>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<a href="item2.php">Buy Now!</a>
        </center></td>
        <td class="pr"><center>Monkey Spoon<br>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<a href="item3.php">Buy Now!</a>
        </center></td>
</tr>
</table>
<br><br>
<center><span id="footer">2015 &copy; Wooden Spoons</span></center>
</body>
</html>

Then in order to process the payment create a separate PHP page for each item. This page can contain a form for the user to put in their shipping details. Then we generate a unique address for them to send their payment. After this an email is sent to your own personal email so you know who purchased what and which address they are sending your payment to:

Here's an example for item1.php file
Code:
<?php
$url 
"https://btc-e.com/api/2/btc_usd/ticker";
$json json_decode(file_get_contents($url), true);
$price $json["ticker"]["last"];
$usdPrice 20// SET THE PRICE OF THE ITEM HERE
$calc $usdPrice $price;
$itemPrice round($calc4);
$yourEmail "your@email.com"// ENTER YOUR EMAIL SO YOU CAN BE NOTIFIED WHEN SOMEONE BUYS SOMETHING
$emailTitle "New Purchase";
$productName "Enchanted Spoon"// ENTER IN PRODUCT NAME
 
if(isset($_POST['submit'])){
        
$email $_POST['email'];
        
$name $_POST['name'];
        
$street $_POST['street'];
        
$city $_POST['city'];
        
$state $_POST['state'];
        
$zip $_POST['zip'];
 
        
//CREATE UNIQUE BITCOIN ADDRESS FOR PAYMENT
        
$id "111aa111-aaa1-1111-a111-1111a111a1a1"//YOUR UNIQUE BLOCKCHAIN.INFO ID
        
$pw "correcthorsebatterystaple"//YOUR BLOCKCHAIN.INFO PASSWORD
        
$new_address "https://blockchain.info/merchant/$id/new_address?password=$pw";
 
        
$json_new_addr json_decode(file_get_contents($new_address), true);
        
$display_address $json_new_addr["address"];
 
        
$body = <<<EOD
        <h1>New Purchase</h1>
        Item Purchased: 
$productName <br>
        Email: 
$email <br>
        Name: 
$name <br>
        Street: 
$street <br>
        City: 
$city <br>
        State: 
$state <br>
        Zip: 
$zip <br>
        Payment Address: 
$display_address <br>
        Payment Amount: 
$itemPrice <br>
EOD;
 
        
$headers "From: sales@yourwebsite.com" ."\r\n";
        
$headers .= "Content-type: text/html\r\n";
        
$success mail("$yourEmail""$emailTitle""$body""$headers");
        
$message "Thank you for your order!";
        
$message2 "To finalize your order please send " $itemPrice " to " $display_address;
        
$message3 "We have emailed you this information if you have to pay later.";
 
        
$custEmail = <<<EOD
        <h3>Please send payment to finalize your purchase</h3>
        Payment Address: 
$display_address <br>
        Payment Amount: 
$itemPrice <br>
        Item Purchased: 
$productName <br>
        Email: 
$email <br>
        Name: 
$name <br>
        Street: 
$street <br>
        City: 
$city <br>
        State: 
$state <br>
        Zip: 
$zip <br>        
EOD;
        
$customerCopy mail($email"Wooden Spoons Purchase"$custEmail$headers);
}
 
?>

<html>
<title>Wooden Spoons</title>
<head>
<style>
#pmsg{
        background-color: #B2F0FF;
        color: #008AE6;
        border: 1px solid #008AE6;
        border-radius: 3px;
}
.cinp{
        border-radius: 3px;
        border: 1px solid #666666;
}
#finpay{
        background-color: #008AE6;
        color: #ffffff;
        border-radius: 3px;
}
</style>
</head>
<body>
<h1>Wooden Spoons</h1>
<h3>You selected to buy the Enchanted Spoon.</h3>
<img src="http://ec.l.thumbs.canstockphoto.com/canstock18120002.jpg"><br>
<p>The Enchanted Spoon was carved by hand and coated with special shaman herbs.
It looks and smells great! You can use it to eat soup or just display it on a shelf.</p>
<br>
Price: &#3647;<?php echo $itemPrice?><br><br>
<h3>Shipping Information</h3>
<form name="checkout" method="post" action="item1.php">
Email: <input type="text" class="cinp" name="email"><br>
Full Name: <input type="text" class="cinp" name="name"><br>
Address: <input type="text" class="cinp" name="street"><br>
City: <input type="text" class="cinp" name="city"><br>
State: <input type="text" class="cinp" name="state"><br>
Zip: <input type="text" class="cinp" name="zip"><br>
<input type="submit" id="finpay" name="submit" value="Finish and Pay">
</form>
<div id="pmsg"><?php echo $message;
echo 
"<br>";
echo 
$message2;
echo 
"<br>";
echo 
$message3;
?>
</div>
</body>
</html>

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!