An iOS SDK that provides a ViewController for accessing the MasterCard Simplify Service. Download the framework here.
Simplify
- iOS Library Project containing SDK codeSimplifyExample
- an iOS Application utilizing the SDKSimplifyTests
- unit tests for the library
In order to build the Documentation, simply fun the SimplifyFramework Scheme from XCode. This will build a universal framework and bundle for use in your project.
Once the script is done, a Finder window will open granting access to the built products.
In order to build the Documentation for the public API, simply run the Documentation Scheme from XCode. This will automatically install the docset, so that XCode can utilize it.
To install the API in your app, copy the Simplify.framework
and Simplify.bundle
to your project.
Add both to your app target.
Use the SIMCreditCardEntryViewController
in your application, and accept delegate callbacks from it
to obtain a SIMCreditCardToken
. This token must be used in conjunction with one of the hosted
solutions documented on the Simplify website to create
and process a transaction.
Here is a way to submit the token using POST to your server from the app.
NSString *token = creditCardToken.token;
NSLog(@"Token: %@", token);
NSURL *url= [NSURL URLWithString:@"https://Your_server/charge.rb"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSString *postString = @"simplifyToken=";
postString = [postString stringByAppendingString:token];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request
delegate:self];
For example, in ruby, this token might be used server-side in the following manner:
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
payment = Simplify::Payment.create({
"token" => "<TOKEN ACQUIRED BY SIMPLIFY IOS SDK>",
"amount" => 1000,
"currency" => "USD",
"description" => "Description"
})
if payment['paymentStatus'] == 'APPROVED'
puts "Payment approved"
end
The SIMCreditCardEntryViewController
can be used for entering credit card and user mailing address
details for a transaction. Whether or not to include a mailing address form is controlled by the
view controller's initializer showAddressView
parameter. See below example screenshots of the
card entry interface with and without a mailing address form. As a convenience, the view controller
performs some (but not necessarily a full-proof) validation of the items entered.
The SIMCreditCardToken
is issued to the user by SIMCreditCardEntryViewController
to the assigned
SIMCreditCardEntryViewControllerDelegate
via receivedCreditCardToken:error
when credit card information
has been successfully processed and a token is generated, otherwise an NSError
is returned. When a
user cancels entry, the delegate's tokenGenerationCancelled
is invoked.
To access the actual token value, for use in the server side API, refer to the token
member of the
returned SIMCreditCardToken
object.