Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Contributor
Posts: 36
Registered: ‎02-23-2012

Where to specify invoice_number in the PHP API when doing a CIM transaction?

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?

Posts: 1,609
Topics: 15
Kudos: 209
Solutions: 121
Registered: ‎06-23-2011

Re: Where to specify invoice_number in the PHP API when doing a CIM transaction?

[ Edited ]

If you have:

$transaction = new AuthorizeNetTransaction;

 Then it would be assigned:

$transaction->order->invoiceNumber = $myinvoicenumber;
Contributor
Posts: 36
Registered: ‎02-23-2012

Re: Where to specify invoice_number in the PHP API when doing a CIM transaction?

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.

 

 

Contributor
Posts: 36
Registered: ‎02-23-2012

Re: Where to specify invoice_number in the PHP API when doing a CIM transaction?

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.