CocoaPods Compatible Carthage Compatible License Platform Twitter

Judo Swift SDK for iOS

The judo Swift SDK is a framework for integrating easy, fast and secure payments inside your app with judo. It contains an exhaustive in-app payments and security toolkit that makes integration simple and quick. If you are integrating your app in Objective-C, we highly recommend you to use the judoKitObjC port.

Use our UI components for a seamless user experience for card data capture. Minimise your PCI scope with a UI that can be themed or customised to match the look and feel of your app.

***Due to industry-wide security updates, versions below 5.5.1 of this SDK will no longer be supported after 1st Oct 2016. For more information regarding these updates, please read our blog here.***

Requirements

This SDK requires Xcode 7.3 and Swift 2.2.

Getting started

Initial setup

  • Add import JudoKit to the top of the file where you want to use the SDK.

  • You can set your token and secret here when initializing the session:

// initialize the SDK by setting it up with a token and a secret
var judoKitSession = JudoKit(token: token, secret: secret)
  • To instruct the SDK to communicate with the Sandbox, include the following lines in the ViewController where the payment should be initiated:
// setting the SDK to Sandbox Mode - once this is set, the SDK wil stay in Sandbox mode until the process is killed
self.judoKitSession.sandboxed(true)
  • When you are ready to go live you can remove this line.

Invoking a payment screen

myJudoKitSession.invokePayment(judoID, amount: Amount(42, currentCurrency), reference: Reference(consumerRef: "consumer reference"), completion: { (response, error) -> () in
    self.dismissViewControllerAnimated(true, completion: nil)
    if let error = error {
        // if the user cancelled, this error is passed
        if error == JudoError.UserDidCancel {
            self.dismissViewControllerAnimated(true, completion: nil)
        }
        // handle error
        return // BAIL
    }
    if let resp = response, transactionData = resp.items.first {
    // handle successful transaction
    }
})

Next steps

Judo’s Swift SDK supports a range of customization options. For more information on using judo for iOS see our wiki documentation or API reference.