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

Re: Basic CIM questions

OK I finally have some transactions happening.  Lots of trial and erorr involved.

 

The problem I'm having now is that a comma is a really poor choice for delimiter -- or there's something wrong with the gateway's response.

 

I see that a CIM response ALWAYS constructs a response using a comma as a delimiter:

 

class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
{
    /**
     * @return AuthorizeNetAIM_Response
     */
    public function getTransactionResponse()
    {

        // NOTE THE SECOND PARAMETER IS A COMMA
        return new AuthorizeNetAIM_Response($this->_getElementContents("directResponse"), ",", "", array());
    }
...

}

 

It's my understanding that one must tell the gateway with the outgoing request what delimiter to use so that when the response arrives, it is using the correct delimiters.  Is there some way to specify this using the PHP api?  As we see i the code sample above, the comma appears to be hard-wired for parsing CIM transaction results.

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

Re: Basic CIM questions

[ Edited ]

I think the results come back as XML, and you should be able to access the parsed XML rather than going through the functions. directResponse is only one of the returned elements. Try doing a print_r() and exploring the structure.

 

EDIT: And yes, you can go into your control panel and change the delimiter with Settings -> Transaction Response Settings -> Direct Response, then edit the functions for the new delimiter. However, this may affect other API's as well, so keep that in mind.

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

Re: Basic CIM questions

I suspect I will need to modify the PHP library files in order to effectively get a non-comma delimiter working, which bums me out a bit.   I'll probably call tech support and let them know that someone should fix that.

 

I truly appreciate your generous assistance here.  I have another fairly critical question.  I see that the gateway can return a response_code of 'held' and I'm wondering how to deal with a response like this.  I'm guessing that this might result when I attempt a transaction pending some kind of approval, but I totally unsure how I am to be notified of the held funds being delivered/released at a later time.

 

Do I need to also configure some other page so that authorize.net might deliver asynchronous events to my system?  I.e., something like a silent post form or something? Does authorize.net support asynchronous payment events with this PHP library?

 

 

'

Administrator
Posts: 591
Registered: ‎08-21-2009

Re: Basic CIM questions

There is no specific functionality in the php SDK designed to let you change the delmiting character.  However, it is possible to pass the x_delim_char variable within the extraOptions tag which is exposed by the SDK.  In regards to your second question about asynchronous communication, this is not relevant to our CIM APIs.

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

Re: Basic CIM questions

I believe that passing any $extraOptions via the PHP SDK would likely cause a failure when your PHP library tries to parse any results from the gateway because your PHP code has no means by which you could change the expected delimiter. As you can see in my post from 3/28 above, the method getTransactionResponse of the class AuthorizeNetCIM_Response has a hard-coded reference to the comma as a delimiter.  This seems like a pretty simple fix and would be very nice to have as commas frequently appear on my data -- especially addresses.

 

As for the need for asynchronous notifications, I believe it IS relevant to your CIM APIS because I have instantiated an AuthorizeNETCIM object:

        $request = new AuthorizeNetCIM(AUTHORIZENET_API_LOGIN_ID, AUTHORIZENET_TRANSACTION_KEY);

 

I have used that CIM object to create a transaction with a CIM customerProfile and customerPaymentProfile:

            $response = $request->createCustomerProfileTransaction("AuthCapture", $transaction);

And when I extract the response of my CIM object:

$transactionResponse = $response->getTransactionResponse();

 

Then the response might yield a value of AuthorizeNetResponse::HELD.

 

If the result of this transaction is HELD, it is my guess that I will probably need to respond to some future event asynchronously, correct?

 

 

Administrator
Posts: 591
Registered: ‎08-21-2009

Re: Basic CIM questions

Transactions that are "held" require a manual review by the merchant within their Authorize.Net account.  There is no API notification whether these transactions are manually approved or declined at a later time.  It is up to the merchant to make any necessary modificaiton in thier order management system or shopping cart after they have determined what action to take on the order.

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

Re: Basic CIM questions

Thanks for the clarification, Trevor.

 

Another question.  When i try to create a Customer Profile and the gateway returns error type E00039:

 

A duplicate record with ID 1234567 already exists

 

Is it safe for me to parse that error and use the other ID?  Can anyone think of any reason why this might compromise security?  Also, is the format of this error likely to change?  If I plan to parse it and the text is changed, I could end up with the wrong id.

 

 

Administrator
Posts: 591
Registered: ‎08-21-2009

Re: Basic CIM questions

This is a bit of an interesting question.  Our general policy is not to make any guarantees about the precise text for responses, but obviously this response is unique.  My expectation is that this this error text will never change, but there is always a possibility that changes to the API make a change unavoidable.  I can tell you that we always try to avoid any changes to our existing API behavior and we announce changes in advance if they have a chance of breaking existing implementations.

 

With all of that being said, I cannot currently think of any reason that we would have a need to change this text.

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

Re: Basic CIM questions

I'm pleased to report that I've made progress and am testing my form.  I'm still wondering how to respond to circumstances where my locally stored profile data is in conflict with the information stored by the gateway.  IN particular, these:

 

1) Local data has no payment profiles stored for a user but gateway returns "E00039 A duplicate customer payment profile already exists." The gateway doesn't tell us what the profile id is so we can't delete it or fetch it or use it.

 

2) Local data has a customerProfileId stored which the gateway doesn't recognize.  I'm guessing I should wipe all of my customer profile data (and payment profile data) and try to re-create them but I'm worried about the duplicate profile and duplicate payment profile errors.

 

 

 

 

Administrator
Posts: 591
Registered: ‎08-21-2009

Re: Basic CIM questions

When a "duplicate customer payment profile" message is returned, the simplest action is to run a "getCustomerProfileRequest" to update the list of payment profiles that you have on file for the customer.  This should avoid any sync issues between your database and what is in Authorize.Net.