Integration Checklists

Use these step-by-step checklists to ease application integration when becoming an iPhone App Partner. There are two levels of integration:

  • Simple Request — Simple one-way call into Credit Card Terminal with no return to your application.
  • 2-Way Integration — Full 2-way integration, with transfer to Credit Card Terminal and return to your application when finished.

To get started, you should download the ChargeDemo sample, which includes the reusable IFChargeRequest and IFChargeResponse classes.

Simple Request Checklist

  1. Add the IFChargeRequest.h and IFChargeRequest.m files to your Xcode project. (Download)
  2. Request payment by creating an IFChargeRequest object, setting its properties, and calling its submit method. For example:
    IFChargeRequest* chargeRequest =
        [[[IFChargeRequest alloc] init] autorelease];
    
    chargeRequest.amount        = @"50.00";
    chargeRequest.description   = @"Test transaction";
    chargeRequest.invoiceNumber = @"321";
    
    [chargeRequest submit];

2-Way Integration Checklist

  1. Add the IFChargeRequest.h, IFChargeRequest.m, IFChargeResponse.h, and IFChargeResponse.m files to your Xcode project. (Download)
  2. Make sure your application is registered to handle a URL scheme in your Info.plist. For example:
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLName</key>
        <string>com.innerfence.ChargeDemo</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>com-innerfence-ChargeDemo</string>
        </array>
      </dict>
    </array>
    
  3. Request payment by creating an IFChargeRequest object, setting its properties, and calling its submit method. Be sure to set the returnURL property. Consider using setReturnURL:withExtraParams: to automatically include extra parameters in the query string. For example:
    IFChargeRequest* chargeRequest =
        [[[IFChargeRequest alloc] init] autorelease];
    
    // Include my record_id so it comes back with the response
    [chargeRequest
        setReturnURL:@"com-innerfence-ChargeDemo://chargeResponse"
        withExtraParams:[NSDictionary dictionaryWithObjectsAndKeys:
            @"123", @"record_id",
            nil
        ]
    ];
    
    chargeRequest.amount        = @"50.00";
    chargeRequest.description   = @"Test transaction";
    chargeRequest.invoiceNumber = @"321";
    
    [chargeRequest submit];
  4. Handle charge responses in your app delegate’s application:handleOpenURL: by creating an IFChargeResponse object using initWithURL:. Use the responseCode property to determine if the transaction was successful. For example:
    - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url
    {
        IFChargeResponse* chargeResponse =
            [[[IFChargeResponse alloc] initWithURL:url] autorelease];
    
        // My record_id from the request is available in the extraParams
        // dictionary.
        NSString* recordId = [chargeResponse.extraParams objectForKey:@"record_id"];
    
        // Since this value is from the URL, I need to validate it.
        if ( !IsValidRecordId( recordId ) )
        {
            // handle error
        }
    
        if ( chargeResponse.responseCode == kIFChargeResponseCodeApproved )
        {
            // Transaction succeeded, check out these properties:
            //  * chargeResponse.amount
            //  * chargeResponse.cardType
            //  * chargeResponse.redactedCardNumber
        }
        else
        {
            // Transaction failed.
        }
    }