Difference between revisions of "Include CloudCoin in an ATM system"
(6 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
# Based on the current QR code | # Based on the current QR code | ||
− | # Storing a record based on the transaction code on the server ( | + | # Storing a record based on the transaction code on the server (recommended) |
The QR code contains: | The QR code contains: | ||
Line 15: | Line 15: | ||
|- | |- | ||
! GET Code | ! GET Code | ||
− | ! | + | ! Current Data Elements in QR |
! Example | ! Example | ||
− | ! Stored on Server or Sent to Client | + | ! Recommendation to be Stored on Server or Sent to Client |
|- | |- | ||
| w | | w | ||
− | | B4U | + | | B4U Skyvault ID |
| cc.b4uatm.com | | cc.b4uatm.com | ||
| Embedded in our Web page (unneeded) | | Embedded in our Web page (unneeded) | ||
Line 81: | Line 81: | ||
|} | |} | ||
− | ==== Sample URL based on current code: | + | ==== Sample URL based on current code: ==== |
− | https:// | + | {| class="wikitable" |
+ | |- | ||
+ | ! Sample URL | ||
+ | ! Resulting QR | ||
+ | |- | ||
+ | | https://Skyvault.cc/b4u?w=bill&cc=300&usd=3434&b4u=P3WFMghh24NWkTwX3eNyag&m=129854&t=34568&s=54256&qr=xxxxxxx&d=210914153315&imei=354454028234368&p=5305927085 | ||
+ | | [[File:Currenturl.png|Using Current Data Elements]] | ||
+ | |- | ||
+ | | https://Skyvault.cc/b4u?cc=300&usd=3434&b4u=P3WFMghh24NWkTwX3eNyag&qr=xxxxxxx | ||
+ | | [[File:Recomended url.png|Leaving Some Elements on Server]] | ||
+ | |} | ||
− | ==== Sample URL based on recommended code: | + | ==== Sample URL based on recommended code: ==== |
− | |||
Line 104: | Line 113: | ||
== Verifying Payment == | == Verifying Payment == | ||
− | You will need to verify that your | + | You will need to verify that your Skyvault Account has received CloudCoins. |
− | You can do this by using the | + | You can do this by using the Skyvault Connect CLI. Skyvault Connect is a console application written in GoLang and runs on any platform. It can be called by any programming language. |
<pre style="background-color:black;color:white"> | <pre style="background-color:black;color:white"> | ||
− | $ ./ | + | $ ./Skyvault_connect verify_payment 080A4CE89126F4F1B93E4745F89F6713 b4u.Skyvault.cc |
{"amount_verified":100,"status":"success","message":"CloudCoins verified"} | {"amount_verified":100,"status":"success","message":"CloudCoins verified"} | ||
</pre> | </pre> | ||
Line 121: | Line 130: | ||
isset($_GET['b64'])? $b64= $_GET['b64']: $b64= ''; | isset($_GET['b64'])? $b64= $_GET['b64']: $b64= ''; | ||
− | $ | + | $Skyvault = "b4u.Skyvault.cc"; |
− | /* CHECK | + | /* CHECK SKYVAULT ACCOUNT IS THERE AND WORKING */ |
− | $ | + | $skyvault_connect = "/usr/local/bin/skyvault_connect"; |
− | if (!file_exists($ | + | if (!file_exists($skyvault_connect)) |
− | die(" | + | die("skyvault_connect not found"); |
− | if (!is_executable($ | + | if (!is_executable($skyvault_connect)) |
− | die(" | + | die("skyvault_connect doesn't have exec permissions"); |
/* Verify Receipt of CloudCoins */ | /* Verify Receipt of CloudCoins */ | ||
− | global $ | + | global $skyvault_connect; |
− | $cmd = "$ | + | $cmd = "$skyvault_connect verify_payment $id"; |
//echo $cmd; | //echo $cmd; | ||
Line 142: | Line 151: | ||
$json = exec($cmd, $outarray, $error_code); | $json = exec($cmd, $outarray, $error_code); | ||
if ($error_code != 0) { | if ($error_code != 0) { | ||
− | die("Invalid response from | + | die("Invalid response from Skyvault_connect: $error_code, Output $json"); |
} | } | ||
Line 167: | Line 176: | ||
/* Payment has been received */ | /* Payment has been received */ | ||
//1. Send $$$ to the ATM | //1. Send $$$ to the ATM | ||
− | //2. | + | //2. Record Transaction |
?> | ?> | ||
</pre> | </pre> |
Latest revision as of 22:58, 14 November 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
The QR code and be done in two ways:
- Based on the current QR code
- Storing a record based on the transaction code on the server (recommended)
The QR code contains:
GET Code | Current Data Elements in QR | Example | Recommendation to be Stored on Server or Sent to Client | |
---|---|---|---|---|
w | B4U Skyvault ID | cc.b4uatm.com | Embedded in our Web page (unneeded) | |
cc | Amount in CloudCoin | 300 | Sent to Client | |
usd | Amount in USD | 300 | Sent to Client | |
b4u | Transaction ID | P3WFMghh24NWkTwX3eNyag | Sent to Client and Stored on Server | |
m | Merchant ID | 129987 | Stored on Server | |
t | Terminal ID | 34586 | Stored on Server | |
s | Store ID | 54235 | Stored on Server | |
qr | QR Verification Code | XXXXXXX | Sent to Client and Stored on Server | |
d | Date & Time of Transaction | 210914153315 | Stored on Server | |
imei | Mobile Device IMEI | 354454028234368 | Unneeded but seems like it must be generated on Client | |
p | Phone Number | 5305917058 | Unneeded but seems it must be generated on Client | |
e | echo (base64 data that is optional and can be anything. This will be passed to the webhook) | P3WFMghh24NWkTwX3eNyag | Sent To Client |
Sample URL based on current code:
Sample URL based on recommended code:
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
https://b4uATM.com/CloudCoin?cc=3000&id=7917cdf720c044049cc534a370130642
Sample URL that your Web Hook receives (including the optional base64 text )
https://b4uATM.com/CloudCoin?cc=3000&id=7917cdf720c044049cc534a370130642
Verifying Payment
You will need to verify that your Skyvault Account has received CloudCoins. You can do this by using the Skyvault Connect CLI. Skyvault Connect is a console application written in GoLang and runs on any platform. It can be called by any programming language.
$ ./Skyvault_connect verify_payment 080A4CE89126F4F1B93E4745F89F6713 b4u.Skyvault.cc {"amount_verified":100,"status":"success","message":"CloudCoins verified"}
1. Sample Web Hook Page in PHP file (name it cloudcoin.php):
<?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= ''; $Skyvault = "b4u.Skyvault.cc"; /* CHECK SKYVAULT ACCOUNT IS THERE AND WORKING */ $skyvault_connect = "/usr/local/bin/skyvault_connect"; if (!file_exists($skyvault_connect)) die("skyvault_connect not found"); if (!is_executable($skyvault_connect)) die("skyvault_connect doesn't have exec permissions"); /* Verify Receipt of CloudCoins */ global $skyvault_connect; $cmd = "$skyvault_connect verify_payment $id"; //echo $cmd; // Exec the binary $json = exec($cmd, $outarray, $error_code); if ($error_code != 0) { die("Invalid response from Skyvault_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. Record Transaction ?>