如何使用curl将购物车详细信息传递给google checkout

发布于 2024-12-04 11:17:32 字数 293 浏览 0 评论 0原文

我正在开发具有购物车页面的网站。我正在尝试集成 Google 沙箱 Checkout 支付网关。当用户单击 Google Checkout 按钮时,我不想重定向到 Google Checkout 页面。我想使用 Google Checkout 验证或授权用户卡详细信息,并将所有购物车详细信息传递给 Google Checkout。因此,我们可以使用 php curl 来实现此目的。一旦我们将详细信息作为请求传递,就会从 Google Checkout 获得响应。通过使用我可以继续该回复。是否可以在 Google Checkout 中执行此操作。如果是,请举一些例子。

I am developing site which has the cart page.I am trying to integrate Google sandbox Checkout payment gateway. I don't want to redirect to Google checkout page when user click Google Checkout button. I want to validate or authorize the user card details with Google checkout ,also pass all cart details to Google Checkout.So we can achieve this by using php curl.Once we pass our details as request and will get response from Google Checkout.By using that response i can proceed further.Is it possible to do that in Google Checkout. If yes kindly give some example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小女人ら 2024-12-11 11:17:32

首先确保您的沙箱商户 ID / 密码正确。它们与生产帐户中的不同。

由于该错误与基本身份验证相关,因此请使用命令行版本的curl 来验证您是否拥有正确的凭据。发布类似的内容并验证您是否得到正确的响应:

curl -d“some xml”
https://1234567890:[电子邮件受保护]/checkout/api/checkout/v2/request/Merchant/1234567890

此文档有更多详细信息使用curl 将 XML 购物车发布到 Google Checkout:

https: //checkout.google.com/support/sell/bin/answer.py?hl=zh-CN&answer=70646

First make sure that your sandbox merchant id / password are correct. They are different than the ones from production accounts.

Since the error is related to Basic Authentication, use the command line version of curl to verify that you have the right credentials. Post something like this and verify that you get a correct response back:

curl -d "some xml"
https://1234567890:[email protected]/checkout/api/checkout/v2/request/Merchant/1234567890

This doc has more details on posting XML carts with curl to Google Checkout:

https://checkout.google.com/support/sell/bin/answer.py?hl=en&answer=70646

白馒头 2024-12-11 11:17:32
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, "$merchant_id:$merchant_key");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, $_header_array);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $cart->GetXML());
    curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Make it 4       
    $debugData['result'] = curl_exec($ch);
    curl_close($ch);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, "$merchant_id:$merchant_key");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, $_header_array);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $cart->GetXML());
    curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Make it 4       
    $debugData['result'] = curl_exec($ch);
    curl_close($ch);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文