cancel
Showing results for 
Search instead for 
Did you mean: 

Help need for integration ios


Hi,
This is first time I'm using authorize.net sdk with my iOS application.
I met some problem with building the static library. So I copied the source files to my project. Is it cause any problem?

My project is compiling and running fine but result is not as expected.

I have tried as in authorize.net website (https://developer.authorize.net/integration/fifteenminutes/ios/)

My try is like this

in viewDidload method

[AuthNet authNetWithEnvironment:ENV_TEST];

and in a inaction tried as follows

 MobileDeviceLoginRequest *mobileDeviceLoginRequest =
   [MobileDeviceLoginRequest mobileDeviceLoginRequest];
   mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.name = @"johnykuttymathew415";//my authorize.net loginID
   mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.password = @"Sacmetro123";//my authorize.net password for johnykuttymathew415
   mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.mobileDeviceId =
    [[[UIDevice currentDevice] uniqueIdentifier]
        stringByReplacingOccurrencesOfString:@"-" withString:@"_"];// this is deprecated

   AuthNet *an = [AuthNet getInstance];
   [an setDelegate:self];
   [an mobileDeviceLoginRequest: mobileDeviceLoginRequest];

and helper methods are

- (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";
     extendedAmountTypeTax.name = @"Tax";
    
     ExtendedAmountType *extendedAmountTypeShipping = [ExtendedAmountType extendedAmountType];
     extendedAmountTypeShipping.amount = @"0";
     extendedAmountTypeShipping.name = @"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;
     requestType.tax = 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
         NSLog(@"%s  ",__func__);
}

- (void) connectionFailed:(AuthNetResponse *)response {
     // Handle a failed connection
     NSLog(@"%s  ",__func__);
}

- (void) paymentSucceeded:(CreateTransactionResponse *) response {
    // Handle payment success
     NSLog(@"%s  ",__func__);
}

- (void) mobileDeviceLoginSucceeded:(MobileDeviceLoginResponse *)response {
     sessionToken = response.sessionToken;
    
    NSLog(@"%s  %@",__func__,sessionToken);
     [self createTransaction];
};

It gives log in console as
2013-02-14 18:34:54.794 Authorize.NetSample[3314:c07] Reachability Flag Status: -R -----l- networkStatusForFlags
2013-02-14 18:34:56.851 Authorize.NetSample[3314:c07] Mobile Device Login Response
2013-02-14 18:34:56.851 Authorize.NetSample[3314:c07] <?xml version="1.0" encoding="utf-8"?><mobileDeviceLoginResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00054</code><text>The mobile device is not registered with this merchant account.</text></message></messages></mobileDeviceLoginResponse>
namespace warning : xmlns: URI AnetApi/xml/v1/schema/AnetApiSchema.xsd is not absolute
ttp://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"
                                                                               ^
2013-02-14 18:34:56.852 Authorize.NetSample[3314:c07] Error = (null)
2013-02-14 18:34:56.853 Authorize.NetSample[3314:c07] Message:
Message.code = E00054
Message.text = The mobile device is not registered with this merchant account.
Message.description = (null)
2013-02-14 18:34:56.853 Authorize.NetSample[3314:c07] Messages:
Messages.resultCode = Error
Messages.message = (
    "Message.code = E00054\nMessage.text = The mobile device is not registered with this merchant account.\nMessage.description = (null)\n"
)
2013-02-14 18:34:56.854 Authorize.NetSample[3314:c07] MerchantContact = MerchantContact.merchantName = (null)
MerchantContact.merchantAddress = (null)
MerchantContact.merchantCity = (null)
MerchantContact.merchantState = (null)
MerchantContact.merchantZip = (null)
MerchantContact.merchantPhone = (null)
2013-02-14 18:34:56.854 Authorize.NetSample[3314:c07] MobileDeviceLoginResponse: MobileDeviceLoginResponse.anetApiResponse = ANetApiResponse.refId = (null)
ANetApiResponse.messages = Messages.resultCode = Error
Messages.message = (
    "Message.code = E00054\nMessage.text = The mobile device is not registered with this merchant account.\nMessage.description = (null)\n"
)


MobileDeviceLoginResponse.sessionToken = (null)
MobileDeviceLoginResponse.merchantContact = MerchantContact.merchantName = (null)
MerchantContact.merchantAddress = (null)
MerchantContact.merchantCity = (null)
MerchantContact.merchantState = (null)
MerchantContact.merchantZip = (null)
MerchantContact.merchantPhone = (null)

MobileDeviceLoginResponse.userPermissions = (
)
2013-02-14 18:34:56.855 Authorize.NetSample[3314:c07] -[ANSViewController requestFailed:]  


As in the developer community
I login to sandbox.authorize.net and navigated to the mobile device management

But there is no device with pending status


Can anybody help me

Please reply

johnykutty
Member
5 REPLIES 5

Hi,


You need to use “ MobileDeviceRegistrationRequest” the first time you use a new phone, so instead of using “LoginRequest” you need to register first. You need to use "MobileDeviceRegistrationRequest" once you use "MobileDeviceRegistrationRequest", the phone will show up for approval in the MINT then once you’re approved it, you’ll be able to use “MobileDeviceLoginRequest”
 

Thanks,
Joy

Joy
Administrator Administrator
Administrator

I m Trying To integrate authorize.net in ios, i registered Mobile Device Completely But I got Null Response on MobileDeviceLoginSucceed. what is reason Behind Getting Null Value..I"m Stuck at here,,

 

Reply..

Hey Did You Solved it, If Yes Then get back Reply me.......

 

I m Also Getting This Problem..and i m stuck At Here,,, 

 

Reply..

 

 

nikunj_iPhone
Member

why i Get null response on

MobileDeviceLoginResponse

 In integration Of authorize.net in ios..??????????????:(

 

This is a helpful post for this topic of Device Register and Login:

http://community.developer.authorize.net/t5/Integration-and-Testing/Problems-Registering-iOS-Device-...