/** * Submit a server-to-server request. * Creates a GoogleRequest object (defined in googlerequest.php) and sends * it to the Google Checkout server. * * more info: * {@link http://code.google.com/apis/checkout/developer/index.html#alternate_technique} * * @return array with the returned http status code (200 if OK) in index 0 * and the redirect url returned by the server in index 1 */ function CheckoutServer2Server($proxy = array(), $certPath = '') { require_once dirname(__FILE__) . '/library/googlerequest.php'; $GRequest = new GoogleRequest($this->merchant_id, $this->merchant_key, $this->server_url == "https://checkout.google.com/" ? "Production" : "sandbox", $this->currency); $GRequest->SetProxy($proxy); $GRequest->SetCertificatePath($certPath); return $GRequest->SendServer2ServerCart($this->GetXML()); }
/** * Submit a server-to-server request. * Creates a GoogleRequest object (defined in googlerequest.php) and sends * it to the Google Checkout server. * * more info: * {@link http://code.google.com/apis/checkout/developer/index.html#alternate_technique} * * @return array with the returned http status code (200 if OK) in index 0 * and the redirect url returned by the server in index 1 */ function CheckoutServer2Server($proxy = array(), $certPath = '') { ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '.'); require_once 'library/googlerequest.php'; $GRequest = new GoogleRequest($this->merchant_id, $this->merchant_key, $this->server_url == "https://checkout.google.com/" ? "Production" : "sandbox", $this->currency); $GRequest->SetProxy($proxy); $GRequest->SetCertificatePath($certPath); return $GRequest->SendServer2ServerCart($this->GetXML()); }
public function preparePayment() { if ($this->testmode == true) { $environment = 'sandbox'; } else { $environment = 'production'; } $Gcart = new GoogleCart($this->arr_settings['account'], $this->arr_settings['secret'], $environment, $this->arr_order['currency']); $Gcart->SetContinueShoppingUrl($this->url_return_success); $Gitem = new GoogleItem($this->arr_order['id'], "Your Purchase (Order reference #" . $this->arr_order['id'] . ")", 1, $this->arr_order['total']); $Gcart->AddItem($Gitem); $Gcart->SetMerchantPrivateData(new MerchantPrivateData(array('shopguid' => $this->arr_settings['shopguid'], 'orderguid' => $this->arr_order['guid'], 'ip-address' => $this->arr_settings['ip']))); $GcartXML = $Gcart->GetXML(); $Grequest = new GoogleRequest($Gcart->merchant_id, $Gcart->merchant_key, $environment, $Gcart->currency); list($status, $this->url_integration) = $Grequest->SendServer2ServerCart($GcartXML, false); if ($this->url_integration == "") { echo "An error occurred while sending the basket to google. Check the google checkout 'Integration console'."; die; } }