我从google help下载并编辑google checkout的代码。我在我的网站中指定了murchent计算网址。但是这个功能不能在我的网站上工作。这是我的代码 function UseCase3(){ //创建一个新的购物车对象 $ merchant_id =“xxxxxxxxxxxxx”; //您的商家ID $ merchant_key =“xxxxxxxxxxxxx”; $ server_type =“sandbox”; $ currency =“USD”; $ cart = new GoogleCart($ merchant_id,$ merchant_key,$ server_type,$ currency);
// Add items to the cart
$item = new GoogleItem("MegaSound 2GB MP3 Player",
"Portable MP3 player - stores 500 songs", 1, 175.49);
$item->SetMerchantPrivateItemData("<color>blue</color><weight>3.2</weight>");
$cart->AddItem($item);
// Add merchant calculations options
$cart->SetMerchantCalculations(
"https://mysite.com/google2/demo/responsehandlerdemo.php",
"false", // merchant-calculated tax
"true", // accept-merchant-coupons
"true"); // accept-merchant-gift-certificates
// Add merchant-calculated-shipping option
$ship = new GoogleMerchantCalculatedShipping("2nd Day Air", // Shippping method
10.00); // Default, fallback price
$restriction = new GoogleShippingFilters();
$restriction->AddAllowedPostalArea("GB");
$restriction->AddAllowedPostalArea("US");
$restriction->SetAllowUsPoBox(false);
$ship->AddShippingRestrictions($restriction);
$address_filter = new GoogleShippingFilters();
$address_filter->AddAllowedPostalArea("GB");
$address_filter->AddAllowedPostalArea("US");
$address_filter->SetAllowUsPoBox(false);
$ship->AddAddressFilters($address_filter);
$cart->AddShipping($ship);
// Set default tax options
$tax_rule = new GoogleDefaultTaxRule(0.15);
$tax_rule->SetWorldArea(true);
$cart->AddDefaultTaxRules($tax_rule);
$cart->AddRoundingPolicy("UP", "TOTAL");
// Specify <edit-cart-url>
$cart->SetEditCartUrl("https://mysite.com/google/demo/cartdemo.php");
// Specify "Return to xyz" link
$cart->SetContinueShoppingUrl("https://mysite.com");
// Display XML data
// echo "<pre>";
// echo htmlentities($cart->GetXML());
// echo "</pre>";
// Display a disabled, small button
echo $cart->CheckoutButtonCode("SMALL");
}
答案 0 :(得分:0)
澄清:
所以这些网址/ API有不同的用途。
根据您的评论:
我需要在用户通过Google结帐付款后执行php文件
您需要实施通知API(商家计算网址/ api 不您需要的内容)。