Generate merchant ID
If you've a product costs 10$ sold 300 times in a month
Paypal | You'll get 2823$, Paypal takes 177$ |
---|---|
Stripe | You'll get 2823$, Stripe takes 177$ |
Square | You'll get 2823$, Square takes 177$ |
Binance | You'll get 2850$, Binance takes 150$ |
Coinbase | You'll get 2970$, Coinbase takes 30$ |
CryptoCheckout | You'll get 2998$, CryptoCheckout takes 2$ |
Woocommerce | View or Download Downloads: 406 |
---|---|
Shopify | Coming soon |
PrestaShop | Download |
OpenCart | Coming soon |
Script inclusion
<script src="/jquery.min.js" ></script>
<script src="https://cryptocheckout.co/crypto.js?id=YOUR-ID&lang=LANGUAGE"></script>
Accept only from specified currencies like this
<script src="/jquery.min.js" ></script>
<script src="https://cryptocheckout.co/crypto.js?id=YOUR-ID&curr=btc+avax&lang=LANGUAGE&"></script>
Initiatising the button
showbtn('MycontainerdivID',{usd:1},onApprove=function(transactionId){//Do something},onError=function(error){//Do something});
Or your own prices:
showbtn('MycontainerdivID',{usd:1,btc:0.0000515632,eth:0.0009344048,sol:0.0301386377},onApprove=function(transactionId){//Do something},onError=function(error){//Do something});
onApprove(transactionId) invocation
<script>
// put it inside onApprove function
(function($){
$.get('https://yoursite.com/validatepaymentpage.php?transactionId='+transactionId,function(response){
if(response.result == true ){
// redirect to thank you page or show thank you
window.location.assign('youtsite.com/thankyoupage.php?orderId='+response.orderId)
}else{
// show validation error
alert(response.msg);
}
});
}(jQuery)
</script>
The server side payment validation
<?php
if( isset($_GET['transactionId'] ){
$transaction_object = json_decode(file_get_contents('https://cryptocheckout.co/?transaction='.$_GET['transactionId']));
if( abs(floatval($product_price)*floatval($transaction_object->rate)-floatval($transaction_object->amount))<=0.000001 && $transaction_object->completed == true && !in_array($_GET['transactionId'],$transactions_list) ){
blacklist_transaction($_GET['transactionId']);
// generate orderId
$orderId = md5(strval(round(microtime(true)*1000)));
header('Content-type: application/json');
echo json_encode(array('result'=>true,'msg'=>'Thank you for your purchase!','orderId'=>$orderId));
die();
}else{
header('Content-type: application/json');
echo json_encode(array('result'=>false,'msg'=>'We can\'t validate your payment'));
die();
}
}else{
header('Content-type: application/json');
echo json_encode(array('result'=>false,'msg'=>'transactionId is required'));
die();
}
Any issues contact: support@cryptocheckout.co