Banked iOS SDK

The Banked iOS SDK is a Swift based, CocoaPod deployed embedded checkout for use within your native iOS application. It offers an interface for processing a PaymentSession created using the Banked API.

You can find the SDK code here.


Use Cocoapods to install the Banked Checkout SDK.

To integrate Banked Checkout SDK into your Xcode project using CocoaPods, specify it in your Podfile:

pod ‘Banked’

1. Setting up Universal Links for callbacks

Once a user has selected a bank from the list in the Checkout, they are re-directed to the Bank's Application (if installed) or website to authorise the payment. After authorisation is complete (or fails) we need to return the user to your application via a URL you provide - currently we support this via Universal Links or URL schemes.

The reason we recommend Universal Links is that the PaymentSession could be processed in an iOS app via the Checkout, or potentially on desktop (e.g. if you have a web version) - Universal Links mean that you can handle both scenarios as you see fit.

After payment authorisation, the user will be redirected to their default browser to a URL. Once Banked have received a payment status notification from the bank (this usually happens instantaneously, but in some cases can take a few seconds), the user is redirected to the Universal Link provided, which will open the original app back up.

We are aware of some edge cases where Universal Links may not work as expected - for example, if Chrome is set as a default browser on the user's iPhone. For that reason, we recommend hosting a page with a "Click here to continue" button on your Universal Link, that leads to your app. In the unlikely case that the universal link does not open the app, the user will be able to continue their journey.

Once you set up Universal Links, the app can handle the incoming callback appropriately.

Please find more details about setting up Universal Links in the Apple Developer Documentation.

2. Importing the Library

After installing the pod, import the library.

@import Banked

3. Initialising the Banked Checkout

Depending on whether you are implementing a test or production checkout, enter the appropriate client key found in the Banked Console:

BankedCheckout.shared.setUp(clientKey: "CLIENT KEY")

4. Generating a PaymentSession

Use the Banked API to create a PaymentSession. Please read the API documentation for more detail - Banked API - Generating a Payment Session

You do not need to provide the callback URLs when creating the PaymentSession - this will be handled in the next step when presenting your checkout to the user.


Pre-filling the user's name and email

If you are able to, pre-fill the payer's details! This reduces the number of steps the user needs to take when completing the checkout, and for returning users, the user's previous bank selection and consent will be pre-filled too - so all the user will need to do is to click the authentication button!

5. Presenting the Banked Checkout for your Payment Session

Present the checkout over a specified ViewController.

BankedCheckout.shared.presentCheckout(self, paymentId: "PAYMENT ID", action: .pay, continueURL: ""){ (response) in
    switch response {
        case .success:
            // Handle success
        case .failure(let error):
            // Handle failure with error

You must provide a PAYMENT ID which is part of the PaymentSession you created via the API. This is used to retrieve the correct details for the Checkout.

Depending on network speed, the retrieval of the PaymentSession will take a few moments before the User Interface is presented. We provide a delegate method bankedCheckoutIsLoading(_ isLoading: Bool) which returns the loading status - you can use this to present/hide a loading interface before the Checkout appears

The action is a PaymentAction which is used to customise the Checkout appropriately - for example the copy used to describe the purpose/intent of the payment. The four available options are: pay, donate, send and transfer.

You will also need to specify a continueURL - this will be used to redirect your users to once the payment has succeeded or failed.


Setting the continueURL

continueURL base URL must match the URL you have set in your app builder.
This can be found in XCode by going to Project -> Target -> URL Types

The completion block returns a CheckoutResponse when the Checkout is either a success or failure. The failure response will contain a BankedCheckoutError which contains more detail as to why the error occurred.

6. Handling callbacks after bank authorisation

Your Universal Links will automatically open the app after you leave the bank authorisation flow, and you need to handle this within the App Delegate. In the example below the callback URL set on the PaymentSession was

Once a user is redirected back into your app after payment authorisation, retrieve the URL they were redirected on, and pass it to BankedCheckout.shared.handlePaymentWithId("REDIRECT_URL", .pay). The second argument is the payment action that was specified in step 5.

BankedCheckout.shared.handlePaymentWithURL(url, action: .pay)  { response in
    switch response {
        case .success:
            // Handle success
        case .failure(let error):
      // Handle failure with error

7. Optional - Setting up a Delegate for the BankedCheckout

Your can adopt the BankedCheckoutDelegate protocol and assign a delegate. There is a single method which indicates the 'loading' status of the Checkout while it retrieves the PaymentSession.

Supported iOS versions

Banked iOS SDK is supported on iOS versions 13 and higher.