Reply
Highlighted
Member
Posts: 1
Registered: ‎06-05-2019

in person ios sdk . Invalid input error code 18

Hey

I was able to login successfully, however when i try to charge an account, i keep getting
Error Code
Transaction failed, invalid input.
Error Code 18

Code
-(void)mobileDeviceLoginSucceeded:(MobileDeviceLoginResponse *)response{
NSString *sessionToken=[response sessionToken];
KioskUtils *myUtils=[[KioskUtils alloc]init];
NSMutableDictionary *tableDict=[[[NSUserDefaults standardUserDefaults] objectForKey:@"ticketData"] mutableCopy];
NSString *totalStr=@"0.01";
NSString *tipAmtStr=@"0.01";
NSString *taxAmtStr=@"0.00";
AnetEMVManager *manager= [AnetEMVManager initWithCurrecyCode:@"USD" terminalID:@"xxxxxx" skipSignature:TRUE showReceipt:FALSE];
[manager setLoggingEnabled:TRUE];
[manager setTerminalMode:AnetEMVModeInsertOrSwipe];
LineItemType *lineItem=[LineItemType lineItem];
[lineItem setItemName:@"Test"];
[lineItem setItemID:@"1"];
[lineItem setItemQuantity:@"1"];
AnetEMVTransactionRequest *request=[AnetEMVTransactionRequest transactionRequest];
NSMutableArray *lineItems=[NSMutableArray new];
[lineItems addObject:lineItem];
[request setLineItems:lineItems];
ANetApiRequest *apiRequest=[ANetApiRequest anetApiRequest];
MerchantAuthenticationType *auth=[MerchantAuthenticationType merchantAuthentication];
[auth setSessionToken:sessionToken];
[auth setMobileDeviceId:[myUtils getMacAddress]];

[apiRequest setMerchantAuthentication:auth];
[request setAnetApiRequest:apiRequest];
int r = arc4random_uniform(1000000000) + 1;
OrderType *orderType=[OrderType order];
[orderType setInvoiceNumber:[NSString stringWithFormat:@"%d",r]];
[orderType setOrderDescription:@"test description"];
[request setOrder:orderType];
[request setAmount:totalStr];
ExtendedAmountType *tip=[ExtendedAmountType extendedAmountType];
[tip setAmount:tipAmtStr];
[tip setName:@"tip"];
ExtendedAmountType *tax=[ExtendedAmountType extendedAmountType];
[tax setName:@"tax"];
[tax setAmount:taxAmtStr];
//[request setTip:tip];
//[request setTax:tax];
[request setEmvTransactionType:EMVTransactionType_Payment];
[manager setConnectionMode:AnetEMVConnectionModeBluetooth];

[manager startQuickChipWithTransactionRequest:request forPaperReceiptCase:false presentingViewController:self completionBlock:^(AnetEMVTransactionResponse * _Nullable response, AnetEMVError * _Nullable error) {
if([response isTransactionSuccessful]){
................
}
}else{
NSLog(@"failed ..");
}
} andCancelActionBlock:^{
NSLog(@"failed ..");
}];

}