$response = parseString(runCurl(URLBASE, $postVals)); $custom = explode("%2c", $response["CUSTOM"]); if (getUserId() == $custom[0] && $itemId == $custom[1]) { // ADDED LINE TO GET KS SESSION $ks = getSession($itemId, $userId); // ADD KS to ARRAY $returnObj = array('success' => true, 'error' => "", 'transactionId' => $response["TRANSACTIONID"], 'orderTime' => $response["ORDERTIME"], 'paymentStatus' => $response["PAYMENTSTATUS"], 'itemId' => $itemId, 'userId' => $userId, 'ks' => $ks); } } else { $returnObj = array('success' => false, 'error' => "Item not found in transaction history"); } echo json_encode($returnObj); } } $transact = new pptransact(); if (array_key_exists("method", $_GET)) { switch ($_GET["method"]) { case "init": $connect->init(); break; case "getToken": $transact->getToken($_GET["userId"], $_GET["itemId"], $_GET["qty"], $_GET["mobile"]); break; case "commitPayment": $transact->commitPayment($_GET["userId"], $_GET["payerId"], $_GET["token"], $_GET["amt"], $_GET["itemId"]); break; case "verifyPayment": $transact->verifyPurchase($_GET["userId"], $_GET["itemId"], $_GET["transactions"]); break; } }