Reply
Highlighted
Member
Posts: 3
Registered: ‎02-10-2012

Card Present Transaction on iOS SDK (AIM) Not working

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?

Highlighted
Member
Posts: 3
Registered: ‎03-21-2012

Re: Card Present Transaction on iOS SDK (AIM) Not working

Did you solve it?

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

Re: Card Present Transaction on iOS SDK (AIM) Not working

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

 

Highlighted
Member
Posts: 3
Registered: ‎03-21-2012

Re: Card Present Transaction on iOS SDK (AIM) Not working

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;
}
Highlighted
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Card Present Transaction on iOS SDK (AIM) Not working

Aha! Well, glad I could find the right section of code for you.

Highlighted
Member
Posts: 1
Registered: ‎04-11-2012

Re: Card Present Transaction on iOS SDK (AIM) Not working

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.