Payment Box Installation -
- Register for Free on the website and create new payment box
- Download Free PHP Payment API Class OR Download Script and Javascript functions and read How It Works
- When you setup Cryptocoin Payment Box, you can enter the original amount of cryptocoins.
- Place your public/private keys from the new payment box in any
- You can use this php/json example and run it
THAT'S IT! CRYPTOCOIN PAYMENT BOX SHOULD NOW BE WORKING ON YOUR SITE
You can access this payment gateway in below frameworks
PHP Class API
Here you will find everything you need to get started coding for OWC on PHP.
I. PHP Developer's Guide
Crypto Payment box configuration
Every instance of a Cryptobox Class can have different set of instance configuration variables. It use in $PaymentGateway = new PaymentGateway ($options); see below -
require_once('plugin_dir_path( __FILE__ )/PaymentGateway.php'); // load PaymentGateway.php first // All Default Configuration variables
$options = array(
'public_key'=>"", // your payment gateway public key
'private_key'=>"", // your payment gateway private key
'boxID'=>"", // your payment gateway box id
'coinLabel'=>"OWC", // coin name(OWC)
'userID'=>$userId, // user Id of your site
'orderID'=>$orderId, // order id of your site
'coinAmount'=>$coinAmount, // in double/dacimal value
'usdAmount'=>$usdAmount, // in float/integer value
'boxwidth'=>'500', // in px
'iframeID'=>'', //optional(autogenerate if not given)
'cookieName'=>'', // your cookie name for store basic data
);
// Initialise Payment Class
$PaymentGateway = new PaymentGateway($options);
- public_key
Cryptocoin Payment Box Public Key from your payment box. - private_key
Cryptocoin Payment Box Private Key from your payment box. - boxID
Cryptocoin Payment Box Key from your payment box. - coinLabel
Cryptocoin Payment Box coin name (OWC). - userID
manual setup unique identifier each of your users.
You need to use a variable userID when you use Cryptocoin Payment Box for registered users on your website.
IMPORTANT :
Examples: 'user1', 'user2', '3vIh9MjEis'
allow symbols: a..Z0..9_-@.; max size: 50 symbols - orderID
Your order id or product name; allow symbols: a..Z0..9_-@.; max size: 50 symbols, examples: 'order44', 'premium_page', 'product123 - coinAmount
Amount of cryptocoins which will be used in the payment box, precision is 8 (number of digits after the decimal), example: 0.00000001, 2.44400000, 100.00000000, 2455.00000000, etc. We will use this value of cryptocoins in the payment box with a small fraction after the decimal point to uniquely identify your visitors individually - usdAmount
You can directly specify your price in USD (float values allowed) and cryptobox will automatically convert that USD amount to cryptocoin amount using today live cryptocurrency exchange rates (updated- every 30min). For example, if you select amountUSD = 4.2 USD - we will convert it to oduwa and it will be 0.86 OWC. We will display it in payment payment box for payment by the user. User will pay you all times the actual price which is linked on current exchange price in USD on the datetime of purchase. - boxwidth
html iframe cryptobox width(must be 500) - iframeID
Optional, html iframe cryptobox element id; when iframeID value is empty - system will autogenerate iframe id. Allow symbols: a..Z0..9 - cookieName
Optional,Your cookie name if you want to store order data in your site
II. PHP Class Cryptobox - List of Methods
Cryptocurrency Payment Class (file PaymentGateway.php) have following public methods -
-
function loadPaymentBox()
Display Cryptocoin Payment Box; the cryptobox will automatically display on fire this function. -
function check_server()
it's use for the cookie store on which domain and which url -
function cryptobox_hash()
it's generate hash for Cryptocoin Payment Box to identify the vendor payment box is valid or not -
function iframe_id()
it's generate iframe id to identify your order id -
function set_cookie()
if you pass cookie value in inititat of cryptobox then this method will genetate cookie on your domain and set order data in it
Javascript Function
This is the javascript OWC implementation guid. You have to download the cryptobox.js file and put it in your folder. After that load these js file in your page and execute cryptobox_show() function for get your Payment gateway.
Crypto Payment
Instant Payment Notification/Callback
Fields in callback -
{
"status": "payment_confirm", //payment status
"confirmed": '0' //0 - unconfirmed payment or 1 - confirmed payment with 6+ confirmations
"verify_hash": "", //Your transaction verify hash
"orderid": "4", //identifier for every order
"userid": "32783", //identifier for every user
"amount": "2.30000000", //Order amount
"received_amount": "2.10000000", //recieved amount
"addr": "RV6QC8mw7***E8HdXqqsnWybK", //your internal wallet address which you pay for it
"txHash": "9722494a9ff3b5a578a1cb***", //Your transaction hash
"requestdate": "2020-01-07 01:30:30" //Order request date
"pay_date": "2020-01-07 01:31:17", //Payment Date
}
A. User Has Made Correct Payment -
{
"status": "payment_confirm", //payment confirm
"confirmed": '0' //0 - unconfirmed payment or 1 - confirmed payment with 6+ confirmations
"verify_hash": "", //Your transaction verify hash
"orderid": "4", //identifier for every order
"userid": "32783", //identifier for every user
"amount": "2.30000000", //Order amount
"received_amount": "2.30000000", //recieved amount
"addr": "RV6QC8mw7***E8HdXqqsnWybK", //your internal wallet address which you pay for it
"txHash": "9722494a9ff3b5a578a1cb***", //Your transaction hash
"requestdate": "2020-01-07 01:30:30" //Order request date
"pay_date": "2020-01-07 01:31:17", //Payment Date
}
B. User Has Made Incorrect Payment (wrong amount) -
We use amount value of cryptocoins in the payment box with a small fraction after the decimal point to uniquely identify each of your users individually. If user pay wrong amount on your internal wallet address, OWC Gateway cannot identify that user. You need to process all unrecognised payments manually. We forward you ALL coins received on your internal wallet address/es including all payments with incorrect amounts (unrecognized payments).
In example below, user paid wrong/incorrect amount in 2.10 OWC to you -
{
"status": "payment_unrecognized", //payment_unrecognized
"confirmed": '0' //0 - unconfirmed payment or 1 - confirmed payment with 6+ confirmations
"verify_hash": "", //Your transaction verify hash
"orderid": "4", //identifier for every order
"userid": "32783", //identifier for every user
"amount": "2.30000000", //Order amount(real amount to pay 2.30)(you have to pay this)
"received_amount": "2.10000000", //recieved amount(Payed amount 2.10) // not valid
"addr": "RV6QC8mw7***E8HdXqqsnWybK", //your internal wallet address which you pay for it
"txHash": "9722494a9ff3b5a578a1cb***", //Your transaction hash
"requestdate": "2020-01-07 01:33:18" //Order request date
"pay_date": "2020-01-07 01:34:24", //Payment Date
}
We want response from your site on hit your callback url
You have to print response to your callback url on hit on it. Your response would be like this -
{ "status":false, "hash":"Your secure key" //md5(CONCAT(publicKey,privateKey,OrderId)); }
These function is only for PHP -
public function callback_function() { $status=false; //status for check response is valid or not $key=''; if(isset($_POST['status'])){ //it's identify that status and other data set or not // Compare your OrderId and UserId with your order table (OrderId=$_POST['orderid'] and UserId=$_POST['userid']) if (Comparation is TRUE) { $key = md5(CONCAT(publicKey,privateKey,OrderId)); $status = true; >> here update your data which have order OrderId=$_POST['orderid'] and UserId=$_POST['userid'] } } echo json_encode(['status'=>$status,'hash'=>$key]); // print the hash and status for verify that it's you }