cancel
Showing results for 
Search instead for 
Did you mean: 

Expiration Date in refund transaction

I am trying to refund credit card  transactions through the AIM api.

 

Heres my code in php:

 

                $this->_constructXml("createTransactionRequest");            
                ($params['transID'] ?
                $this->_xml->addChild("refId", $params['transID']) : null);
                $transactionRequest = $this->_xml->addChild("transactionRequest");
                $transactionRequest->addChild("transactionType","refundTransaction");
                ($params['amount'] ?
                $transactionRequest->addChild("amount", $params['amount']) : null);
                $payment = $transactionRequest->addChild("payment");
                $paymentCreditCard = $payment->addChild("creditCard");
                ($params['creditCardNumber'] ?
                $paymentCreditCard->addChild("cardNumber", $params['creditCardNumber']) : null);
                $result = $this->makeRequest();

 

when i try to execute this code i get the error

The element 'creditCard' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'expirationDate' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

 

But when i execute the getTransactionDetail i get the expiration date as XXXX.

        [payment] => SimpleXMLElement Object
                        (
                            [creditCard] => SimpleXMLElement Object
                                (
                                    [cardNumber] => XXXX0012
                                    [expirationDate] => XXXX
                                    [cardType] => Discover
                                )

                        )


So i randomly put the expiartion date as 0713 and it worked. May be since its sandbox account it didn't verify the expiration date.

         $paymentCreditCard->addChild("expirationDate", "0713");

 

But my issue is how would i make it to work in live environment since the credit card expiartion dates cannot be retrieved.

 

Is the code correct? Any help?

 

Thanks in advance.

 

Regards,

Sarita.

 

Sarita555
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

Thank you RaynorC1emen7 for your help and pointing that out.

 

Yes the xml node sequence was actually wrong and its 'refTransId'  and not refId.

The refTransId node should be after the payment node.

 

And yes the XXXX masked expiration date works too :).

 

Heres the correct code:

 

$this->_constructXml("createTransactionRequest");	        
$transactionRequest = $this->_xml->addChild("transactionRequest");
$transactionRequest->addChild("transactionType","refundTransaction");
($params['amount'] ? $transactionRequest->addChild("amount", $params['amount']) : null);
payment = $transactionRequest->addChild("payment");
$paymentCreditCard = $payment->addChild("creditCard");
$paymentCreditCard->addChild("cardNumber", 'XXXX0027');		        
$paymentCreditCard->addChild("expirationDate", "XXXX");
($params['transID'] ? $transactionRequest->addChild("refTransId", $params['transID']) : null);
$result = $this->makeRequest();

 

And heres the link for the correct xml format 

http://community.developer.authorize.net/t5/Integration-and-Testing/Looking-for-well-formed-XML-for-...

 

 

View solution in original post

7 REPLIES 7

Did you try just XXXX (masked expiration date)? or just send in blank?

RaynorC1emen7
Expert

Yes i had tried that but it gave me an error credit card expiration date is invalid.

 

Also the refund API works only when i provide the whole credit card number which  too are not returned from the getTransactionDetails. Last 4 digits or numbers like XXXX0012  gives an error credit card number is invalid.

 

Any ideas please?

The xml documentation said the reference id is <refTransId> not <refId>

probably it think it is a unlinked credit which required full credit card information

I tried using 'refTransId'  instead of  'refId' but it gives the following error

 

[message] => SimpleXMLElement Object
                (
                    [code] => E00003
                    [text] => The element 'createTransactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'refTransId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'refId, transactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
                )

 

I am able to refund only when i use refId along with the whole credit card number and expiration date.

 

Any ideas please how I could make it work?

 

Thank You.

Read the xml documentation. you need to follow the xml node sequence.

Thank you RaynorC1emen7 for your help and pointing that out.

 

Yes the xml node sequence was actually wrong and its 'refTransId'  and not refId.

The refTransId node should be after the payment node.

 

And yes the XXXX masked expiration date works too :).

 

Heres the correct code:

 

$this->_constructXml("createTransactionRequest");	        
$transactionRequest = $this->_xml->addChild("transactionRequest");
$transactionRequest->addChild("transactionType","refundTransaction");
($params['amount'] ? $transactionRequest->addChild("amount", $params['amount']) : null);
payment = $transactionRequest->addChild("payment");
$paymentCreditCard = $payment->addChild("creditCard");
$paymentCreditCard->addChild("cardNumber", 'XXXX0027');		        
$paymentCreditCard->addChild("expirationDate", "XXXX");
($params['transID'] ? $transactionRequest->addChild("refTransId", $params['transID']) : null);
$result = $this->makeRequest();

 

And heres the link for the correct xml format 

http://community.developer.authorize.net/t5/Integration-and-Testing/Looking-for-well-formed-XML-for-...

 

 

Is there any other way for refund transaction? i want to refund using just transactionid and don't want to use card details.