Difference between revisions of "Include CloudCoin in an ATM system"

From CloudCoin Wiki
Jump to: navigation, search
Line 38: Line 38:
<pre style="background-color:black;color:white">
<pre style="background-color:black;color:white">
[username@hostname cwd]# $ ./skywallet_connect verify_payment 080A4CE89126F4F1B93E4745F89F6713 b4u.skywallet.cc
$ ./skywallet_connect verify_payment 080A4CE89126F4F1B93E4745F89F6713 b4u.skywallet.cc
{"amount_verified":100,"status":"success","message":"CloudCoins verified"}
{"amount_verified":100,"status":"success","message":"CloudCoins verified"}

Revision as of 19:37, 15 July 2021

There are four issues to consider. The generation of the QR code, the customer calling your web hook, verifying the CloudCoin payment and customize the receipt.

Providing a QR code for Cell Phones

Your ATM will need to generate a QR code so the customer can send you CloudCoins. The QR code will be a URL that any phone can use without installing any special software.

Sample URL that becomes a QR Code


Sample URL ( including an optional base64 message created by you ). This that becomes a QR Code


The QR code needs to contain the following Parameters:

  1. https. The Protocol. You must use https.
  2. Skywallet.cc The Skywallet.cc website. There is also a secondary website that is secret but can be switched over to if the Skywallet.cc is down.
  3. b4u The b4u web page. This page contains information about your Skywallet address, the customer's Skywallet address so it does not have to be included in the URL.
  4. cc The amount of CloudCoins that the user is to send. e.g. cc=400
  5. usd The amount of dollars the user is to get from the ATM. e.g. usd=60
  6. id The unique identifier generated by your system to identify the transaction. IMPORTANT: This id must by a guid without hyphens. id=7917cdf720c044049cc534a370130642
  7. b64 Optional information that the ATM may encoded in Base64. This will be passed on to your WebHook server.

Web Hook Page

You will need to have a web page that receives notice that your customer has send you CloudCoins and is waiting at the ATM.

Sample URL that your Web Hook receives


Sample URL that your Web Hook receives (including the optional base64 text )


Verifying Payment

You will need to verify that your Skywallet Account has received CloudCoins. You can do this by using the Skywallet Connect CLI. Skywallet Connect is a console application written in GoLang and runs on any platform. It can be called by any programming language.

$ ./skywallet_connect verify_payment 080A4CE89126F4F1B93E4745F89F6713 b4u.skywallet.cc
{"amount_verified":100,"status":"success","message":"CloudCoins verified"}

1. Sample Web Hook Page in PHP file (name it cloudcoin.php):


/* Load GET Parameters */
	isset($_GET['id'])? $id = $_GET['id']: die("ID required");
	isset($_GET['cc'])? $cc= $_GET['cc']: die("CC required");
	isset($_GET['b64'])? $b64= $_GET['b64']: $b64= '';

	$skywallet = "b4u.skywallet.cc"; 

	$skywallet_connect = "/usr/local/bin/skywallet_connect";

	if (!file_exists($skywallet_connect))
			die("skywallet_connect not found");

	if (!is_executable($skywallet_connect))
			die("skywallet_connect doesn't have exec permissions");

/* Verify Receipt of CloudCoins */
        global $skywallet_connect;

		$cmd =  "$skywallet_connect verify_payment $id";
		//echo $cmd;

        // Exec the binary
        $json = exec($cmd, $outarray, $error_code);
        if ($error_code != 0) {
            die("Invalid response from skywallet_connect: $error_code, Output $json");

        $arr = json_decode($json, true);
        if (!$arr) {
			die("Failed to decode json: $json");

        if (!isset($arr['amount_verified']) || !isset($arr['status'])) {
			die("Corrupted response: $json");

        if ($arr['status'] != "success") {
			die("Invalid status in response: $json");

		$cc_due = "SELECT cc FROM data WHERE id = $id";

        $amountVerified = $arr['amount_verified'];
        if ($amountVerified != $cc_due ) {
               die("Invalid amount: $amountVerified, expected: $amount");

		/* Payment has been received */
		 //1. Send $$$ to the ATM
		 //2. Recored Transaction