CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Google checkout: Wrong currency
Pages: [1]

Author Topic: Google checkout: Wrong currency  (Read 2497 times)

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Google checkout: Wrong currency
August 10, 2007, 01:40:49 am
I'm trying to setup membership renewal using google checkout. However Checkout is rejecting it with the following info:

XML We Sent:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<error xmlns="http://checkout.google.com/schema/2" serial-number=".....removed......">
  <error-message>The currency used in the cart must match the currency of the seller account. You supplied a cart with USD and the seller account is associated with GBP.</error-message>
</error>

XML We Received: [edited]   
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
  <shopping-cart>
    <items>
      <item>
        <item-name>Online Contribution: membership fees 2007-2008 - TEST</item-name>
        <item-description></item-description>
        <unit-price currency="USD">30.00</unit-price>
        <quantity>1</quantity>
      </item>
    </items>
    <merchant-private-data>contactID=3964,contributionID=940,contributionTypeID=2,invoiceID=....removed....,membershipTypeID=1</merchant-private-data>
  </shopping-cart>
  <checkout-flow-support>
    <merchant-checkout-flow-support>
      <continue-shopping-url>http://www.domain.com/administrator/index2.php?option=com_civicrm&amp;task=civicrm/contribute/transact&amp;_qf_ThankYou_display=1&amp;qfKey=...removed...</continue-shopping-url>
    </merchant-checkout-flow-support>
  </checkout-flow-support>
</checkout-shopping-cart>

Clearly CiviContribute is sending <unit-price currency="USD"> which is wrong.

In Global Admin my Default Currency is GBP, and Monetary Locale is en_GB. My Membership Types all show the Minimum Fee as being in GBP.

The Contribution Page is a simple membership renewal. There are no other values being used and the amount sent is picked up from the Membership Type data.

Any ideas?

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: Google checkout: Wrong currency
August 10, 2007, 06:17:58 am
USD is the only currency supported by Google checkout, for now.

Still if you want to check and see if it works, replace the following line
Code: [Select]
$item1 = new GoogleItem($params['item_name'],'', 1, $params['amount']);
Quote
in file "civicrm/CRM/Core/Payment/Google.php"

with

Code: [Select]
$item1 = new GoogleItem($params['item_name'],'', 1, $params['amount'], $params['currencyID']);
OR

change "USD" to "GBP" in file "civicrm/packages/Google/library/googleitem.php" (only if you would like to keep GBP as the default currency )

Let us know if that works.

Note: Make sure you have the backup before any changes to any file.

Deepak

Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: Google checkout: Wrong currency
August 10, 2007, 06:56:41 am
Deepak,

Nice one! That works a treat! I was running around looking all over the code trying to work out what was going on and checking my config for a problem.

Google Checkout is available in the UK hence the need for GBP. Plus there are NO FEES until 2008!!!

AS a matter of interest how come there are two blocks repeated in in file "civicrm/CRM/Core/Payment/Google.php"

Code: [Select]
        //Create a new shopping cart object
        $merchant_id  = $this->_paymentProcessor['user_name'];   // Merchant ID
        $merchant_key = $this->_paymentProcessor['password'];    // Merchant Key
        $server_type  = ( $this->_mode == 'test' ) ? 'sandbox' : '';
       
        $cart =  new GoogleCart($merchant_id, $merchant_key, $server_type);
        $item1 = new GoogleItem($params['item_name'],'', 1, $params['amount'], $params['currencyID']);
        $cart->AddItem($item1);

        $cart  =  new GoogleCart($merchant_id, $merchant_key, $server_type);
        $item1 = new GoogleItem($params['item_name'],'', 1, $params['amount'], $params['currencyID']);
        $cart->AddItem($item1);

        if ( $component == "event" ) {

Can this code be added into the next tarball for 1.8?

Thanks, Henry

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: Google checkout: Wrong currency
August 10, 2007, 07:37:47 am
I see you've already committed this in  r10838 and taken out the extra block. Thanks!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Google checkout: Wrong currency

This forum was archived on 2017-11-26.