2. Bitcoin Pay-Per-Product API (iFrame, 2017 year)

For wordpress plugins, use our wp instruction »

Simple Basic php Payment Example (accept payments in one crypto currency) -

<? require_once( "cryptobox.class.php" ); $orderID = "your_product1_or_signuppage1_etc"; $userID = ""; $def_language = "en"; // default payment box language; en - English, es - Spanish, fr - French, etc // Remove all the characters from the string other than a..Z0..9_-@. $orderID = preg_replace('/[^A-Za-z0-9\.\_\-\@]/', '', $orderID); $userID = preg_replace('/[^A-Za-z0-9\.\_\-\@]/', '', $userID); $options = array( "public_key" => "", // place your public key from gourl.io "private_key" => "", // place your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate program key "orderID" => $orderID, // few your users can have the same orderID but combination 'orderID'+'userID' should be unique "userID" => $userID, // optional; place your registered user id here (user1, user2, etc) // for example, on premium page you can use for all visitors: orderID="premium" and userID="" (empty) // when userID value is empty - system will autogenerate unique identifier for every user and save it in cookies "userFormat" => "COOKIE", // save your user identifier userID in cookies. Available: COOKIE, SESSION, IPADDRESS, MANUAL "amount" => 0, // amount in cryptocurrency or in USD below "amountUSD" => 2, // price is 2 USD; it will convert to cryptocoins amount, using Live Exchange Rates // For convert fiat currencies Euro/GBP/etc. to USD, use function convert_currency_live() "period" => "24 HOUR", // payment valid period, after 1 day user need to pay again "iframeID" => "", // optional; when iframeID value is empty - system will autogenerate iframe html payment box id "language" => $def_language // text on EN - english, FR - french, please contact us and we can add your language ); // Initialise Bitcoin Payment Class $box = new Cryptobox ($options); // Display payment box with custom width = 560 px and big qr code / or successful result $payment_box = $box->display_cryptobox(true, 560, 230, "border-radius:15px;border:1px solid #eee;padding:3px 6px;margin:10px;", "display:inline-block;max-width:580px;padding:15px 20px;border:1px solid #eee;margin:7px;line-height:25px;"); // Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Log $message = ""; // A. Process Received Payment if ($box->is_paid()) { $message .= "A. User will see this message during 24 hours after payment has been made!"; $message .= "<br>".$box1->amount_paid()." ".$box1->coin_label()." received<br>"; // Your code here to handle a successful cryptocoin payment/captcha verification // For example, give user 24 hour access to your member pages // ... // Please use IPN (instant payment notification) function cryptobox_new_payment() for update db records, etc // Function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") called every time // when a new payment from any user is received. // IPN description: https://gourl.io/api-php.html#ipn } else $message .= "The payment has not been made yet"; // B. Optional - One-time Process Received Payment if ($box1->is_paid() && !$box1->is_processed()) { $message .= "B. User will see this message one time after payment has been made!"; // Your code here - user see successful payment result // ... // Also you can use $box1->is_confirmed() - return true if payment confirmed // Average transaction confirmation time - 10-20min for 6 confirmations // Set Payment Status to Processed $box1->set_status_processed(); // Optional, cryptobox_reset() will delete cookies/sessions with userID and // new cryptobox with new payment amount will be show after page reload. // Cryptobox will recognize user as a new one with new generated userID // $box1->cryptobox_reset(); // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... } } ?> <!DOCTYPE html><html><head> <meta http-equiv='cache-control' content='no-cache'> <script src='cryptobox.min.js' type='text/javascript'></script> </head><body> <div style='margin:30px 0 5px 480px'>Language: <?= $languages_list ?></div> <?= $payment_box ?> <?= $message ?> </body> </html>

Example PHP Source

Example - accept multiple crypto currencies on your website and allow users to change payment box display language

<? require_once( "cryptobox.class.php" ); /**** CONFIGURATION VARIABLES ****/ $userID = ""; // place your registered userID or md5(userID) here (user1, user7, uo43DC, etc). // if userID is empty, it will autogenerate userID and save in cookies $userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION) $orderID = "invoice000383"; // invoice number - 000383 $amountUSD = 2.21; // invoice amount - 2.21 USD // for convert fiat currencies Euro/GBP/etc. to USD, use function convert_currency_live() $period = "NOEXPIRY"; // one time payment, not expiry $def_language = "en"; // default Payment Box Language $def_payment = "bitcoin"; // default Coin in Payment Box // List of coins that you accept for payments // For example, for accept payments in bitcoins, dogecoins use - $available_payments = array('bitcoin', 'dogecoin'); $available_payments = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit'); // Goto https://gourl.io/info/memberarea/My_Account.html // You need to create record for each your coin and get private/public keys // Place Public/Private keys for all your available coins from $available_payments $all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-private key for Bitcoin box-"), "dogecoin" => array("public_key" => "-your public key for Dogecoin box-", "private_key" => "-private key for Dogecoin box-") // etc. ); /********************************/ // Re-test - that all keys for $available_payments added in $all_keys if (!in_array($def_payment, $available_payments)) $available_payments[] = $def_payment; foreach($available_payments as $v) { if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable"); elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false) die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file cryptobox.config.php."); } // Optional - Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Optional - Coin selection list (html code) $coins_list = display_currency_box($available_payments, $def_payment, $def_language); $coinName = CRYPTOBOX_SELCOIN; // current selected coin by user // Current Coin public/private keys $public_key = $all_keys[$coinName]["public_key"]; $private_key = $all_keys[$coinName]["private_key"]; /** PAYMENT BOX **/ $options = array( "public_key" => $public_key, // your public key from gourl.io "private_key" => $private_key, // your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate key "orderID" => $orderID, // order id or product name "userID" => $userID, // unique identifier for every user "userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS or SESSION "amount" => 0, // product price in coins OR in USD below "amountUSD" => $amountUSD, // we use product price in USD "period" => $period, // payment valid period "language" => $def_language // text on EN - english, FR - french, etc ); // Initialise Payment Class $box = new Cryptobox ($options); // coin name $coinName = $box->coin_name(); // Successful Cryptocoin Payment received if ($box->is_paid()) { // Optional - use IPN (instant payment notification) function cryptobox_new_payment() for update db records, etc // IPN description: https://gourl.io/api-php.html#ipn if (!$box->is_confirmed()) { $message = "Thank you for payment (payment #".$box->payment_id()."). Awaiting transaction/payment confirmation"; } else { // payment confirmed (6+ confirmations) // one time action if (!$box->is_processed()) { // One time action after payment has been made/confirmed $message = "Thank you for order (order #".$orderID.", payment #".$box->payment_id()."). We will send soon"; // Set Payment Status to Processed $box->set_status_processed(); } else $message = "Thank you. Your order is in process"; // General message } } else $message = "This invoice has not been paid yet"; // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... ?> <!DOCTYPE html> <html><head> <title>Pay-Per-Product Cryptocoin (payments in multiple cryptocurrencies) Payment Example</title> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='Expires' content='-1'> <script src='cryptobox.min.js' type='text/javascript'></script> </head> <body style='font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#666;margin:0'> <div align='center'> <h1>Invoice (Example)</h1> <br> <img style='position:absolute;margin-left:auto;margin-right:auto;left:0;right:0;' alt='status' src='https://gourl.io/images/<?= ($box->is_paid()?"paid":"unpaid") ?>.png'> <img alt='Invoice' border='0' height='500' src='https://gourl.io/images/invoice.png'> <br><br> <? if (!$box->is_paid()) echo $coins_list . "<br><br><h2>Pay Invoice Now - </h2>"; ?> <br><br> <div style='margin:30px 0 5px 300px'>Language: <?= $languages_list ?></div> <?= $box->display_cryptobox() ?> <br><br><br> <h3>Message :</h3> <h2 style='color:#999'><?= $message ?></h2> <br><br><br><br><br><br> </div> </body> </html>

3. Pay-Per-Download Bitcoin (iFrame, 2017 year)



Your website visitors will need to send you a set amount of cryptocoins for every file download, which they make from your website. You can use the received cryptocoins to support your website, etc.

Your files need to store in protected directory with Example of php code (Bitcoin Pay-Per-Download Payment Gateway) for your website. Use Pay-Per-Download system for your files and for any other digital content of your website online. Make money.Your website visitors will need to send you a set amount of cryptocoins for every file download, which they make from your website. You can use the received cryptocoins to support your website, etc.Your files need to store in protected directory with .htaccess file: deny from all . It protects your files from direct downloads

Live Example3 (bitcoin only) Live Example4 (multiple cryptocurrencies)



No visitors registration is needed. This will be quick and easy for your visitors!

<? require_once( "cryptobox.class.php" ); /**** CONFIGURATION VARIABLES ****/ $filename = "my_file1.zip"; // filename for download $dir = "protected"; // name of your directory with your files; nobody should have direct web access to directory $userID = ""; // place your registered userID or md5(userID) here (user1, user7, uo43DC, etc). // if userID is empty, it will autogenerate userID and save in cookies $userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION) $orderID = md5($dir.$filename); // file name hash as order id $amountUSD = 0.2; // file download price (0.2 USD) $period = "24 HOURS"; // download link will be valid for 24 hours $def_language = "en"; // default Payment Box Language $def_payment = "bitcoin"; // default Coin in Payment Box // List of coins that you accept for payments // For example, for accept payments in bitcoins, dogecoins use - $available_payments = array('bitcoin', 'dogecoin'); $available_payments = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit'); // Goto https://gourl.io/info/memberarea/My_Account.html // You need to create record for each your coin and get private/public keys // Place Public/Private keys for all your available coins from $available_payments $all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-private key for Bitcoin box-"), "dogecoin" => array("public_key" => "-your public key for Dogecoin box-", "private_key" => "-private key for Dogecoin box-") // etc. ); /********************************/ // Re-test - that all keys for $available_payments added in $all_keys if (!in_array($def_payment, $available_payments)) $available_payments[] = $def_payment; foreach($available_payments as $v) { if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable"); elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false) die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file cryptobox.config.php."); } // Optional - Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Optional - Coin selection list (html code) $coins_list = display_currency_box($available_payments, $def_payment, $def_language, 60, "margin: 80px 0 0 0"); $coinName = CRYPTOBOX_SELCOIN; // current selected coin by user // Current Coin public/private keys $public_key = $all_keys[$coinName]["public_key"]; $private_key = $all_keys[$coinName]["private_key"]; /** PAYMENT BOX **/ $options = array( "public_key" => $public_key, // your public key from gourl.io "private_key" => $private_key, // your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate key "orderID" => $orderID, // file name hash as order id "userID" => $userID, // unique identifier for every user "userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS or SESSION "amount" => 0, // file price in coins OR in USD below "amountUSD" => $amountUSD, // we use file price in USD "period" => $period, // download link valid period "language" => $def_language // text on EN - english, FR - french, etc ); // Initialise Payment Class $box = new Cryptobox ($options); // coin name $coinName = $box->coin_name(); // Generate Download Link $download_link = "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" . (strpos($_SERVER["REQUEST_URI"], "?")?"&":"?")."dd=1"; $download_link = "href='".htmlspecialchars($download_link, ENT_QUOTES, 'UTF-8')."'"; // Warning message if not paid if (!$box->is_paid()) $download_link = "onclick='alert(\"You need to send ".$coinName."s first !\")' href='#a'"; // Check if file exists on your server $file = rtrim($dir, "/ ")."/".$filename; if (!file_exists($file)) echo "<h1><center><font color=red>Warning: $file not exists</font></center></h1>"; // User Paid - Send file to user browser if ($box->is_paid() && isset($_GET["dd"]) && $_GET["dd"] == "1") { // Starting Download $size = filesize($file); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . $size); readfile($file); // Set Status - User Downloaded File if ($size) $box->set_status_processed(); die; } // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... ?> <!DOCTYPE html> <html><head> <title>Pay-Per-Download Cryptocoin (payments in multiple cryptocurrencies) Payment Example</title> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='Expires' content='-1'> <script src='cryptobox.min.js' type='text/javascript'></script> </head> <body style='font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#666;margin:0'> <div align='center'> <br><br><br><h1>File: <?= $filename ?></h1> Price: ~<?= $amountUSD ?> US$<br> <a <?= $download_link ?>><img alt='Download File' border='0' src='https://gourl.io/images/zip.png'></a><br> <a <?= $download_link ?>>Download File</a> <? if (!$box->is_paid()) echo $coins_list; else echo "<br><br><br><br>" ?> <div style='margin:30px 0 5px 300px'>Language: <?= $languages_list ?></div> <?= $box->display_cryptobox() ?> <br><br><br><br><br><br> </div> </body> </html>

No visitors registration is needed. Easy to use!

<? require_once( "cryptobox.class.php" ); /**** CONFIGURATION VARIABLES ****/ $userID = ""; // place your registered userID or md5(userID) here (user1, user7, uo43DC, etc). // if userID is empty, it will autogenerate userID and save in cookies $userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION) $orderID = "post1"; // if you manual setup userID, you need to // update orderID for users who already paid before: post1, post2, post3 $amountUSD = 0.5; // price per one post - 0.5 USD $period = "NOEXPIRY"; // one time payment for each new user post, not expiry $def_language = "en"; // default Payment Box Language $def_payment = "dogecoin"; // default Coin in Payment Box // List of coins that you accept for payments // For example, for accept payments in bitcoins, dogecoins use - $available_payments = array('bitcoin', 'dogecoin'); $available_payments = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit'); // Goto https://gourl.io/info/memberarea/My_Account.html // You need to create record for each your coin and get private/public keys // Place Public/Private keys for all your available coins from $available_payments $all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-private key for Bitcoin box-"), "dogecoin" => array("public_key" => "-your public key for Dogecoin box-", "private_key" => "-private key for Dogecoin box-") // etc. ); /********************************/ // Re-test - that all keys for $available_payments added in $all_keys if (!in_array($def_payment, $available_payments)) $available_payments[] = $def_payment; foreach($available_payments as $v) { if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable"); elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false) die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file cryptobox.config.php."); } // Optional - Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Optional - Coin selection list (html code) $coins_list = display_currency_box($available_payments, $def_payment, $def_language, 42, "margin: 5px 0 0 20px"); $coinName = CRYPTOBOX_SELCOIN; // current selected coin by user // Current Coin public/private keys $public_key = $all_keys[$coinName]["public_key"]; $private_key = $all_keys[$coinName]["private_key"]; /** PAYMENT BOX **/ $options = array( "public_key" => $public_key, // your public key from gourl.io "private_key" => $private_key, // your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate key "orderID" => $orderID, // order id "userID" => $userID, // unique identifier for every user "userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS or SESSION "amount" => 0, // post price in coins OR in USD below "amountUSD" => $amountUSD, // we use post price in USD "period" => $period, // payment valid period "language" => $def_language // text on EN - english, FR - french, etc ); // Initialise Payment Class $box = new Cryptobox ($options); // coin name $coinName = $box->coin_name(); // Form Data // -------------------------- $ftitle = (isset($_POST["ftitle"])) ? $_POST["ftitle"] : ""; $ftext = (isset($_POST["ftext"])) ? $_POST["ftext"] : ""; $error = ""; $successful = false; if (isset($_POST) && isset($_POST["ftitle"])) { if (!$ftitle) $error .= "<li>Please enter Title</li>"; if (!$ftext) $error .= "<li>Please enter Text</li>"; if (!$box->is_paid()) $error .= "<li>".$coinName."s have not yet been received</li>"; if ($error) $error = "<br><ul style='color:#eb4847'>$error</ul>"; if ($box->is_paid() && !$error) { // Successful Cryptocoin Payment received // Your code here - // save text in db / publish user post on your website ... // ... // ... // Set Payment Status to Processed $successful = true; $box->set_status_processed(); // Optional, cryptobox_reset() will delete cookies/sessions with userID and // new cryptobox with new payment amount will be show after page reload. // Cryptobox will recognize user as a new one with new generated userID // If you manual setup userID, you need to change orderID also $box->cryptobox_reset(); } } // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... ?> <!DOCTYPE html> <html><head> <title>Pay-Per-Post Cryptocoin (payments in multiple cryptocurrencies) Payment Example</title> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='Expires' content='-1'> <meta name='robots' content='all'> <script src='cryptobox.min.js' type='text/javascript'></script> </head> <body style='font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#666;margin:0'> <div align='center'> <h1>Example - Paid Posts</h1> You can sell right to publish new posts on your website <br><br><br> <img alt='Invoice' border='0' src='https://gourl.io/images/example6.png'> <a name='i'></a> <?php if ($successful): ?> <div align='center'> <img alt='New Post' border='0' src='https://gourl.io/images/example7.png'> <div style='margin:40px;font-size:24px;color:#339e2e;font-weight:bold'> Your text has been successfully posted on our website!</div> <a href='pay-per-post-multi.php'>Publish new posts »</a> </div> <? else: ?> <form name='form1' style='font-size:14px;color:#444' action="pay-per-post-multi.php#i" method="post"> <table cellspacing='20'> <tr><td colspan='2'><img alt='New Post' border='0' src='https://gourl.io/images/example7.png'><?= $error ?></td></tr> <tr><td width='100'>Title: </td><td width='300'><input style='padding:6px;font-size:18px;' size='40' type="text" name="ftitle" value="<?= $ftitle ?>"></td></tr> <tr><td>Text: </td><td><textarea style='padding:6px;font-size:18px;' rows="4" cols="40" name="ftext"><?= $ftext ?></textarea></td></tr> <?php if (!$box->is_paid()): ?> <tr><td colspan='2'>* You need to pay <?= $coinName ?>s (~<?= $amountUSD ?> US$) for posting your text on our website</td></tr> <? endif; ?> </table> </form> <div style='width:600px;background-color:#f9f9f9;padding-top:10px'> <div style='font-size:12px;<? if ($box->is_paid()) echo "margin:5px 0 5px 390px;"; else echo "margin:5px 0 5px 390px; position:absolute;" ?>'>Language: <?= $languages_list ?></div> <? if (!$box->is_paid()) echo "<div align='left'>".$coins_list."</div>"; ?> <?= $box->display_cryptobox() ?> </div> <br><br><br> <button onclick='document.form1.submit()' style='padding:6px 20px;font-size:18px;'>Post Your Article/Comment</button> <? endif; ?> </div><br><br><br><br><br><br> </body> </html>

Protection Against Spam. Easy to use -

<? require_once( "cryptobox.class.php" ); /**** CONFIGURATION VARIABLES ****/ $userID = ""; // new user, it will autogenerate userID and save in cookies $userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION) $orderID = "signuppage"; // Registration Page $amountUSD = 1; // price per registration - 1 USD $period = "NOEXPIRY"; // one time payment for each new user, not expiry $def_language = "en"; // default Payment Box Language $def_payment = "bitcoin"; // default Coin in Payment Box // List of coins that you accept for payments // For example, for accept payments in bitcoins, dogecoins use - $available_payments = array('bitcoin', 'dogecoin'); $available_payments = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit'); // Goto https://gourl.io/info/memberarea/My_Account.html // You need to create record for each your coin and get private/public keys // Place Public/Private keys for all your available coins from $available_payments $all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-private key for Bitcoin box-"), "dogecoin" => array("public_key" => "-your public key for Dogecoin box-", "private_key" => "-private key for Dogecoin box-") // etc. ); /********************************/ // Re-test - that all keys for $available_payments added in $all_keys if (!in_array($def_payment, $available_payments)) $available_payments[] = $def_payment; foreach($available_payments as $v) { if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable"); elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false) die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file cryptobox.config.php."); } // Optional - Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Optional - Coin selection list (html code) $coins_list = display_currency_box($available_payments, $def_payment, $def_language, 42, "margin: 5px 0 0 20px"); $coinName = CRYPTOBOX_SELCOIN; // current selected coin by user // Current Coin public/private keys $public_key = $all_keys[$coinName]["public_key"]; $private_key = $all_keys[$coinName]["private_key"]; /** PAYMENT BOX **/ $options = array( "public_key" => $public_key, // your public key from gourl.io "private_key" => $private_key, // your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate key "orderID" => $orderID, // order id "userID" => $userID, // unique identifier for every user "userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS or SESSION "amount" => 0, // price in coins OR in USD below "amountUSD" => $amountUSD, // we use price in USD "period" => $period, // payment valid period "language" => $def_language // text on EN - english, FR - french, etc ); // Initialise Payment Class $box = new Cryptobox ($options); // coin name $coinName = $box->coin_name(); // Form Data // -------------------------- $fname = (isset($_POST["fname"])) ? $_POST["fname"] : ""; $femail = (isset($_POST["femail"])) ? $_POST["femail"] : ""; $fpassword = (isset($_POST["fpassword"])) ? $_POST["fpassword"] : ""; $error = ""; $successful = false; if (isset($_POST) && isset($_POST["fname"])) { if (!$fname) $error .= "<li>Please enter Your Name</li>"; if (!$femail) $error .= "<li>Please enter Your Email</li>"; if (!$fpassword) $error .= "<li>Please enter Your Password</li>"; if (!$box->is_paid()) $error .= "<li>".$coinName."s have not yet been received</li>"; if ($error) $error = "<br><ul style='color:#eb4847'>$error</ul>"; if ($box->is_paid() && !$error) { // Successful Cryptocoin Payment received // Your code here - // save user data in db / register new user ... // ... // ... // Set Payment Status to Processed $successful = true; $box->set_status_processed(); // Optional, cryptobox_reset() will delete cookies/sessions with userID and // new cryptobox with new payment amount will be show after page reload. // Cryptobox will recognize user as a new one with new generated userID $box->cryptobox_reset(); } } // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... ?> <!DOCTYPE html> <html><head> <title>Pay-Per-Registration Cryptocoin (payments in multiple cryptocurrencies) Payment Example</title> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='Expires' content='-1'> <script src='cryptobox.min.js' type='text/javascript'></script> </head> <body style='font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#666;margin:0'> <div align='center'> <br><h1>Example - Website Registration Form. Protection against spam!</h1> <br><img alt='Cryptocoin Registration Form' border='0' src='https://gourl.io/images/example8.png'> <a name='i'></a> <?php if ($successful): ?> <div align='center' style='margin:40px;font-size:24px;color:#339e2e;font-weight:bold'> You have been successfully registered on our website!</div> <? else: ?> <form name='form1' style='font-size:14px;color:#444' action="pay-per-registration-multi.php#i" method="post"> <table cellspacing='20'> <tr><td colspan='2'><b>NEW USER</b><?= $error ?><input type='text' style='display: none'> <input type='password' style='display: none'></td></tr> <tr><td width='100'>Name: </td><td width='300'><input style='padding:6px;font-size:18px;' size='30' type="text" name="fname" value="<?= $fname ?>"></td></tr> <tr><td>Email: </td><td><input style='padding:6px;font-size:18px;' size='40' type="text" name="femail" value="<?= $femail ?>"></td></tr> <tr><td>Password: </td><td><input style='padding:6px;font-size:18px;' size='35' type="password" name="fpassword" value="<?= $fpassword ?>"><br><br></td></tr> </table> </form> <div style='width:600px;padding-top:10px'> <div style='font-size:12px;<? if ($box->is_paid()) echo "margin:5px 0 5px 390px;"; else echo "margin:5px 0 5px 390px; position:absolute;" ?>'>Language: <?= $languages_list ?></div> <? if (!$box->is_paid()) echo "<div align='left'>".$coins_list."</div>"; ?> <?= $box->display_cryptobox(true, 530, 230, "border-radius:15px;border:1px solid #eee;padding:3px 6px;margin:10px") ?> </div> <?php if (!$box->is_paid()): ?> <br>* You need to pay <?= $coinName ?>s (~<?= $amountUSD ?> US$) for register on our website<br> <? endif; ?> <br><br> <button onclick='document.form1.submit()' style='padding:6px 20px;font-size:18px;'>Register</button> <? endif; ?> </div><br><br><br><br><br><br> </body> </html>















6. Pay-Per-View/Page Bitcoin Example of php code (Bitcoin Pay-Per-Page Payment Gateway) for your website. Your registered users or unregistered visitors will need to send you a set amount of cryptocoins for access to your website's specific pages & videos during a specific time. You can take separate payments for separate pages of your website. All will be in automatic mode - allowing you to receive payments, to open webpage access to your members, showing after the time a new payment form, payment notifications to your email, etc. For example, you have a website and you offer paid access to few pages of your website for the price of 0.6 USD for 24 HOURS (1 DAY) access for website visitors (non-registered users). You can install simple code below on top of pages with that paid access. Your visitors will see automatic cryptocoin payment box and when they make their payment, they will get access to your pages/videos and after 24 hours they will see a new payment box. Live Example9 (bitcoin only) Live Example10 (multiple cryptocurrencies)





















No your visitor registration is needed on your website. Anonymous. Use Pay-Per-Page Access on your website !

<? require_once( "cryptobox.class.php" ); /**** CONFIGURATION VARIABLES ****/ $userID = ""; // leave empty for unregistered visitors on your website // if userID is empty, it will autogenerate userID and save in cookies // or place your registered userID or md5(userID) here (user1, user7, ko43DC, etc). $userFormat = "COOKIE"; // save userID in cookies (or you can use IPADDRESS, SESSION) $orderID = "page1"; // Separate payments for separate your web page(s) - page1, page2, section1, etc. $amountUSD = 0.6; // price per page(s) - 0.6 USD $period = "24 HOUR"; // user will get access to page(s) for 24 hours; after need to pay again $def_language = "en"; // default Payment Box Language $def_payment = "bitcoin"; // default Coin in Payment Box // List of coins that you accept for payments // For example, for accept payments in bitcoins, dogecoins use - $available_payments = array('bitcoin', 'dogecoin'); $available_payments = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit'); // Goto https://gourl.io/info/memberarea/My_Account.html // You need to create record for each your coin and get private/public keys // Place Public/Private keys for all your available coins from $available_payments $all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-private key for Bitcoin box-"), "dogecoin" => array("public_key" => "-your public key for Dogecoin box-", "private_key" => "-private key for Dogecoin box-") // etc. ); /********************************/ // Re-test - that all keys for $available_payments added in $all_keys if (!in_array($def_payment, $available_payments)) $available_payments[] = $def_payment; foreach($available_payments as $v) { if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable"); elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false) die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file cryptobox.config.php."); } // Optional - Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Optional - Coin selection list (html code) $coins_list = display_currency_box($available_payments, $def_payment, $def_language, 70, "margin: 5px 0 0 20px"); $coinName = CRYPTOBOX_SELCOIN; // current selected coin by user // Current Coin public/private keys $public_key = $all_keys[$coinName]["public_key"]; $private_key = $all_keys[$coinName]["private_key"]; /** PAYMENT BOX **/ $options = array( "public_key" => $public_key, // your public key from gourl.io "private_key" => $private_key, // your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate key "orderID" => $orderID, // order id "userID" => $userID, // unique identifier for every user "userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS or SESSION "amount" => 0, // price in coins OR in USD below "amountUSD" => $amountUSD, // we use price in USD "period" => $period, // payment valid period "language" => $def_language // text on EN - english, FR - french, etc ); // Initialise Payment Class $box = new Cryptobox ($options); // coin name $coinName = $box->coin_name(); // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... ?> <!DOCTYPE html> <html><head> <title>Pay-Per-Page Access Cryptocoin (payments in multiple cryptocurrencies) Payment Example</title> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='Expires' content='-1'> <script src='cryptobox.min.js' type='text/javascript'></script> </head> <body style='font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#666;margin:0'> <div align='center'> <br><h2>Example - Visitors Access to Your Premium Webpage (Pay-Per-Page)</h2> Price: ~<?= $amountUSD ?> US$ for <?= $period ?> access. <br><br> <?php if ($box->is_paid()): ?> <!-- Successful Cryptocoin Payment received --> <!-- You can use the same payment gateway code for few your pages (page1, page2, section1) --> <!-- Your Premium Page(s) Code --> <h2 style='color:#339e2e;'>Cryptocoin Payment received<br>Successful Access to Premium Page (during <?= $period ?>)</h2> <img alt='Cryptocoin Pay Per Page Access' border='0' src='https://gourl.io/images/example9_2.jpg'> <? else: ?> <!-- Awaiting Payment --> <img alt='Awaiting Payment - Cryptocoin Pay Per Page Access' border='0' src='https://gourl.io/images/example9.jpg'> <br><br><br><br> <? if (!$box->is_paid()) echo $coins_list; ?> <div style='font-size:12px;margin:30px 0 5px 370px'>Language: <?= $languages_list ?></div> <?= $box->display_cryptobox(true, 530, 230, "padding:3px 6px;margin:10px") ?> <? endif; ?> </div><br><br><br><br><br><br> </body> </html>















7. Pay-Per-Membership Bitcoin For example, you have a website and you offer paid membership to premium content of your website for the price of 79 USD for 1 MONTH access. You can install simple code below on top of pages with that premium access. Your visitors will see automatic cryptocoin payment box and when they make their payment, they will get access to your pages and after 1 month they will see a new payment box. Our payment box is fully customized. And you can easily configure it - changing access time period (3 hours, 1 day, 2 days, 1 week...), price (in USD or in Bitcoins), currency, payment notifications to your email, offering onetime payment, etc. Then you can use Poloniex.com autosell feature and auto trade your bitcoins to USD/BTC. All will be in automatic mode - allowing you to receive payments, upgrade membership to your members, showing after the time a new payment form, convert to USD, etc.

Live Example11 (bitcoin only) Live Example12 (multiple cryptocurrencies)























Example of php code (Bitcoin Pay-Per-Membership Payment Gateway) for your website. It is easy !

<? require_once( "cryptobox.class.php" ); /**** CONFIGURATION VARIABLES ****/ $userID = "-place_your_users_id-"; // place your registered userID or md5(userID) here (user1, user7, ko43DC, etc). // your user should have already registered on your website before $userFormat = "COOKIE"; // this variable ignored when you use $userID $orderID = "premium_membership"; // premium membership order $amountUSD = 79; // price per membership - 79 USD $period = "1 MONTH"; // one month membership; after need to pay again $def_language = "en"; // default Payment Box Language $def_payment = "bitcoin"; // default Coin in Payment Box // List of coins that you accept for payments // For example, for accept payments in bitcoins, dogecoins use - $available_payments = array('bitcoin', 'dogecoin'); $available_payments = array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit'); // Goto https://gourl.io/info/memberarea/My_Account.html // You need to create record for each your coin and get private/public keys // Place Public/Private keys for all your available coins from $available_payments $all_keys = array( "bitcoin" => array("public_key" => "-your public key for Bitcoin box-", "private_key" => "-private key for Bitcoin box-"), "dogecoin" => array("public_key" => "-your public key for Dogecoin box-", "private_key" => "-private key for Dogecoin box-") // etc. ); /********************************/ // Re-test - that all keys for $available_payments added in $all_keys if (!in_array($def_payment, $available_payments)) $available_payments[] = $def_payment; foreach($available_payments as $v) { if (!isset($all_keys[$v]["public_key"]) || !isset($all_keys[$v]["private_key"])) die("Please add your public/private keys for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["public_key"], "PUB")) die("Invalid public key for '$v' in \$all_keys variable"); elseif (!strpos($all_keys[$v]["private_key"], "PRV")) die("Invalid private key for '$v' in \$all_keys variable"); elseif (strpos(CRYPTOBOX_PRIVATE_KEYS, $all_keys[$v]["private_key"]) === false) die("Please add your private key for '$v' in variable \$cryptobox_private_keys, file cryptobox.config.php."); } // Optional - Language selection list for payment box (html code) $languages_list = display_language_box($def_language); // Optional - Coin selection list (html code) $coins_list = display_currency_box($available_payments, $def_payment, $def_language, 70, "margin: 5px 0 0 20px"); $coinName = CRYPTOBOX_SELCOIN; // current selected coin by user // Current Coin public/private keys $public_key = $all_keys[$coinName]["public_key"]; $private_key = $all_keys[$coinName]["private_key"]; /** PAYMENT BOX **/ $options = array( "public_key" => $public_key, // your public key from gourl.io "private_key" => $private_key, // your private key from gourl.io "webdev_key" => "", // optional, gourl affiliate key "orderID" => $orderID, // order id "userID" => $userID, // unique identifier for every user "userFormat" => $userFormat, // save userID in COOKIE, IPADDRESS or SESSION "amount" => 0, // price in coins OR in USD below "amountUSD" => $amountUSD, // we use price in USD "period" => $period, // payment valid period "language" => $def_language // text on EN - english, FR - french, etc ); // Initialise Payment Class $box = new Cryptobox ($options); // coin name $coinName = $box->coin_name(); // Successful Cryptocoin Payment received if ($box->is_paid()) { // one time action if (!$box->is_processed()) { // One time action after payment has been made $message = "Thank you (order #".$orderID.", payment #".$box->payment_id()."). We upgraded your membership to Premium"; // Set Payment Status to Processed $box->set_status_processed(); } else $message = "You have a Premium Membership"; } // ... // Also you can use IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") // for send confirmation email, update database, update user membership, etc. // You need to modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn // ... ?> <!DOCTYPE html> <html><head> <title>Pay-Per-Membership Cryptocoin (payments in multiple cryptocurrencies) Payment Example</title> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='Expires' content='-1'> <script src='cryptobox.min.js' type='text/javascript'></script> </head> <body style='font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#666;margin:0'> <div align='center'> <br><h2>Example - Upgrade to a Premium Member Account</h2> <br> <?php if ($box->is_paid()): ?> <!-- User already paid premium membership --> <!-- You can use this function - $box->is_paid() on all other your premium webpages, it will return true during all user paid period (1 month) --> <!-- Your Premium Pages Code Here --> <br><br><br> <?= $message ?> <br><br><br> <? else: ?> <!-- Awaiting Payment --> <img alt='Awaiting Payment - Cryptocoin Pay Per Membership' border='0' src='https://gourl.io/images/example10.png'> <br><br><br> <h3>Upgrade Your Membership Now ( $<?= $amountUSD ?> per <?= $period ?> ) - </h3> <? endif; ?> <br><br> <? if (!$box->is_paid()) echo $coins_list; ?> <div style='font-size:12px;margin:50px 0 5px 370px'>Language: <?= $languages_list ?></div> <?= $box->display_cryptobox(true, 530, 230, "padding:3px 6px;margin:10px;border:10px solid #f7f5f2;") ?> </div><br><br><br><br><br><br> </body> </html>