0

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.

mymotherland
  • 7,968
  • 14
  • 65
  • 122

2 Answers2

1

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:abcd1234@sandbox.google.com/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

Mihai Ionescu
  • 2,108
  • 1
  • 12
  • 15
  • Thanks.I have checked my merchant id and key once again and i gave valid one in my above code. Now i am getting "Internal error in server".Kindly help me.. – mymotherland Sep 19 '11 at 05:31
0
    $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);