0
votes

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.

2

2 Answers

1
votes

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

0
votes
    $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);