Paycoin Payment Gateway Examples / Paycoin API Examples


paycoin payments api

Paycoin Payment API PHP Examples

Paycoin PHP API - Instruction  and  Download PHP Class/Script »

API - ASP.NET and Python, Java, C#, Node.js, etc

Wordpress:  Wordpress Plugins  and  WP API for your site

Paycoin (XPY) Price: 0.00000496 BTC  /  US$0.00298096 per 1 XPY

Website: https://paycoin.com

Block Explorer: https://chainz.cryptoid.info/xpy

Exchange: https://bittrex.com/Market/?MarketName=BTC-XPY





14 Live Examples with Paycoin Payments on PHP/ASP.NET

1. Pay-Per-Product - Paycoin only 2. Pay-Per-Product - Multiple currencies 3. Pay-Per-Download - Paycoin only 4. Pay-Per-Download - Multiple currencies 5. Pay-Per-Post - Paycoin only 6. Pay-Per-Post - Multiple currencies 7. Pay-Per-Registration - Paycoin only 8. Pay-Per-Registration - Multiple currencies 9. Pay-Per-View/Page - Paycoin only 10. Pay-Per-View/Page - Multiple currencies 11. Pay-Per-Membership - Paycoin only 12. Pay-Per-Membership - Multiple currencies 13. Direct Payments between your website users

new 14. Custom-Paycoin-Box - Customize Paycoin payment box with JSON





You have three choices to display paycoin payment box/data on your webpage/applications -

  • By Using html Iframe paycoin payment box. Example below »
  • By using JSON data Client Side. It will allow you to easily customise your bitcoin payment box. Javascript & JQuery instruction here »
  • JSON Server Side - Alternatively, you can receive JSON values through curl on server side - function get_json_values() and use it in your application without javascript and iframe - code »

JSON Examples - Payment Not Received Payment Received jQuery & JSON Box Example



Paycoin Payment Box (iframe)

Send paycoins to the address in the payment box below and you will see how it changes

Language:  






affiliate bitcoin


or

You can use an alternative affiliate program - 'Referral a friend' which gives payment commissions to your affiliate website user who has referred another user/seller/buyer to your website. This will make your website much more attractive and help to advertise your website on the internet. Read here








Start Now

Note: If you want to integrate Bitcoin/altcoin payments in your Wordpress Plugin, please use our wordpress instruction »




GoUrl Paycoin Payment API Features

Our Payment Gateway with Paycoin Instant Checkout allows you to easily organise your website -

Please note different currencies have different transaction confirmation times. There are no other differences (except period of confirmation time) between Dogecoin, Bitcoin, Litecoin and other cryptocoins in GoUrl Payment API.





1. Paycoin Pay-Per-Product API

Example of php code (Paycoin Pay-Per-Product Payment Gateway) for your website -

No visitors registration is needed. Easy to use!  Also see API Function Descriptions

Live Example1 (paycoin only)       Live Example2 (multiple cryptocurrencies)

pay per product paycoin api

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 Paycoin 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: &#160; <?= $languages_list ?></div>
<?= $payment_box ?>
<?= $message ?>

</body>
</html>

Example PHP Source





1.2 Paycoin Pay-Per-Product API - Multiple Currencies



Live Example1 (paycoin only)       Live Example2 (multiple cryptocurrencies)



payment api

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	= "paycoin";		// default Coin in Payment Box

	// List of coins that you accept for payments
	// For example, for accept payments in bitcoins, paycoins use - $available_payments = array('bitcoin', 'paycoin'); 
	$available_payments = array('bitcoin', 'litecoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 
						'vertcoin', 'vericoin', 'peercoin', 'monetaryunit', 'paycoin', 'swiscoin');
	
	
	// 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-"),
		"paycoin" => array("public_key" => "-your public key for Paycoin box-", "private_key" => "-private key for Paycoin 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: &#160; <?= $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>






2. Pay-Per-Download Paycoin

Example of php code (Paycoin 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 (paycoin only)       Live Example4 (multiple cryptocurrencies)









pay-per-download paycoin api

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	= "paycoin";		// default Coin in Payment Box

	// List of coins that you accept for payments
	// For example, for accept payments in bitcoins, paycoins use - $available_payments = array('bitcoin', 'paycoin'); 
	$available_payments = array('bitcoin', 'litecoin', 'paycoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 
						'feathercoin', 'vertcoin', 'vericoin', 'peercoin', 'monetaryunit', 'swiscoin');
		
		
	// 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-"),
		"paycoin" => array("public_key" => "-your public key for Paycoin box-", "private_key" => "-private key for Paycoin 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: &#160; <?= $languages_list ?></div>
<?= $box->display_cryptobox() ?>

<br><br><br><br><br><br>
</div>
</body>
</html>






3. Pay-Per-Post Paycoin

Example of php code (Paycoin Pay-Per-Post Payment Gateway) for your website.
Sell right to publish new posts on your website

Live Example5 (paycoin only)       Live Example6 (multiple cryptocurrencies)






pay-per-post paycoin api

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, paycoins use - $available_payments = array('bitcoin', 'paycoin'); 
	$available_payments = array('bitcoin', 'litecoin', 'paycoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 
						'feathercoin', 'vertcoin', 'vericoin', 'peercoin', 'monetaryunit', 'swiscoin');
	
	
	// 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-"),
		"paycoin" => array("public_key" => "-your public key for Paycoin box-", "private_key" => "-private key for Paycoin 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 &#187;</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: &#160; <?= $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>







4. Pay-Per-Registration Paycoin

Example of php code (Paycoin Pay-Per-Registration Payment Gateway) for your website.
Make money on user registration on your website. Stop Spam!

Live Example7 (paycoin only)       Live Example8 (multiple cryptocurrencies)





pay-per-post paycoin api

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	= "paycoin";		// default Coin in Payment Box

	// List of coins that you accept for payments
	// For example, for accept payments in bitcoins, paycoins use - $available_payments = array('bitcoin', 'paycoin'); 
	$available_payments = array('bitcoin', 'litecoin', 'paycoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 
						'feathercoin', 'vertcoin', 'vericoin', 'peercoin', 'monetaryunit', 'swiscoin');
	
	
	// 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-"),
		"paycoin" => array("public_key" => "-your public key for Paycoin box-", "private_key" => "-private key for Paycoin 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: &#160; <?= $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>







5. Pay-Per-View/Page Paycoin

Example of php code (Paycoin 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 (paycoin only)       Live Example10 (multiple cryptocurrencies)











pay per view page paycoin

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	= "paycoin";		// default Coin in Payment Box

	// List of coins that you accept for payments
	// For example, for accept payments in bitcoins, paycoins use - $available_payments = array('bitcoin', 'paycoin'); 
	$available_payments = array('bitcoin', 'litecoin', 'paycoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 
						'feathercoin', 'vertcoin', 'vericoin', 'peercoin', 'monetaryunit', 'swiscoin');
	
	
	// 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-"),
		"paycoin" => array("public_key" => "-your public key for Paycoin box-", "private_key" => "-private key for Paycoin 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: &#160; <?= $languages_list ?></div>
	<?= $box->display_cryptobox(true, 530, 230, "padding:3px 6px;margin:10px") ?>
	
<? endif; ?> 	

</div><br><br><br><br><br><br>
</body>
</html>







6. Pay-Per-Membership Paycoin

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 Paycoins), currency, payment notifications to your email, offering onetime payment, etc.

Then you can use Poloniex.com autosell feature and auto trade your paycoins 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 (paycoin only)       Live Example12 (multiple cryptocurrencies)












pay per membership paycoin api

Example of php code (Paycoin 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	= "paycoin";				// default Coin in Payment Box

	// List of coins that you accept for payments
	// For example, for accept payments in bitcoins, paycoins use - $available_payments = array('bitcoin', 'paycoin'); 
	$available_payments = array('bitcoin', 'litecoin', 'paycoin', 'dogecoin', 'dash', 'speedcoin', 'reddcoin', 'potcoin', 
						'feathercoin', 'vertcoin', 'vericoin', 'peercoin', 'monetaryunit', 'swiscoin');
	
	
	// 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-"),
		"paycoin" => array("public_key" => "-your public key for Paycoin box-", "private_key" => "-private key for Paycoin 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: &#160; <?= $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>







7. Get Paycoin payment box values in JSON format

Examples -

    JSON - payment not received   HTML     and    JSON - payment received   HTML


JSON data will allow you to easily customise your paycoin payment boxes. For example, you can display payment amount and paycoin payment address with your own text, you can also accept payments in android/windows and other applications.


A. Payment not received -


See live demo



B. Payment received successfully -


See live demo


JQuery/Json Instruction -


I. You will need to create a html file with empty <div class='gourl_...'></div>, <span class='gourl_...'></span> elements as template which will automatically fill-in json values from gourl.io.

JSON Examples -    Payment Not Received     Payment Received     jQuery & JSON Box Example     jQuery Result Example

For example, if you want to publish payment amount to a user - place on webpage:
<span class='gourl_amount'></span> <span class='gourl_coinlabel'></span> (see here)
(i.e. it will prefix 'gourl_' + value key of json data, in our case [amount] => 0.00039957 and [coinlabel] => BTC, user will see - '0.00039957 BTC' on page)

II. In beginning of your html file, please call javascript function cryptobox_custom(url, paid, path, ext, redirect).
This function will receive JSON payment data from Gourl.io payment gateway through jquery ajax request and will place received json values in all existing html <div class='gourl_...'>, <span class='gourl_...'> elements on webpage.

Also the function checks the status every 7 seconds to see if payment has been received and automatically displays received payment data on webpage (result demo).

This function has the following parameters (code) -

  • url - payment url to gourl.io. Using this url you can get bitcoin/altcoin payment box values in JSON format.
    Please use php function $box->cryptobox_json_url() - which will generate url with your parameters to gourl.io payment gateway.
  • paid - 1/0, shows if transaction received already or not. You need to call $this->is_paid() as in example.
  • path - path to file cryptobox.callback.php; it will be automatically call that file through ajax if payment is received
  • ext - custom prefix in html class names, by default 'gourl_'. You can use for example - 'mycrypto_' and therefore div class in html template will be <div class='mycrypto_amount'></div>, etc.
  • redirect - url, redirect to another page after payment is received; i.e. when payment received - it will automatically call cryptobox.callback.php through ajax and after 5 seconds it will redirect to another page. Also php class $this->is_paid() start to return TRUE.

III. Add your code (send confirmation email, update database, update user membership, etc) to IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = ""). This function is used every time a new payment from any user is received successfully. It is calling from cryptobox.callback.php. Read more about IPN here

Done!



Alternatively (server side)

Alternatively, you can receive JSON values through php curl on server side - function get_json_values() and use it in your php/other files without using javascript and jquery/ajax (see code).



Example of html/php code (Paycoin Custom Box) for your website -
<?php
    $message    = "";
    $path       = "../";
    $page_url   = "//".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."#gourlcryptolang"; // Current page url
    
    require_once( $path."cryptobox.class.php" );
    
	/**** CONFIGURATION VARIABLES ****/ 
	$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
	);
	// Please read description of options here - https://gourl.io/api-php.html#options  
	
	// Initialise Payment Class
	$box = new Cryptobox ($options);

	// Payment Received
	if ($box->is_paid()) 
	{ 
		// Your code here to handle a successful cryptocoin payment/captcha verification
	
	}  
	
	// Alternatively, you can receive JSON values through php curl on server side (without using javascript and jquery).
	// print_r($box->get_json_values());


	// Also you need to add your code to IPN function cryptobox_new_payment($paymentID = 0, $payment_details = array(), $box_status = "") 
	// for send confirmation email, update database, update user membership, etc.
	// Please modify file - cryptobox.newpayment.php, read more - https://gourl.io/api-php.html#ipn
	
?>



<!DOCTYPE html>
<html lang="en">
<head>
	.....
</head>

<body>

<!-- JQuery Payment Box Script, see https://github.com/cryptoapi/Payment-Gateway/blob/master/cryptobox.js#L14 -->
<script> cryptobox_custom('<?php echo $box->cryptobox_json_url(); ?>', <?php echo intval($box->is_paid()); ?>, '<?php echo $path; ?>', 'gourl_', ''); </script>

	.... 
    
    <!-- Custom Crypto Payment Box HTML Code  -->
    
    <div class="gourl_cryptobox_unpaid" style="display:none">        
        <div class="row">
            <div class="col-md-4">
                <div class="panel panel-info">
                    <div class="panel-heading">
                    	<h3 class="panel-title">1. <span class="gourl_texts_instruction"></span></h3>
                    </div>
                    <div class="panel-body">
                        <div>
                        	<ol>
                        		<li class="gourl_texts_intro1"></li>
                        		<li class="gourl_texts_intro2"></li>
                        		<li><b class="gourl_texts_intro3"></b></li>
                        	</ol>
                        </div>
                    </div>
            	</div>
            </div>
    
            <div class="col-md-4">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title gourl_addr_title">2. <span class="gourl_texts_coin_address"></span></h3>
                    </div>
                    <div class="panel-body">
                        <div style="float:right; margin-bottom:10px">
                        	<a class='gourl_wallet_url' href='#'><img class='gourl_qrcode_image' alt='qrcode' data-size='100' src='#'></a>
                        </div>
                        <br>
                        <div class="gourl_texts_send"></div>
                        <br>
                       	<div><a class="gourl_addr gourl_wallet_url" href="#"></a></div>
                    </div>
                </div>
            </div>
    
            
            <div class="col-md-4">
            
                <div class="panel panel-warning">
                    <div class="panel-heading">
                    	<h3 class="panel-title">3. <span class="gourl_paymentcaptcha_amount"></span></h3>
                    </div>
                    <div class="panel-body">
                    	<span class="gourl_amount"></span> <span class="gourl_coinlabel"></span> + <a class="gourl_texts_fees gourl_fees_hint" href="#"></a>
                    	
                    </div>
                </div>
                
                <div class="panel panel-success">
                    <div class="panel-heading">
                    	<h3 class="panel-title">4. <span class="gourl_paymentcaptcha_status"></span></h3>
                    </div>
                    <div class="panel-body">
                    	<div class="gourl_paymentcaptcha_statustext"></div>
                    </div>
                </div>
                
            </div>
            
        </div>
    
    </div>

	...    
    
Source







8. Direct Payments between your website users

You can create bitcoin/altcoin online auction, classified ads, paid forum, etc on your website.

GoUrl Bitcoin/Altcoin Gateway allows you to provide direct payments between your website users (userA pay to userB, userB pay to userD, etc ), your website will display a payment form and will receive a confirmation notice every time on whether a payment is successful or not. Each of your users will see their payment statistics on gourl.io also. All will be in automatic mode.

You can do this in the same way as this website shopbidsell.com (see screenshot)

How it works -

  1. Install php Gourl Payment Box on your website
  2. Each of your users create a free account on gourl.io
  3. Then create new bitcoin/altcoin payment box(es) on gourl.io
  4. The user will get gourl payment box keys and can save them on your website.
  5. Your website will then display a crypto payment box using those keys, the payment will go directly between your users (the buyer and seller), and at the same time your website will receive confirmation if the payment is successful or not and, if so, will process it.
  6. All of your users will see their own payment statistics as a member on gourl.io too.

Instruction Screenshot from shopbidsell.com      





auction paycoin api


Also you can use affiliate programs on your website -

  1. 0.50% payment commission from each payment to you as the website owner. Read here
    or
  2. You can use an alternative affiliate program - 'Referral a friend' which gives payment commissions to your affiliate website user who has referred another user/seller/buyer to your website. This will make your website much more attractive and help to advertise your website on the internet. Read here









Online Monetiser


Please use online monetiser if you don't have your own website. Make money online !

Examples of Monetiser Links -








CONTACT US


We offer Free Support in the integration of our GoUrl Crypto Payment Gateway in your scripts/plugins/website (accepting Bitcoin/Dogecoin/etc payments from users online).

Please feel free to contact us if you have any questions

Contact Us







July 2017
Back to Top