关于Google Checkout商家私人数据的问题
我正在集成 示例代码
我想启用商家私有项目数据,以便我可以传递用户 ID、期间和属性,
但我不明白该怎么做。
我的 googlecheckout 按钮出现在此处,如下所示:
require_once($jconfig->gc_path.'/googlecart.php');
require_once($jconfig->gc_path.'/googleitem.php');
require_once($jconfig->gc_path.'/googleshipping.php');
require_once($jconfig->gc_path.'/googletax.php');
$merchant_id = "SAMPLE"; // Your Merchant ID
$merchant_key = "SAMPLE"; // Your Merchant Key
$server_type = "sandbox";
$currency = "USD";
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type,
$currency);
$total_count = 1;
$item_1 = new GoogleItem('title', // Item name
'descriptiom',
$price,
1);
$cart->AddItem($item_1);
$cart->SetContinueShoppingUrl($jconfig->response_handler.$generate_url);
// Request buyer's phone number
$cart->SetRequestBuyerPhone(true);
// Display Google Checkout button
//echo $this->product[0]['welcome_pack']+$this->product[0]['airport_pick_up']+$this->product[0]['airport_drop_off']+$this->product[0]['textbooks']+$totle;
echo $cart->CheckoutButtonCode("SMALL");
我必须在 googlecart.php 中启用它吗?
I'm integrating the sample code
I want to enable merchant-private-item-data,so that i can pass the userid,period and attribute
I'm not able to understand how do i do it .
My googlecheckout button appears here as given below.:
require_once($jconfig->gc_path.'/googlecart.php');
require_once($jconfig->gc_path.'/googleitem.php');
require_once($jconfig->gc_path.'/googleshipping.php');
require_once($jconfig->gc_path.'/googletax.php');
$merchant_id = "SAMPLE"; // Your Merchant ID
$merchant_key = "SAMPLE"; // Your Merchant Key
$server_type = "sandbox";
$currency = "USD";
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type,
$currency);
$total_count = 1;
$item_1 = new GoogleItem('title', // Item name
'descriptiom',
$price,
1);
$cart->AddItem($item_1);
$cart->SetContinueShoppingUrl($jconfig->response_handler.$generate_url);
// Request buyer's phone number
$cart->SetRequestBuyerPhone(true);
// Display Google Checkout button
//echo $this->product[0]['welcome_pack']+$this->product[0]['airport_pick_up']+$this->product[0]['airport_drop_off']+$this->product[0]['textbooks']+$totle;
echo $cart->CheckoutButtonCode("SMALL");
Do I have to enable it in googlecart.php?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看源代码,您会看到
GoogleItem::SetMerchantPrivateItemData
,它仅设置GoogleItem::$merchant_private_item_data
属性。检查GoogleItem::GetXML
显示GoogleItem::$merchant_private_item_data
可以是MerchantPrivate
(这似乎未实现,但您可以编写您的只要它具有MerchantPrivate::AddMerchantPrivateToXML(gc_XmlBuilder $xml)
方法)或字符串(在通过htmlentities
后)就会成为 < code>merchant-private-item-data 元素。如果您想使用 XML 构建私有数据,则必须实现MerchantPrivate
类。If you look at the source, you'll see a
GoogleItem::SetMerchantPrivateItemData
, which simply sets theGoogleItem::$merchant_private_item_data
property. ExaminingGoogleItem::GetXML
revealsGoogleItem::$merchant_private_item_data
can be aMerchantPrivate
(which appears to be unimplemented, but you can write your own as long as it has aMerchantPrivate::AddMerchantPrivateToXML(gc_XmlBuilder $xml)
method) or a string, which (after a pass throughhtmlentities
) becomes the content of themerchant-private-item-data
element. If you want to structure your private data with XML, you'll have to implement classMerchantPrivate
.