cancel
Showing results for 
Search instead for 
Did you mean: 

Void Transaction - AIM on iOS

I'm trying to void an existing AUTH_CAPTURE transaction on an iOS device using the transaction ID and it is failing. I can't find what the minimum required fields are to void a transaction. I've tried just creating a TransactionRequestType and setting the refTransID and authCode and set the TransactionRequestType object to a CreateTransactionRequest object, and it said the credit card field was invalid. So I added the payment type and set the card number and expiration date and now the error is this:

 

element is invalid - The value '' is invalid according to its datatype 'String' - The Pattern constraint failed.

 

Please help!

socaljoker
Member
4 REPLIES 4

Here is the minimum required fields.

http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=A_TransTypeFields.h...

The credit card info is not required for a void transaction.

RaynorC1emen7
Expert

Below is the code I'm using to set the minimum required fields, and it's still giving me a weird error. It's saying that the credit card field is invalid, but I never even created a credit card type or anything.

 

AuthNet *an = [AuthNet getInstance];

 

TransactionRequestType *requestType = [TransactionRequestType transactionRequest];

requestType.refTransId = self.transactionID;

 

CreateTransactionRequest *request = [CreateTransactionRequest createTransactionRequest];
request.transactionRequest = requestType;
request.transactionType = VOID;
request.anetApiRequest.merchantAuthentication.mobileDeviceId = [[[Device currentDevice] uuid] stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
request.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;

 

[an voidWithRequest:request];

 

Also, if I look at the XML that is being auto generated, it doesn't even include the transaction type or the transaction ID in the XML:

 

<?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><sessionToken>HZyvKhGAIfX4VR4jF_bT_jLgqfb5rsEFq$zeWhUdLfS3iC6SciKX6QN5PkjTM5CNx94WJCA9Dhgp4hxOnewePYsxooYHxi_qxPiqBlA56iFLz9WbdsfPBv8ezTb1w$axA$hSiejcAOm9Mj0UsY9r7gAA</sessionToken><mobileDeviceId>33B1555A_60BC_4117_9314_FDB570607A76</mobileDeviceId></merchantAuthentication><transactionRequest><payment><creditCard></creditCard><bankAccount></bankAccount><trackData></trackData></payment><order></order><lineItems></lineItems><customer></customer><billTo></billTo><shipTo></shipTo><transactionSettings></transactionSettings><userFields></userFields></transactionRequest></createTransactionRequest>

I got it to include the transaction type "voidTransaction" and the refTransID, and it's still telling me that the credit card field is invalid.

I FINALLY got it to work! You have to specify that the payment object is nil. I'm not sure if I needed to do the others or not, but I did it anyway.

 

AuthNet *an = [AuthNet getInstance];

TransactionRequestType *requestType = [TransactionRequestType transactionRequest];

requestType.payment = nil;
requestType.tax = nil;
requestType.duty = nil;
requestType.shipping = nil;
requestType.transactionType = @"voidTransaction";
requestType.refTransId = self.referenceNumber;
requestType.authCode = self.authCode;


CreateTransactionRequest *request = [CreateTransactionRequest createTransactionRequest];
request.transactionRequest = requestType;
request.transactionType = VOID;
request.anetApiRequest.merchantAuthentication.mobileDeviceId = [[[Device currentDevice] uuid] stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
request.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;

[an voidWithRequest:request];