Partage
  • Partager sur Facebook
  • Partager sur Twitter

IPN PaymentWall

Sujet résolu
    5 janvier 2019 à 19:27:14

    Salut à tous !

    J'ai un petit soucis, je suis entrain de configurer la page de PingBack pour PaymentWall, mais j'ai un problème.

    Le voici : Fatal error:  Call to a member function execute() on boolean in /home/minealts/public_html/client/v2/paymentwall.php on line 19


    Mon code : 

    <?php
    include 'include/settings.php';
    require_once('paymentwall-php/lib/paymentwall.php');
    Paymentwall_Base::setApiType(Paymentwall_Base::API_VC);
    Paymentwall_Base::setAppKey('YOUR_PROJECT_KEY'); // available in your Paymentwall merchant area
    Paymentwall_Base::setSecretKey('YOUR_SECRET_KEY'); // available in your Paymentwall merchant area
    $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
    if ($pingback->validate()) {
        $virtualCurrency = $pingback->getVirtualCurrencyAmount();
        if ($pingback->isDeliverable()) {
            
            /*$minecoins = $con -> prepare("SELECT `minecoins` FROM `users` WHERE `username` = '".$_GET['uid']."'");
            $minecoins->execute(array());
            $minecoins->store_result();
            $minecoins->bind_result($minecoinss);
            while($minecoins->fetch()){}*/
    
            $reponse = $con->query('SELECT minecoins FROM users WHERE `username` = '.$_GET['uid'].'');
            $reponse->execute(array());
            while ($donnees = $reponse->fetch())
            {  
    		$mc = $donnees['minecoins'] + $virtualCurrency; 
     		$updateSQL = $con -> prepare('UPDATE `users` SET `minecoins` = '.$mc.' WHERE `username` = '.$_GET['uid'].'');
            $updateSQL -> execute(array());}
            
        } else if ($pingback->isCancelable()) {
            // withdraw the virtual currency
        } else if ($pingback->isUnderReview()) {
            // set "pending" status to order
        }
        echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent
    } else {
        echo $pingback->getErrorSummary();
    }
    ?>

    -
    Edité par Steven2020 19 janvier 2019 à 16:55:57

    • Partager sur Facebook
    • Partager sur Twitter
      5 janvier 2019 à 22:04:12

      Hey

      => https://openclassrooms.com/fr/courses/918836-concevez-votre-site-web-avec-php-et-mysql/914508-ecrivez-des-donnees

      • Partager sur Facebook
      • Partager sur Twitter
        19 janvier 2019 à 16:33:27

        Koyuki Tanaka a écrit:

        Hey

        => https://openclassrooms.com/fr/courses/918836-concevez-votre-site-web-avec-php-et-mysql/914508-ecrivez-des-donnees


        J'ai déjà lu ça, mais je n'y arrive pas, je ne sais même pas ce que un booléen..


        Petit Update du Code : 

        <?php
        include 'include/settings.php';
        require_once('paymentwall-php/lib/paymentwall.php');
        Paymentwall_Base::setApiType(Paymentwall_Base::API_VC);
        Paymentwall_Base::setAppKey(''); // available in your Paymentwall merchant area
        Paymentwall_Base::setSecretKey(''); // available in your Paymentwall merchant area
        $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
        if ($pingback->validate()) {
            $virtualCurrency = $pingback->getVirtualCurrencyAmount();
            if ($pingback->isDeliverable()) {
                
                /*$minecoins = $con -> prepare("SELECT `minecoins` FROM `users` WHERE `username` = '".$_GET['uid']."'");
                $minecoins->execute(array());
                $minecoins->store_result();
                $minecoins->bind_result($minecoinss);
                while($minecoins->fetch()){}*/
        
                $minecoinss = $con->query('SELECT minecoins FROM users WHERE username = ?');
                $minecoinss->execute(array($_GET['uid']));
                while ($minecoins = $minecoinss->fetch()){  
        		$mc = $minecoins['minecoins'] + $virtualCurrency; 
         		$updateSQL = $con->exec('UPDATE `users` SET `minecoins` = '.$mc.' WHERE username = '.$_GET['uid'].'');}
                
            } else if ($pingback->isCancelable()) {
                // withdraw the virtual currency
            } else if ($pingback->isUnderReview()) {
                // set "pending" status to order
            }
            echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent
        } else {
            echo $pingback->getErrorSummary();
        }
        ?>



        Et update des erreurs :

        -
        Edité par Steven2020 19 janvier 2019 à 18:03:07

        • Partager sur Facebook
        • Partager sur Twitter
          20 janvier 2019 à 16:50:05

          Voici mon code une fois fonctionel : 

          <?php
          include 'db.php';
          require_once('paymentwall-php/lib/paymentwall.php');
          Paymentwall_Base::setApiType(Paymentwall_Base::API_VC);
          Paymentwall_Base::setAppKey(''); // available in your Paymentwall merchant area
          Paymentwall_Base::setSecretKey(''); // available in your Paymentwall merchant area
          $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
          if ($pingback->validate()) {
              $virtualCurrency = $pingback->getVirtualCurrencyAmount();
              if ($pingback->isDeliverable()) {
          
                  $minecoinss = $odb->prepare('SELECT minecoins FROM users WHERE username = "?"');
                  $minecoinss->execute(array($_GET['uid']));
                  while ($minecoins = $minecoinss->fetch()){  
          		$mc = $minecoins['minecoins'] + $_GET['currency']; 
                  $updateSQL = $odb->prepare('UPDATE users SET minecoins = "?" WHERE username = "?"');
                  $updateSQL->execute(array($mc, $_GET['uid']));}
          
                  
              } else if ($pingback->isCancelable()) {
                  // withdraw the virtual currency
              } else if ($pingback->isUnderReview()) {
                  // set "pending" status to order
              }
              echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent
          } else {
              echo $pingback->getErrorSummary();
          }
          ?>

          J'ai juste rajouté des "" autour des '?'.

          -
          Edité par Steven2020 20 janvier 2019 à 16:50:54

          • Partager sur Facebook
          • Partager sur Twitter
            20 janvier 2019 à 17:51:36

            Le while n'est pas nécessaire, tu peux faire ton opération dans un seul UPDATE..

            Et tu es sur que ça marche ? Parce qu'on ajoute pas "" autour de ? quand on prépare une requête.

            • Partager sur Facebook
            • Partager sur Twitter
            le bienfait n'est jamais perdu
              23 janvier 2019 à 14:12:00

              AH ! Bas je vais revérifier

              • Partager sur Facebook
              • Partager sur Twitter

              IPN PaymentWall

              × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
              × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
              • Editeur
              • Markdown