1. Add iOS Framework

2. Collect Card Information

3. Create a Card Token

Create a card token and then follow through with the examples to make a payment on your server.

The iOS SDK by CommBank Simplify allows you to create a card token (one time use token representing card details) in your iOS app to send to a server to enable it to make a payment. By creating a card token, CommBank Simplify allows you to avoid sending card details to your server. The SDK can help with formatting and validating card information before the information is tokenised.

These three easy steps will allow you to collect card information, retrieve a card token from CommBank Simplify with the card information, and send the card token to your server in order to charge a card.

1. Add iOS Framework

Add Framework and Bundle to your project

Download the Simplify.Framework and Simplify.bundle and add both of these to your project. Add (Cmd+Option+A) them to your "Frameworks" grouping in XCode and then ensuring that only your build target is selected in "Add to targets" as in the following screenshot.
Make sure you have selected "Copy items into destination group's folder".

2. Collect Card Information

Setting API keys

To set your public API key, you need to instantiate a SIMChargeCardViewController, sign up for the SIMChargeCardViewControllerDelegate
protocol and set the SIMChargeCardViewController's delegate. The sample app includes a SIMProductViewController that does all of this. Simply Run (Cmd+R) the "SimplifySDKSampleApp" Scheme. But, you can use any UIViewController
subclass as well, by copying and pasting the following Class.

The SDK will determine Live or Sandbox mode based upon the public key.

Collecting Card Information With SIMChargeCardViewController

You can use SIMChargeCardViewController in order to collect card information in your iOS app. There are validations on each of the fields, and the background of each field will turn green if valid or
red if invalid (ex. an expiration date in the past will have a red field). The submit button will not be enabled unless the credit card number and the expiration date are both valid.

3. Create a Card Token

Create a single-use token

Once the user fills in the form and taps Charge Card, you will receive a callback describing the transaction where the token was created. This removes the burden of storing
or processing credit card details from you as a merchant. In order to prevent possible security issues, you should never store or attempt to reuse this single-use token.

All of the work of gathering information about the user, validating the inputs, creating the request to CommBank Simplify and submitting it is handled for you by the SDK. You simply need to implement the above
method and you will receive the SIMCreditCardToken in the callback. If you would like to access the API directly, follow the the Manual Card Token generation instructions
if you'd like to see how the Card Token is actually requested.

Charging a Card

The example below shows how to handle three callbacks relating to tokens in SIMProductViewController, but you can implement these three callbacks in your own view controller. The first callback, chargeCardCancelled, is called
if the user cancels inputting card details in the SIMChargeCardViewController. The controller will dismiss itself and then call this method.

You can charge a card by submitting a card token generated by the iOS SDK to your own server running one of the CommBank Simplify SDKs to create a Charge. The third callback (creditCardTokenProcessed) shows an
example of how to send a token to your server for payment processing. If there is an error in payment processing, you should alert your user to the failure. If the payment was a success, you can return the user to another workflow.

You will need to implement the details to send the request to your server and process the payment. Your server will need an endpoint that can receive a card token so that you can use the token to make a charge.