PayByBank SDK (iOS)
The Ecospend Gateway presents PayByBank SDK as an alternative and easier form of Open Banking Instant Payment solutions. PayByBank SDK provides you the option of downsizing the development effort for a PIS and AIS journeys to a single SDK integration. PayByBank undertakes all of interaction in the payment user journey with your branding on display.
Paylinkprovides to execute the payment order.FrPaymentprovides to execute a standing order.BulkPaymentprovides to execute the Bulk Payment order.VRPlinkprovides to execute the Variable Recurring Payments consent.Datalinkis a whitelabel consent journey solution provided by Ecospend that downsizes the required implementation for the consent journey to a single endpoint integration.Paymentprovides to execute the domestic instant payments, international payments, and scheduled payments.
Requirements
- iOS 11.0+
 - Swift 5.0+
 
Installation
CocoaPods
To integrate PayByBank into your Xcode project using CocoaPods, add this to your Podfile:
pod 'PayByBank', :git => 'https://github.com/ecospend/PayByBankSDK-iOS.git', :tag => '1.1.0'
# or
pod 'PayByBank', '1.1.0'
Then run pod install.
Swift Package Manager
User Interface
To integrate using Apple's Swift package manager, with Xcode integration, apply the following steps:
- File > Swift Packages > Add Package Dependency
 - Add 
https://github.com/ecospend/PayByBankSDK-iOS.git - Select "Dependency Rule" with "Exact Version" and "1.1.0"
 
Manually
To integrate using Apple's Swift package manager, without Xcode integration, add the following as a dependency to your Package.swift
.package(url: "https://github.com/ecospend/PayByBankSDK-iOS.git", from: "1.1.0")
Carthage
To integrate PayByBank into your Xcode project using Carthage, specify it in your Cartfile:
github "ecospend/PayByBankSDK-iOS" ~> 1.1.0
Then run carthage update --use-xcframeworks and drag the built PayByBank.xcframework bundle from Carthage/Build into the "Frameworks and Libraries" section of your application’s Xcode project.
Documentation
To get more information about PayByBank, check out the documentation.
Usage
Note: Please look at API Specifications & Developer's Guide for more details.
Onboarding
To start using our API, you need to onboard with us and get a Client Id (client_id) and Client Secret (client_secret) via email to [email protected]. For onboarding we will need the following information:
- The full name of your company/organization
 - An email address for your admin user (used as username)
 - A mobile phone number for the admin user (used for two-factor authentication)
 
Once onboarded, a Client Id is generated for you and you will have access to our Management Console, through which you can generate your Client Secret(s).
- The 
client_idis created by Ecospend when your organization is registered with us. - The 
client_secretis a security key that your administrator should create from the Management Console. This is not visible to or accessible by the Ecospend team. Therefore, you should store it safely. - The 
access_tokenis required for all subsequent requests to the API. You should keep it safe and secure during its lifetime. The lifetime is configurable. 
You will be given separate pairs of Client Id and Client Secret for our Sandbox and Production environments respectively. Ecospend does not store these parameters; therefore, you need to keep them safe and secure.
Sandboxenvironment should be used for testing purposes.Productionenvironment should be used for released applications.
Authentication
PayByBank SDK supports Client Credentials Flow and Token-Based Authentication to access Ecospend Gateway APIs.
-  
Client Credentials Flow:
PayByBank.configurefunction should be called once to accessclient_idandclient_secretbefore using APIs of PayByBank SDK. -  
Token-Based Authentication:
PayByBank.configurefunction should be called to accessaccess_tokenbefore using APIs of PayByBank SDK. Whenaccess_tokenis expired,PayByBank.configurefunction should be called again. To generateaccess_token, check out the Get Access Token documentation. 
PayByBank.configure(environment: <environment>, 
                    authentication: .clientCredentials(clientID: <client_id>, clientSecret: <client_secret>))
// or
PayByBank.configure(environment: <environment>, 
                    authentication: .token(<access_token>))
Sample Projects
We have provided a sample project in the repository. Source files for these are in the Examples directory in the project navigator.
License
PayByBank SDK is released under the Apache License.