2012-11-20 46 views
2

我正在将Google Checkout集成到PHP中。完成付款后,我尝试重定向到本地主机,但我没有收到Google Checkout的回复。当我使用支付宝,我得到txn_id,ITEM_NAME,PAYMENT_STATUS,支付金额等 这里是我的代码:如何在完成付款后从Google Checkout获得回复

echo "<h2>Standard Checkout Request</h2>"; 
    $merchant_id = "my merchant id"; // Your Merchant ID 
    $merchant_key = "my merchant key"; // Your Merchant Key 
    $server_type = "sandbox"; 
    $currency = "USD"; 
    $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, 
    $currency); 
    $total_count = 12; 

    $item_1 = new GoogleItem("item name",  // Item name 
          "T-shart", // Item  description 
          $total_count, // Quantity 
          1); // Unit price 

    $cart->AddItem($item_1); 


    // Add shipping options 
    if($total_count < 3){ 
     $ship_1 = new GoogleFlatRateShipping("USPS Priority Mail", 4.55); 
    }else{ 
     $ship_1 = new GoogleFlatRateShipping("USPS Priority Mail", 6.2); 
    } 
    $Gfilter = new GoogleShippingFilters(); 
    $Gfilter->SetAllowedCountryArea('CONTINENTAL_48'); 

    $ship_1->AddShippingRestrictions($Gfilter); 

    $cart->AddShipping($ship_1); 

    // Add tax rules 
    $tax_rule = new GoogleDefaultTaxRule(0.05); 
    $tax_rule->SetStateAreas(array("MA")); 
    $cart->AddDefaultTaxRules($tax_rule); 

    // Specify <edit-cart-url> 
    $cart->SetEditCartUrl("http://localhost/Practice/PaymentDemo/library/googleRequestSecond.php"); 

    // Specify "Return to xyz" link 
    $cart->SetContinueShoppingUrl("http://localhost/Practice/PaymentDemo/library/googleRequestSecond.php"); 

    // Request buyer's phone number 
    $cart->SetRequestBuyerPhone(true); 

    // Display Google Checkout button 
    echo $cart->CheckoutButtonCode("SMALL"); 
+1

到目前为止你有什么代码? –

回答

相关问题