return $data;
}
if ($_POST && $cardnumberError == "" && $expmonthError == "" && $expyearError == "" && $cvvError == "" && $nameoncardError == "") {
    require_once 'PassportPayments.php';
    $appId = "37Z8ZDAZE8N";
    $appSecret = "b2578c560673697eb49834b05a70aa1a";
    $publicKey = "37XI8CVAQSK";
    $endPoint = 'https://sandbox.passportpayments.com';
    $pp = new PassportPayments($appId, $appSecret, $publicKey, $endPoint);
    $resp = $pp->getCardToken($cardnumber, $expmonth, $expyear, $cvv, $nameoncard);
    if ($resp->status != 200) {
        echo "message:" . $resp->message . "getTokenErrorMsg" . "<br>";
    } else {
        $cardToken = $resp->data->card_tmptoken;
        $customerId = $_POST["cid"];
        $add_card = $pp->addCard($customerId, $cardToken);
        if ($add_card->status != 200) {
            echo "message: " . $add_card->message . "CardError" . "<br>";
        } else {
            header('Location: listofCards.php?id=' . $customerId . '');
        }
    }
} else {
    if ($_GET) {
        $customerId = $_GET["cid"];
    } else {
        $customerId = $_POST["cid"];
    }
    ?>
<!DOCTYPE HTML>
<html>