I'm returning to a PHP project I worked on some months ago and can't seem to locate where to specify an invoice number. I see $this->invoice_number referred to in the class AuthorizeNetAIM_Response and also as a member of an array in $_all_aim_fields member variable of AuthorizeNetAIM.
Where does one define the invoice number when creating a CIM transaction? In the AuthorizeNetCIM object that one creates? Or in the AuthorizeNetTransaction object that one feeds to AuthorizeNetCIM::createCustomerProfileTransaction() ?
The PHP source is very confusing because nearly all of the member properties are defined as arrays rather than proper member variables with their corresponding Javadoc comments. Forget about autocompletion or code hinting! If you are generating these objects from arrays of variable names, perhaps someone could write a script to also generate proper PHP classes with comments so my IDE can help me understand them better?
09-14-2012 05:00 PM
If you have:
$transaction = new AuthorizeNetTransaction;
Then it would be assigned:
$transaction->order->invoiceNumber = $myinvoicenumber;
09-14-2012 11:47 PM - edited 09-14-2012 11:48 PM
I have tried setting the property invoiceNumber in my code but the gateway returns an error:
<?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00003</code><text>The element 'profileTransAuthOnly' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'invoiceNumber' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'customerShippingAddressId, order, taxExempt, recurringBilling, cardCode, splitTenderId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.</text></message></messages></ErrorResponse>
Now that I think about it, I guess this might make sense -- it's an auth-only transaction so perhaps invoice number doesn't apply.
Note that I was trying to avoid the 'duplicate transaction' on auth-only transactions. There are cases on my site where I'd like to permit multiple transactions within 2 minutes. It was my hope to distinguish them by assigning distinct invoice numbers.
09-28-2012 04:46 PM
Darn it. I was trying to assign invoiceNumber on the $transaction object rather than $transaction->order. I have fixed my code now and it appears to be working.
09-28-2012 05:11 PM