Buying PHP & Google checkout expert needed

Discussion in 'Programming' started by DewShare, Feb 1, 2011.

  1. #1
    Hi

    I am doing a project of my client. I am facing trouble in google checkout integration, I need a Google checkout expert that can guide me further

    here is the problem to solve

    I am using API version 2.5 with level 1 integration that does not need SSL.

    I am facing trouble which is like this.

    my payment page contains google checkout button, which is Server 2 Server Checkout Request.

    A register user suppose id#6 login and see this button. click on it that user redirected to checkout button. when he pays checkout send me a serial-number. it is all what is happening. what is need. that is your help

    here is my code on responsehandlerdemo.php


    $ourFileName = "logs/iaminfile.txt"; 
    $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); 
    foreach($_POST as $key => $value) 
    { $vals .=  $value."\n"; }  
    fwrite($ourFileHandle,$vals ); 
    fclose($ourFileHandle);
    Code (markup):
    here is my code of democart.php

    chdir("..");
      require_once('library/googlecart.php');
      require_once('library/googleitem.php');
      require_once('library/googleshipping.php');
      require_once('library/googletax.php');
    
      DigitalUsecase();
    
      function DigitalUsecase() {
        echo "<h2>Server 2 Server Checkout Request</h2>";   
      $merchant_id = "511454578597665";  // Your Merchant ID
      $merchant_key = "ZdWER2wIO7P8ahHJKVFneQ";  // Your Merchant Key
        $server_type = "sandbox";
        $currency = "USD";
        $cart = new GoogleCart($merchant_id, $merchant_key, $server_type,$currency);
    
        echo $cart->CheckoutServer2ServerButton('digitalCart.php');
      }
    Code (markup):
    and here is digitalcart.php

    chdir("..");
    // Include all the required files
    require_once('library/googlecart.php');
    require_once('library/googleitem.php');
    require_once('library/googleshipping.php');
    require_once('library/googletax.php');
    
    Usecase();
    function Usecase() {
      $merchant_id = "511454578597665";  // Your Merchant ID
      $merchant_key = "ZdWER2wIO7P8ahHJKVFneQ";  // Your Merchant Key
      $server_type = "sandbox";
      $currency = "USD";
      $cart = new GoogleCart($merchant_id, $merchant_key, $server_type,
      $currency);
      $total_count = 1;
    //  Check this URL for more info about the two types of digital Delivery
    //  http://code.google.com/apis/checkout/developer/Google_Checkout_Digital_Delivery.html
    
    //  Key/URL delivery
      $item_1 = new GoogleItem("Download Videos",      // Item name
                               "", // Item description
                               $total_count, // Quantity
                               20); // Unit price
      $item_1->SetURLDigitalContent('http://www.smarthigh.com/downloads.html',
                                    'S/N: 123.123123-3213',
                                    "Download Item1");
      $cart->AddItem($item_1);
    //  Email delivery 
       
      // Add tax rules
      $tax_rule = new GoogleDefaultTaxRule(0.05);
      $tax_rule->SetStateAreas(array("MA", "FL", "CA"));
      $cart->AddDefaultTaxRules($tax_rule);
      
      // Specify <edit-cart-url>
      $cart->SetEditCartUrl("http://www.smarthigh.com/downloads.html");
      
      // Specify "Return to xyz" link
      $cart->SetContinueShoppingUrl("http://www.smarthigh.com/downloads.html");
      
      // Request buyer's phone number
      $cart->SetRequestBuyerPhone(true);
    
    // Add analytics data to the cart if its setted
      if(isset($_POST['analyticsdata']) && !empty($_POST['analyticsdata'])){
        $cart->SetAnalyticsData($_POST['analyticsdata']);
      }
      
    
    // This will do a server-2-server cart post and send an HTTP 302 redirect status
    // This is the best way to do it if implementing digital delivery
    // More info http://code.google.com/apis/checkout/developer/index.html#alternate_technique
      list($status, $error) = $cart->CheckoutServer2Server();
      // if i reach this point, something was wrong
      echo "An error had ocurred: <br />HTTP Status: " . $status. ":";
     
      echo "<br />Error message:<br />";
      echo $error;
      
      
    //
    }
    Code (markup):
    I just want to update a record in table when some one pay accordingly. I want you to guide me next of this step by step.
     
    DewShare, Feb 1, 2011 IP
  2. umajaya

    umajaya Member

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    umajaya, Feb 1, 2011 IP
  3. DewShare

    DewShare Well-Known Member

    Messages:
    426
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    the link you share address integration with ssl. I use API 2.5 level 1 integration which does not need SSL. it is for simple integration
     
    DewShare, Feb 1, 2011 IP