BKMoneyKit is a comprehensive framework that simplifies integration with BK Money platform, allowing developers to easily incorporate various payment methods, wallets, and transactions into their iOS applications. This documentation will guide you through the process of installing and using BKMoneyKit, providing detailed instructions on integrating its features within your app.
Installation
To begin using BKMoneyKit in your iOS project, follow the steps below:
- Open your Xcode project.
- Navigate to your project’s File menu and select Add Files to “Your Project Name”.
- Locate the BKMoneyKit.framework file you downloaded and select it.
- Ensure that Copy items if needed is checked and click Add.
- Open your project’s target settings.
- Click on the General tab and scroll down to the Frameworks, Libraries, and Embedded Content section.
- Click the ‘+’ button and select BKMoneyKit.framework from the list.
- Make sure that the framework is linked both under Frameworks, Libraries, and Embedded Content and Link Binary With Libraries.
- Now you can import BKMoneyKit into your project by adding the following import statement wherever needed:
import BKMoneyKit
Configuration
Before using BKMoneyKit, you need to configure it properly in your app’s delegate. Follow the steps below to set up the necessary configurations:
- In your app delegate file, import the BKMoneyKit framework:
- In the
application(_:didFinishLaunchingWithOptions:)
method, configure BKMoneyKit with your API key: - Replace
YOUR_API_KEY
with your actual API key obtained from BK Money platform. - BKMoneyKit is now ready to be used within your application.
// Swift
import BKMoneyKit
// Objective-C
@import BKMoneyKit;
// Swift
BKMoneyKit.configure(apiKey: "YOUR_API_KEY")
// Objective-C
[BKMoneyKit configureWithApiKey:@"YOUR_API_KEY"];
Usage
BKMoneyKit provides various features to facilitate payment integration in iOS applications. Below, you will find detailed explanations and examples of how to use some of its key functionalities.
Payment Methods
BKMoneyKit offers a convenient interface for retrieving and managing available payment methods. Follow the steps below to get started:
- Create an instance of
BKPaymentManager
: - To fetch available payment methods, call the
fetchPaymentMethods(completion:)
method: - Once you have the list of payment methods, you can then use them for various payment-related operations.
// Swift
let paymentManager = BKPaymentManager()
// Objective-C
BKPaymentManager *paymentManager = [[BKPaymentManager alloc] init];
// Swift
paymentManager.fetchPaymentMethods { result in
switch result {
case .success(let paymentMethods):
// Handle retrieved payment methods
case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
// Objective-C
[paymentManager fetchPaymentMethods:^(NSArray * _Nullable paymentMethods, NSError * _Nullable error) {
if (paymentMethods) {
// Handle retrieved payment methods
} else {
NSLog(@"Error: %@", error.localizedDescription);
}
}];
Wallets
BKMoneyKit provides functionality for managing user wallets. To perform operations related to wallets, follow the steps below:
- Create an instance of
BKWalletManager
: - To fetch user wallets, call the
fetchWallets(completion:)
method: - Now, you can utilize the fetched wallets for various wallet management operations, such as adding, deleting, or updating existing wallets.
// Swift
let walletManager = BKWalletManager()
// Objective-C
BKWalletManager *walletManager = [[BKWalletManager alloc] init];
// Swift
walletManager.fetchWallets { result in
switch result {
case .success(let wallets):
// Handle retrieved wallets
case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
// Objective-C
[walletManager fetchWallets:^(NSArray * _Nullable wallets, NSError * _Nullable error) {
if (wallets) {
// Handle retrieved wallets
} else {
NSLog(@"Error: %@", error.localizedDescription);
}
}];
Transactions
BKMoneyKit simplifies transaction handling within your iOS app. The steps below outline how to perform transaction-related operations:
- Create an instance of
BKTransactionManager
: - Retrieve a list of transactions using the
fetchTransactions(completion:)
method: - Perform necessary operations on the fetched transactions, such as filtering, sorting, or displaying them within your application.
// Swift
let transactionManager = BKTransactionManager()
// Objective-C
BKTransactionManager *transactionManager = [[BKTransactionManager alloc] init];
// Swift
transactionManager.fetchTransactions { result in
switch result {
case .success(let transactions):
// Handle retrieved transactions
case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
// Objective-C
[transactionManager fetchTransactions:^(NSArray * _Nullable transactions, NSError * _Nullable error) {
if (transactions) {
// Handle retrieved transactions
} else {
NSLog(@"Error: %@", error.localizedDescription);
}
}];
Conclusion
Congratulations! You now have a solid understanding of how to integrate BKMoneyKit into your iOS application. This documentation has covered installation, configuration, and usage of key features provided by BKMoneyKit. Utilize the power of this framework to seamlessly incorporate payment methods, wallets, and transactions into your app with ease!