static function Init($merchantId) { if (is_null(self::$instance)) { self::$instance = new SnapScan($merchantId); } return self::$instance; }
// Generate a R100 QRCode, with a Unique Reference $uniqueId = "Super_Awesome_Unique_ID_101201"; $QRCode = SnapScan::QR(100, $uniqueId); ?> <img src="<?php echo $QRCode; ?> " width="300" height="300" alt="ScanScan Barcode" /> <?php // To be able to do calls against the API, you will need to obtain a // API Token from SnapScan, and specify it. $snapToken = "0a63fca2-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; SnapScan::setApiToken($snapToken); // After you have set your API Token you can check that a transaction was successful $uniqueId = "Super_Awesome_Unique_ID_101201"; $checkPayment = SnapScan::checkPayment($uniqueId); // returns [] With payment details / False depending on whether the payment was successful // Or fails miserably if (!empty($checkPayment)) { echo "FOUND PAYMENT!!!" . PHP_EOL; echo print_r($checkPayment, true) . PHP_EOL; } else { echo "PAYMENT NOT FOUND!" . PHP_EOL; }