cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

AIM and PHP SDK missing currency_code

I'm using the PHP SDK (version 1.1.8) to do an Authorize and Capture.

 

I'm trying to set the field "currency_code" and get this error:

 

[15-Mar-2013 08:46:21] PHP Fatal error:  Uncaught exception 'AuthorizeNetException' with message 'Error: no field currency_code exists in the AIM API.
                To set a custom field use setCustomField('field','value') instead.' in D:\usr\projects\PRCI_pubs\public\pscripts\anet\lib\AuthorizeNetAIM.php:308

A review of the AuthorizeNetAIM class reveals that currency_code is not in the array of $_all_aim_fields.

 

Is there a reason the currency_code is not implemented in this SDK?

 

 

vmallu1313
Member
6 REPLIES 6

Probably because at the time the only currency supported is USD.

RaynorC1emen7
Expert

vmallu, I found the same issue.. looking at the very latest version of the PHP SDK the currency_code field is not there, however the AIM API documentation found here http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm says this ...

 

 

x_currency_code
Optional
Value: USD, CAD, or GBP.
Format: 3 character string.
Notes: If this field is not submitted, the default is the currency selected by the merchantโ€™s payment processor. Setting this field to a currency that is not supported by the payment processor will result in an error.

 

 

 There are no timestamps on the documentation... Maybe this is a new addition and is coming soon? Who knows, would be awesome if Auth.Net staff could clarify.

 

Cheers,

 

happy
Member

the SDK came out over a year ago, and the currency support just about 2 months ago.

http://community.developer.authorize.net/t5/News-and-Announcements/Authorize-Net-Expansion-into-Cana...

So is the SDK officially supported or not? If so, I'd expect that it would be upgraded to support new features in the API.


What's the fix? I'd like to set the currency_code without changing the sourcecode and without getting the exception. Is there a ->setVarWithoutException() or something?

Turns out that you can do:

 

$txn->verify_x_fields = false;
$txn->currency_code = $product->currency;
$txn->verify_x_fields = true;



Hello jshannon,

 

Setting the currency_code isn't a required field.  Each gateway account is configured with a single currency and you cannot overide this using the currency_code.  If you attempt to set a currency_code different than the one configured for the gateway, it will return an error.

 

Sanbox accounts are configured for USD.

 

Richard