Reply
Member
Posts: 4
Registered: ‎11-22-2011
Accepted Solution

Issues in both liveMode and oldLiveMode

I am new to payments through Authorize.Net, infact i have not used payment gateways at all. I was a moved to this payments module a few days ago... and now i think i should have rejected at that time...

 

We are using Authorize.Net CIM with Service URL https://api.authorize.net/soap/v1/Service.asmx in our system.

 

First, we were receiving the error "This transaction has been declined.". After investigating this issue, we realized that this issue was occuring only for MasterCards. The only solution we found for this was to change the validationMode to "oldLiveMode" instead of "liveMode". So we did change it.

 

But than a new issue begin to appear which was not occuring before, the error message is "Expiration Date is invalid.". This error occurs even for valid CC expiration dates. We have noticed that this issue occurs only for CCs whose expiration month is between 1 to 9 i.e. (Jan - Sept) a single digit month.

 

We have tried with and without appending "0" to a single digit month but the error still occurs.

 

We are stuck here and this is very serious issue, so any help is greatly appreciated.

 

So i have issues in both validation modes:

1. In liveMode, the MasterCards does not work

2. In oldLiveMode, 1-9 months are not accepted while creating Customer Profile.

 

What should i do?

 

(NOTE : We are using oldLiveMode now because liveMode does not support MASTERCARDS. We dont know why)


Accepted Solutions
Solution
Accepted by topic author aamirhabibkhan
‎08-21-2015 01:58 AM
Posts: 1,609
Topics: 15
Kudos: 200
Solutions: 121
Registered: ‎06-23-2011

Re: Issues in both liveMode and oldLiveMode

Well, the documentation says it's YYYY-MM. So you obviously need to have the leading zeros. Have you tried printing out the month value to the screen after adding the zeros to see if it's actually getting them or not? It's possible that doing "0" + number value is being interpreted as "Convert 0 to number and then add the number" rather than "convert the number to a string and append it to the 0". This might be safer:

 

creditCard.expirationDate = String.format('%4d-%2d', creditCardDetail.ExpYear, creditCardDetail.ExpMonth);

 I am of course assuming you're using Java and that the String.format function is similar to sprintf in other languages.

View solution in original post


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

Re: Issues in both liveMode and oldLiveMode

Can you post your code (in a code box - fourth option from the left in Rich Text mode)? I'm not familiar with SOAP, but it sounds like you could be losing your zero before the month actually gets sent.

Member
Posts: 4
Registered: ‎11-22-2011

Re: Issues in both liveMode and oldLiveMode

[ Edited ]

Thanks TJPride for the reply,


I have tried by sending expiration date in both formats. like for January 2012 we sent it as 2012-1 & 2012-01.

I am pasting the whole method which we call for creating a customer's payment profile.

 

public static bool CreateAuthorizeNetCustomerPaymentPofile(string customerProfileID, string buyerCompany, Address billingAddress, CreditCard creditCardDetail, out string paymentProfileID, out string error, out string internalError)
        {
            error = "";
            paymentProfileID = "";
            internalError = "";

            CustomerPaymentProfileType paymentProfile = new CustomerPaymentProfileType();
            CreditCardType creditCard = new CreditCardType();
            creditCard.cardCode = creditCardDetail.CVV2;
            creditCard.cardNumber = creditCardDetail.CreditCardNo;

            //We have tried this too .. We were using this code in liveMode
            //creditCard.expirationDate = String.Format("{0}-{1}", creditCardDetail.ExpYear, (creditCardDetail.ExpMonth < 10 ? "0" + creditCardDetail.ExpMonth : creditCardDetail.ExpMonth));

            //Later for oldLiveMode we removed the code for appending "0" to months between 1 - 9
            creditCard.expirationDate = String.Format("{0}-{1}", creditCardDetail.ExpYear, creditCardDetail.ExpMonth);

            PaymentType payment = new PaymentType();
            payment.Item = creditCard;

            paymentProfile.billTo = new CustomerAddressType();
            paymentProfile.billTo.firstName = billingAddress.FirstName;
            paymentProfile.billTo.lastName = billingAddress.LastName;
            paymentProfile.billTo.company = buyerCompany;
            paymentProfile.billTo.address = billingAddress.Address1 + " " + billingAddress.Address2;
            paymentProfile.billTo.city = billingAddress.City;
            paymentProfile.billTo.state = billingAddress.State;
            paymentProfile.billTo.zip = billingAddress.ZipCode;
            paymentProfile.billTo.country = billingAddress.Country;
            paymentProfile.billTo.phoneNumber = billingAddress.PhoneNo;
            paymentProfile.billTo.faxNumber = billingAddress.FaxNo;

            paymentProfile.payment = payment;

            CreateCustomerPaymentProfileResponseType response = AuthorizeNetWSHelper.ServiceCaller.CreateCustomerPaymentProfile(AuthorizeNetWSHelper.MerchantAuthentication, long.Parse(customerProfileID), paymentProfile, AuthorizeNetWSHelper.ValidationMode);
            if (response != null && response.resultCode == MessageTypeEnum.Ok)
            {
                paymentProfileID = response.customerPaymentProfileId.ToString();
                return true;
            }
            else if (response != null)
            {
                // Record Error
//Here We store the error "Expiration Date is Invalid." } else { error = "Our Payment Service is down. We are sorry that your transaction cannot be procssed now. Please try it later."; } return false; }

 

Any help is greatly appreciated.

 

Solution
Accepted by topic author aamirhabibkhan
‎08-21-2015 01:58 AM
Posts: 1,609
Topics: 15
Kudos: 200
Solutions: 121
Registered: ‎06-23-2011

Re: Issues in both liveMode and oldLiveMode

Well, the documentation says it's YYYY-MM. So you obviously need to have the leading zeros. Have you tried printing out the month value to the screen after adding the zeros to see if it's actually getting them or not? It's possible that doing "0" + number value is being interpreted as "Convert 0 to number and then add the number" rather than "convert the number to a string and append it to the 0". This might be safer:

 

creditCard.expirationDate = String.format('%4d-%2d', creditCardDetail.ExpYear, creditCardDetail.ExpMonth);

 I am of course assuming you're using Java and that the String.format function is similar to sprintf in other languages.

Member
Posts: 4
Registered: ‎11-22-2011

Re: Issues in both liveMode and oldLiveMode

Thank you very much for your helpful reply. You were right. Doing "0" + number value was being interpreted as "Convert 0 to number and then add the number" rather than "convert the number to a string and append it to the 0"... i did convert the number to string and then appended "0" to it and it worked.

 

Thank you very much.

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

Re: Issues in both liveMode and oldLiveMode

Glad to help. Contextual assignments are easy to mess up by mistake.