I'm trying to create a Card Present transaction using the iOS SDK and it isn't working properly. The SDK sample code shows how to do a Card Not Present transaction using the following PaymentType setup:
CreditCardType *creditCardType = [CreditCardType creditCardType]; creditCardType.cardNumber = @"4111111111111111"; creditCardType.cardCode = @"100"; creditCardType.expirationDate = @"1212";
And this works just fine.
There are two other PaymentTypes currently defined in the Authorize.NET iOS SDK, that is bankAccountType and creditCardTrackType. creditCardTrackType (which takes the properties track1 and track2) is used for Card Present transactions. However, when I set up the PaymentType code for creditCardTrackType:
CreditCardTrackType *creditCardTrackType = [CreditCardTrackType creditCardTrackType]; creditCardTrackType.track1 = @"<TRACK1_INFO>"; creditCardTrackType.track2 = @"<TRACK2_INFO>";
It doesn't work.
I've verified that the track information for track1 and track2 doesn't have the sentinel characters as the SDK specifies. When I try and use this PaymentType, I get an error that the element '<bankAccount>' is missing required information. When I look at the XML that is built behind the scenes by the SDK (request.stringOfXMLRequest), in the <payment> node, it has an empty element <bankAccount></bankAccount>.
When I use either of the other two PaymentTypes (bankAccountType or creditCardType), it properly builds the XML and the transactions go through. But when I use creditCardTrackType, it emits a blank <bankAccount> node instead of the expected <creditCardTrack></creditCardTrack> node.
Does anyone know if I'm doing something wrong? Or is the Card Present payment type (creditCardTrackType) not properly implemented in the current version of the Authorize.NET iOS SDK?
02-11-2012 12:33 AM
Did you solve it?
03-26-2012 11:07 AM
Go to PaymentType.m in the SDK, add something to this function to print out the XML and variables and see what's going on? Funny thing is it's marked as "fix this", so whoever wrote this code knew something was going wrong.
- (NSString *) stringOfXMLRequest { //TODO fix this. if (creditCard.cardNumber) { self.bankAccount = nil; self.trackData = nil; } else if (bankAccount.accountNumber) { self.creditCard = nil; self.trackData = nil; } else if (trackData.track1) { self.creditCard = nil; self.trackData = nil; } NSString *s = [NSString stringWithFormat:@"" @"<payment>" @"%@" //creditCard @"%@" //bankAccount @"%@" //trackData @"</payment>", (self.creditCard ? [self.creditCard stringOfXMLRequest] : @""), (self.bankAccount ? [self.bankAccount stringOfXMLRequest] : @""), (self.trackData ? [self.trackData stringOfXMLRequest] : @"")]; return s; } @end
03-26-2012 08:46 PM
THANK YOU !!! THANK YOU !!! THANK YOU !!!
if (creditCard.cardNumber) { self.bankAccount = nil; self.trackData = nil; } else if (bankAccount.accountNumber) { self.creditCard = nil; self.trackData = nil; } else if (trackData.track1) { self.creditCard = nil; self.trackData = nil; }
The last else-if statement resets my track data to nil
The fix: replace trackData with bankAccount
else if (trackData.track1) { self.creditCard = nil; self.bankAccount = nil; }
03-27-2012 04:33 PM
Aha! Well, glad I could find the right section of code for you.
03-27-2012 04:59 PM
May I know how did you get the BankAccountType to work? For some reason, my transaction didn't go through. It doesn't show on the web admin either.
04-11-2012 04:48 PM