• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Urgent help! Zaypay wont work!

Zt0ffe

New Member
Joined
Sep 26, 2008
Messages
341
Reaction score
4
Location
Sweden
My Zaypay wont work. The report URL works fine but it wont add any points to the account.
My DB got what its suppose to, passwords and everything is fine.

Here are my scripts:

pay.php
Code:
<?php
  require_once('includes/config.php');
  require_once('includes/Zaypay.class.php');
  require_once('includes/database.php');
  // Start session engine
  session_start();
  // Makesure this is not a guest
  if(!isset($_SESSION['account'])) {
    die($message_to_guests);
  }

  $Zaypay = New Zaypay($price_setting_id, $price_setting_key);

  // Fourth step: check payment
  if (isset($_POST['action']) && $_POST['action'] == 'paid' && isset($_POST['paymentid'])) {
    $zaypay_info = $Zaypay->show_payment($_POST['paymentid']);
   
    $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}]";
    }
   
  }

  // Third step: Let consumer pay
  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');
  }
  // First step: Let consumer choose country and language
  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()))){
      die($Zaypay->getError());
    }
   
    include('./pages/1-choosemethod.php');
  }
?>


report.php
Code:
<?php
/*-----------------------------------------------------------------------
  Name         : report.php
  Version      : 1.2-PHP5
  Description  : Retrieve payment information, when triggerd by Zaypay
  Date         : June 2009, Amsterdam, The Netherlands
  By           : Zaypay International B.V. 2008 - 2009 (RDF)
  Last changes : Made class easier to use and understand
  -----------------------------------------------------------------------*/
  require_once('includes/config.php');
  require_once('includes/Zaypay.class.php');
  require_once('includes/database.php');
  $Zaypay = New Zaypay($price_setting_id, $price_setting_key);
  if (isset($_GET['payment_id'])) {    
    $zaypay_info    = $Zaypay->show_payment($_GET['payment_id']);  
   
    $payment_id     = $zaypay_info['payment']['id'];
    $payment_status = $zaypay_info['payment']['status'];
   
    // Get the ID
    $result = mysql_query("SELECT * FROM zaypay_payment WHERE payID='{$payment_id}' LIMIT 1");
    $array = mysql_fetch_assoc($result);

    // Get current amount of points
    $pp = mysql_query("SELECT premium_points FROM accounts WHERE accounts.id = '{$array['account_id']}'");
    $points = mysql_fetch_assoc($pp);
    $point = $points["premium_points"] + $points_to_give;

    // Update to new status in database
    mysql_query("UPDATE zaypay_payment SET status = '{$payment_status}' WHERE payID = '{$payment_id}'");
   
    // Only give points if the status is "paid"
    if ($payment_status == "paid" && $array["status"] != "paid") {
        // Update points in account table
        mysql_query("UPDATE accounts SET premium_points = premium_points + ".$point." WHERE accounts.name = '{$array['account_id']}'");
        //mysql_query("UPDATE accounts SET premium_points = '$point' WHERE accounts.id = '{$array['account_id']}'");  
    }
}
  die ('*ok*');
?>

config.php
Code:
<?php
  $price_setting_id  = XXXXX;  // Id
  $price_setting_key = 'xxxxxxxxxxxxxxxxxxxxx'; // Hash
  $points_to_give = 20; // Points to give after to have paid
  $message_to_guests = "You MUST be logged in!";
?>
 
Back
Top