Time is Money

Integrate payments in your site in 15 minutes or less.

Simply create a test account and your site accepts payments in 15 minutes or less. No matter what language you're working in.

  • The Apple iOS and Android SDKs use the Advanced Integration Method (AIM) XML API.
  • Step 1:Sign up for a Test Account.

    Sign up for a test account to obtain a Merchant Interface Login ID and Password. These will allow you to authenticate and make requests to the payment gateway with a session token.

  • Step 2: Download the Authorize.Net iOS SDK and include it in your project.

    The Authorize.Net iOS SDK gives you access to the full suite of APIs.

    Download the SDK

    Include all the header files and static library in your project.

    In your project settings:

    • Set your Library Search Paths with the path that contains the "Authorize.Net SDK" library. (ex. "$(SRCROOT)/ANMobilePaymentLib").
    • Set your Other Linker Flags with "-lxml2" to allow for xml parsing.
    • Set your Header Search Paths with the path that contains "libxml2" header files. (ex. "/usr/include/libxml2" with recursive checked).

    In order to help test for reachability on your device, you'll need to include the "SystemConfiguration.framework." From the Project Settings, go to the "Build Phases" tab and expose the "Link Binary With Libraries" section. Click the "+" button, select "SystemConfiguration.framework" and click "Add." The framework will be added to your project, which you may move to the "Frameworks" folder.

  • Step 3: Create a new class that sends a transaction to the payment gateway.

    Copy the code snippet below into your source file in XCode. Create a variable named "sessionToken" to store the session token and add your test credentials where <USERNAME> and <PASSWORD> are currently present. Then call the loginToGateway method from the appropriate class.

    The example below is a minimal example of how to create and submit a transaction using the SDK:

    - (void) loginToGateway {     MobileDeviceLoginRequest *mobileDeviceLoginRequest =         [MobileDeviceLoginRequest mobileDeviceLoginRequest];     mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.name = <USERNAME>;     mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.password = <PASSWORD>;     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";     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 } - (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]; };

  • Step 4: Authorize your device.

    The first time you execute this sample code from a new device (either real or virtual), you will notice that the loginToGateway call fails and states that the device has been registered but is pending approval. You will need to login to the sandbox (https://test.authorize.net/) and enable the new device. You can find this by going to:

    Home > Account (Settings) > Security Settings (Mobile Device Management)

    Once there, you should see your new device in a "Pending" state. Click on the new device and enable it.

    Execute the above sample code again and the transaction should succeed.

  • Step 5: Verify the transaction is processed.

    Screenshot Transaction

    Verify payment transaction success on your transaction report.

  • Learn More