Showing results for 
Search instead for 
Did you mean: 

Integrating Authorised.Net in ios

Respected Sir,

I am using AIM for iPhone in xcode 4.6 with iphone 4s and integrating all your file which i get from file.

when i build the program it builds Sucessfully and i called loginGateway it is also calling that class but after that it can not call any other class and function. it does not show me any error and warning so what can i have to do for that please help me.

i Set my Path as Below:


Header Search Path: "$(SDK_DIR)/usr/include/libxml2"

Library Search Path: "$(SRCROOT)/ANMobilePaymentLib"




#import <UIKit/UIKit.h>
#import "MobileDeviceLoginRequest.h"
#import "AuthNet.h"

@interface ViewController : UIViewController<AuthNetDelegate>
    NSString *sessionToken;




#import "ViewController.h"

@interface ViewController ()


@implementation ViewController

- (void)viewDidLoad
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self loginToGateway];

- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
- (void) loginToGateway {
    MobileDeviceLoginRequest *mobileDeviceLoginRequest =
    [MobileDeviceLoginRequest mobileDeviceLoginRequest]; = @"myUserName";
    mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.password = @"myPassword";
    mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.mobileDeviceId =
    [[[UIDevice currentDevice] uniqueIdentifier]
     stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
    AuthNet *an = [AuthNet getInstance];
    [an setDelegate:self];
    [an mobileDeviceLoginRequest: mobileDeviceLoginRequest];

- (void) createTransaction

    AuthNet *an = [AuthNet getInstance];
    [an setDelegate:self];
    CreditCardType *creditCardType = [CreditCardType creditCardType];
    creditCardType.cardNumber = @"4111111111111111";
    creditCardType.cardCode = @"100";
    creditCardType.expirationDate = @"1212";
    PaymentType *paymentType = [PaymentType paymentType];
    paymentType.creditCard = creditCardType;
    ExtendedAmountType *extendedAmountTypeTax = [ExtendedAmountType extendedAmountType];
    extendedAmountTypeTax.amount = @"0"; = @"Tax";
    ExtendedAmountType *extendedAmountTypeShipping = [ExtendedAmountType extendedAmountType];
    extendedAmountTypeShipping.amount = @"0"; = @"Shipping";
    LineItemType *lineItem = [LineItemType lineItem];
    lineItem.itemName = @"Soda";
    lineItem.itemDescription = @"Soda";
    lineItem.itemQuantity = @"1";
    lineItem.itemPrice = @"1.00";
    lineItem.itemID = @"1";
    TransactionRequestType *requestType = [TransactionRequestType transactionRequest];
    requestType.lineItems = [NSArray arrayWithObject:lineItem];
    requestType.amount = @"1.00";
    requestType.payment = paymentType; = extendedAmountTypeTax;
    requestType.shipping = extendedAmountTypeShipping;
    CreateTransactionRequest *request = [CreateTransactionRequest createTransactionRequest];
    request.transactionRequest = requestType;
    request.transactionType = AUTH_ONLY;
    request.anetApiRequest.merchantAuthentication.mobileDeviceId =
    [[[UIDevice currentDevice] uniqueIdentifier]
     stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
    request.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;
    [an purchaseWithRequest:request];

- (void) requestFailed:(AuthNetResponse *)response {
    // Handle a failed request

- (void) connectionFailed:(AuthNetResponse *)response {
    // Handle a failed connection

- (void) paymentSucceeded:(CreateTransactionResponse *) response {
    // Handle payment success

- (void) mobileDeviceLoginSucceeded:(MobileDeviceLoginResponse *)response {
    sessionToken = [response.sessionToken retain];
    [self createTransaction];



in above code -(void)MobileDeviceLoginSucceeded:(MobileDeviceLoginResponse *)response method did not call anyway i tried everything but only logingateway method is calling only other methods are not calling please help me for that


i am waiting for your reply.






It doesn't look like anyone has responded yet, but someone still may have feedback on what you're looking for. I'd recommend subscribing to this topic so that you'll be alerted via email if anyone else from the community is able to respond with any comments. To subscribe, click Topic Options at the top of this thread and then select Subscribe. You'll then receive an email once anyone replies to your post.



Administrator Administrator