Reply
Member
Posts: 1
Registered: ‎03-15-2013

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?

 

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: AIM and PHP SDK missing currency_code

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

Member
Posts: 1
Registered: ‎05-16-2013

Re: AIM and PHP SDK missing currency_code

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,

 

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: AIM and PHP SDK missing currency_code

[ Edited ]

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...

Member
Posts: 2
Registered: ‎08-19-2013

Re: AIM and PHP SDK missing currency_code

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?

Member
Posts: 2
Registered: ‎08-19-2013

Re: AIM and PHP SDK missing currency_code

Turns out that you can do:

 

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



Posts: 2,765
Topics: 57
Kudos: 251
Blog Posts: 67
Registered: ‎12-05-2011

Re: AIM and PHP SDK missing currency_code

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