示例#1
0
    $status = $zaypay_info['payment']['status'];
    if (isset($zaypay_info['payment']['verification-needed']) and $zaypay_info['payment']['verification-needed'] == 'true' and isset($_POST['verification_code'])) {
        if ($zaypay_info = $Zaypay->verification_code($_POST['paymentid'], $_POST['verification_code'])) {
            $status = $zaypay_info['payment']['status'];
        }
    }
    if ($status == 'paid') {
        include './pages/3-paid.php';
        $Zaypay->mark_payload_provided($_POST['paymentid']);
    } elseif ($status == 'prepared' or $status == 'in_progress' or $status == 'paused') {
        include './pages/2-pay.php';
    } else {
        echo "An error has occured [{$status}]";
    }
} elseif (isset($_POST['action']) && $_POST['action'] == 'pay' && isset($_POST['locale']) && isset($_POST['paymentmethod'])) {
    if (!($zaypay_info = $Zaypay->create_payment($_POST['locale'], $_POST['paymentmethod']))) {
        die($Zaypay->getError());
    }
    // Here you could insert the payment information into your database. For Example:
    mysql_query("INSERT INTO VAPUS_payment (payID, account_id, status) VALUES ('{$Zaypay->getPaymentId()}', '{$_SESSION['account']}', 'prepared')");
    include './pages/2-pay.php';
} else {
    if (!($locales = $Zaypay->list_locales())) {
        die($Zaypay->getError());
    }
    if (isset($_POST['locale_country']) and isset($_POST['locale_language'])) {
        $Zaypay->setLocale($_POST['locale_language'] . '-' . $_POST['locale_country']);
    } else {
        $Zaypay->locale_for_ip($_SERVER['REMOTE_ADDR']);
    }
    if (!($payment_methods = $Zaypay->list_payment_methods($Zaypay->getLocale()))) {