Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Pass currency to Authorize.net - Cart is in GBP but charge in USD!

Pass currency to Authorize.net - Cart is in GBP but charge in USD!

Locked
This thread is locked. New replies are disabled.
6 Jun 2006, 8:36 PM
#1
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #1 by pioupioun

I was wondering whether anyone could tell me how to configure so that Authorize.net knows the charges from my shop, which has the default currency set to GBP, are to be processed in GBP as opposed to USD. I am doing an event registration shop for a UK event, but the company collecting is in the US, so the account is set up in USD.

Under Modules > Payment I have the Authorize.net module installed (simple, not AIM), and under Localization > Currencies I have GBP as the default, value set to 1.0000.

The confirmation email that comes from the store indicate the correct price in and total in GBP, i.e. 450, but then the transaction receipt email I get from Authorize.net says 450 USD!!! How do I tell it it's GBP, not USD?

Please help!

6 Jun 2006, 9:06 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Post #2 by bunyip

The standard authorizenet(AIM) payment module doesn't send a currency code field with the transaction, although it can be used. You'll need to modify your module so that it sends that data.

This code snippet is for v1.3.0.1
find the following code at about line 295 of includes/modules/payment/authorizenet_aim.php```
$new_order_id = ($new_order_id + 1);

after that line, insert the following:
  $my_currency = $_SESSION['currency'];
now go a few lines further down the page into the submit_data_array and find the line ```
'x_amount' => number_format($order->info['total'], 2),

immediately after that line, insert the following:```
'x_currency_code' => $my_currency,


Your cart should then send the currency code as part of the transaction. Make a note of the changed file: there isn't an override facility for that file, and you'll need to keep a backup of your modified file for future upgrades.

Neville
An assumption is what you arrive at when you get tired of thinking...

6 Jun 2006, 9:13 PM
#3
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #3 by pioupioun

Thank you so much for answering, but I don't have AIM implemented, I have SIM, so I would need to modify just the authorize.net.php - is there a way your solution can be modified to work with that code instead? Thanks again for the help, I need it BAD!!!!

6 Jun 2006, 9:23 PM
#4
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Post #4 by bunyip

yes, you can use a similar change for the SIM method.
Find the following line of code in includes/modules/payment/authorizenet.php (at line 294 in v1.3.0.1)

        zen_draw_hidden_field('x_Amount', number_format($order->info['total'], 2)) .

immediately after it, add this line:

        zen_draw_hidden_field('x_currency_code', $_SESSION['currency']) . 

Neville
An assumption is what you arrive at when you get tired of thinking...

6 Jun 2006, 9:36 PM
#5
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #5 by pioupioun

Hmmm, when I do that, it kicks back a credit card processing error after I click the Confirm Order button (I am in test mode, using the test card number: 4111 1111 1111 1111) that says:

There has been an error processing your credit card. Please try again.

Any ideas? I really appreciate your help on this, thank you so much for taking the time!

6 Jun 2006, 9:39 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #6 by ajeh

Try the Master Card ...

One of the modules doesn't like the Visa test card if I am not mistaken ... :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Jun 2006, 9:58 PM
#7
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #7 by pioupioun

In the SIM method with authorizenet.php, I don't get the different card numbers, only one. The multiple card numbers only show up in the AIM installation area. But I tried them all anyway and got the same error message.

But I just got off support with them, because I thought "Hey, I'd better make extra, extra sure that I don't need to do anything on the account side to allow me to take GBP instead of USD." and they tell me they don't take foreign currencies, that the information in their programming guide is old, and that they only take USD. Are they KIDDING me with this? Please tell me this is just a clueless support flunkie who would rather blow me off then try to find someone to answer my question!!! Please tell me someone out there has this working!

Yaaaaaaaaaaaaarg!

6 Jun 2006, 10:07 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #8 by ajeh

Just a question ... are you using SIM vs AIM for any particular reason?

AIM is the better method ... utilizing curl for a better handshake method so to speak ... :smile:

It also makes the customer's shopping experience seamless as they never leave your site ... and this is the ideal method for credit cards ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Jun 2006, 10:20 PM
#9
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #9 by pioupioun

Well, I was using it because it was "simpler." But when I got the AIM solution to my first post on this thread, I switched to AIM and tried it, but it wouldn't work, it just gave me a blank screen.

Then the SIM solution post came through, and I switched back to that, but then I started getting this error, which I guess is due to the currency. I don't have any particular objection to using AIM, now that I have been through it, but using SIM with Zen Cart has the nice feature of not leaving your site (as far as looks go, anyway), though it does in normally.

I went back to my static site SIM implementation and passed the GBP currency code through, and it gave me this error:

**(39) The supplied currency code is either invalid, not supported, not allowed for this merchant or doesn't have an exchange rate. **

But I just can't believe they are serious.

6 Jun 2006, 10:36 PM
#10
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Post #10 by bunyip

pioupioun:

But I just got off support with them, because I thought "Hey, I'd better make extra, extra sure that I don't need to do anything on the account side to allow me to take GBP instead of USD." and they tell me they don't take foreign currencies, that the information in their programming guide is old, and that they only take USD.

If that's the case then you could modify the payment module so it always calculates and submits the USD value.

(No guarantee this will work though)

delete the line you added earlier to transmit the field x_currency_code

In the function process_button() starting at line 287, change the line global $_SERVER, $order;to ```
global $_SERVER, $order, $currencies;

immediately after that, add this code:```
	$transaction_value = $currencies->value(number_format($order->info['total'], 2), true, 'USD');

now change the line ```
zen_draw_hidden_field('x_Amount', number_format($order->info['total'], 2)) .

to ```
        zen_draw_hidden_field('x_Amount', $transaction_value ) .

then change

    $this->InsertFP(MODULE_PAYMENT_AUTHORIZENET_LOGIN, MODULE_PAYMENT_AUTHORIZENET_TXNKEY, number_format($order->info['total'], 2), $sequence);

to

    $this->InsertFP(MODULE_PAYMENT_AUTHORIZENET_LOGIN, MODULE_PAYMENT_AUTHORIZENET_TXNKEY, number_format($transaction_value, 2), $sequence);

Neville
An assumption is what you arrive at when you get tired of thinking...

6 Jun 2006, 10:47 PM
#11
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #11 by pioupioun

I tried the code you gave me, but I still get the same error :cry:

7 Jun 2006, 1:15 AM
#12
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Post #12 by bunyip

did you delete the line you inserted earlier?

zen_draw_hidden_field('x_currency_code', $_SESSION['currency']) .

That's the only thing that is sending a currency code and could be giving you that error

Neville
An assumption is what you arrive at when you get tired of thinking...

7 Jun 2006, 9:54 PM
#13
pioupioun avatar

pioupioun

New Zenner

Join Date:
Jun 2006
Posts:
31
Plugin Contributions:
0

Post #13 by pioupioun

bunyip:

did you delete the line you inserted earlier?

zen_draw_hidden_field('x_currency_code', $_SESSION['currency']) .

> That's the only thing that is sending a currency code and could be giving you that error

That must have been the problem, I started with the clean authorizenet.php file and did your mods, and it works like a CHARM, you genius you.  I can't thank you enough for taking the time to help me with this! :thumbsup: :thumbsup: :thumbsup:
24 Jul 2006, 8:40 PM
#14
chiebert avatar

chiebert

New Zenner

Join Date:
Jul 2006
Location:
NS (soon to be BC), Canada
Posts:
6
Plugin Contributions:
0

Post #14 by chiebert

bunyip:

If that's the case then you could modify the payment module so it always calculates and submits the USD value.

Hey good advice, bunyip - I'm setting up a client in Canada and have the same issue. But I'm using the AIM version of the module. How/where would you translate these SIM instructions into 1.3.0.2 authorizenet_aim?

Ta very much, in advance!

25 Jul 2006, 1:46 AM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #15 by drbyte

bunyip's post at the start of this thread (post #2) gives the answer to your question.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Jul 2006, 2:08 AM
#16
chiebert avatar

chiebert

New Zenner

Join Date:
Jul 2006
Location:
NS (soon to be BC), Canada
Posts:
6
Plugin Contributions:
0

Post #16 by chiebert

DrByte:

bunyip's post at the start of this thread (post #2) gives the answer to your question.

Unfortunately it doesn't. That post gives instructions on how to pass your site's default currency to authorize.net (AIM). But as pioupioun observes in post #7, authorize.net doesn't actually allow (some? most? any?) accounts to bill in anything other than USD. I've tried this one (my default is CAD) and get the 'invalid currency' error back from authorize.net.

So bunyip posted instructions (in #10) on how to recalculate the transaction amount into USD and post that - but because pioupioun had since reverted to the SIM method, the instructions don't fit the AIM version of the module (which I'm using, for all the enhancements it offers).

Hope that clarifies! :wink2:

25 Jul 2006, 4:05 AM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #17 by drbyte

Aha ... I stand corrected.

To change authorize.net so that it always recalculates the order amount in USD (assuming your exchange rate is set properly in the Admin):

includes/modules/authorizenet_aim.php
Around line 197 you have:php // Populate an array that contains all of the data to be sent to Authorize.net $submit_data = array( 'x_login' => MODULE_PAYMENT_AUTHORIZENET_AIM_LOGIN, // The login name is assigned by authorize.net 'x_tran_key' => MODULE_PAYMENT_AUTHORIZENET_AIM_TXNKEY, // The Transaction Key is generated through the merchant interface Right ABOVE those lines, add a two new lines:```php
global $currencies;
$usd_transaction_value = $currencies->value(number_format($order->info['total'], 2), true, 'USD');


about 8 lines below that, you'll see a line that says:
```php
                         'x_amount' => number_format($order->info['total'], 2),
```change it to:
```php
                         'x_amount' => $usd_transaction_value,

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Jul 2006, 12:47 PM
#18
chiebert avatar

chiebert

New Zenner

Join Date:
Jul 2006
Location:
NS (soon to be BC), Canada
Posts:
6
Plugin Contributions:
0

Post #18 by chiebert

DrByte:

To change authorize.net so that it always recalculates the order amount in USD (assuming your exchange rate is set properly in the Admin):
Thanks DrByte! That's done it! :thumbsup:

1 Aug 2006, 6:14 AM
#19
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Post #19 by peter_homann

Hi,

I have a similar problem, sort of..:smile:

I have the Australia Post shipping calculator returning the postage cost in Australian dollars AUD, as one would expect.

I need it convered to the default currency I am using, USD, before it is used.

Is there a similar way I can take the postage value reurned and convert it to USD.

Thanks,

Peter.