有什么作用?
BKM Express iOS SDK 包为用户提供了,无需离开工作应用即可完成与 BKMExpress 的支付,包括卡匹配、快速卡更换和安全的支付选项。
系统需求是什么?
- 支持 iOS 11.0 及以上版本。
- 支持 iPhone 设备。
如何工作?
为了使用 BKM Express iOS SDK 包,企业需要完成 BKM Express 的集成。然后,企业可以通过将提供的 TOKEN 作为参数传递给 SDK 提供的方法,将企业服务应用于 BKMExpress 核心服务以启动卡匹配、更换和安全的支付流程。
ORTAMLAR
卡匹配包在两个不同的环境中运行。
- PROD
- PREPROD
当启用调试模式时,SDK将连接到预生产环境。否则将连接到生产环境。
[vc setEnableDebugMode:YES];
注意:在集成期间提供给公司的密钥的责任属于公司。
IOS OBJECTIVE-C SDK INTEGRASYONU
-
使用以下命令,通过CocoaPods将SDK添加到项目中。
pod 'BKMExpressSDK', '1.2.12'
-
为了从BKMExpress SDK接口接收反馈,您需要根据您的流使用BKMExpressPairingDelegate、BKMExpressPaymentDelegate和BKMExpressOTPVerifyDelegate协议。
BKMExpressPairingDelegate
- (void)bkmExpressPairingDidComplete:(NSString *)first6Digits withLast2Digits:(NSString *)last2Digits; //Success
- (void)bkmExpressPairingDidCancel; //Cancel
- (void)bkmExpressPairingDidFail:(NSError *)error; //Fail
BKMExpressPaymentDelegate
- (void)bkmExpressPaymentDidCompleteWithPOSResult:(BKMPOSResult *)posResult; //Success
- (void)bkmExpressPaymentDidCancel; //Cancel
- (void)bkmExpressPaymentDidFail:(NSError *)error; //Fail
BKMExpressOTPVerifyDelegate
- (void)bkmExpressOTPVerified; //Success
- (void)bkmExpressOTPCanceled; //Cancel
- (void)bkmExpressOTPFailed:(NSError *)error; //Fail
示例Objective-C支付流程使用
#define PAYMENT_TOKEN @"Payment token will be given by BKM after the merchant integration"
@interface ViewController () <BKMExpressPaymentDelegate>
- (IBAction)tapPaymentButton:(id)sender {
BKMExpressPaymentViewController *vc = [[BKMExpressPaymentViewController alloc] initWithPaymentToken:PAYMENT_TOKEN delegate:self];
// YES:PreProd, NO:Prod
[vc setEnableDebugMode:YES];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:vc animated:YES completion:nil];
}
#pragma Payment delegate methods
- (void)bkmExpressPaymentDidCompleteWithPOSResult:(BKMPOSResult *)posResult{
NSLog(@"Successful payment");
}
- (void)bkmExpressPaymentDidFail:(NSError *)error{
NSLog(@"An error has occurred on payment = %@", error.localizedDescription);
}
- (void)bkmExpressPaymentDidCancel{
NSLog(@"Payment is canceled by user");
}
示例匹配流程使用
#define QUICK_PAY_TOKEN @"Quick pay token will be given by BKM after the merchant integration"
#define PAIRING_TICKET @"Ticket will be given by BKM after the merchant integration"
@interface ViewController () <BKMExpressPairingDelegate>
- (IBAction)tapPairButton:(id)sender {
BKMExpressPairViewController *vc = [[BKMExpressPairViewController alloc] initWithToken:QUICK_PAY_TOKEN delegate:self];
// YES:PreProd, NO:Prod
[vc setEnableDebugMode:YES];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:vc animated:YES completion:nil];
}
- (IBAction)tapChangeCardButton:(id)sender {
BKMExpressPairViewController *vc = [[BKMExpressPairViewController alloc] initWithTicket:PAIRING_TICKET withDelegate:self];
[vc setEnableDebugMode:NO];
[self presentViewController:vc animated:YES completion:nil];
}
#pragma Pairing delegate methods
- (void)bkmExpressPairingDidComplete:(NSString *)first6Digits withLast2Digits:(NSString *)last2Digits;{
NSLog(@"%@",[NSString stringWithFormat:@"it was paired successfully the card which first six digit is %@ and last two number is %@", first6Digits, last2Digits]);
}
- (void)bkmExpressPairingDidFail:(NSError *)error{
NSLog(@"An error has occurred on card pairing = %@",error.localizedDescription);
}
- (void)bkmExpressPairingDidCancel{
NSLog(@"Card pairing is canceled by user");
}
示例OTP快速支付验证流程使用
#define kOTP_PAYMENT_VERIFY_TICKET @"OTP Payment ticket will be given by BKM after the merchant integration"
@interface ViewController () <BKMExpressOTPVerifyDelegate>
- (IBAction)tapOTPPaymentButton:(id)sender {
BKMExpressOTPVerifyController *vc = [[BKMExpressOTPVerifyController alloc] initWithTicket:kOTP_PAYMENT_VERIFY_TICKET withDelegate:self];
// YES:PreProd, NO:Prod
[vc setEnableDebugMode:YES];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:vc animated:YES completion:nil];
}
#pragma Otp payment verification delegate methods
- (void)bkmExpressOTPVerified {
NSLog(@"Successful OTP payment verification");
}
- (void)bkmExpressOTPCanceled {
NSLog(@"OTP Payment verification is canceled by user");
}
- (void)bkmExpressOTPFailed:(NSError *)error {
NSLog(@"An error has occurred on payment = %@", error.localizedDescription);
}
iOS Swift SDK集成
-
使用以下命令,通过CocoaPods将SDK添加到项目中。
pod 'BKMExpressSDK', '1.2.12'
-
为了使用Objective-C开发的SDK,必须建立桥接。更多信息请访问以下地址:[链接](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html)
-
为了从BKMExpress SDK接收反馈,必须使用BKMExpressPairingDelegate和BKMExpressPaymentDelegate协议。
BKMExpressPaymentDelegate
- func bkmExpressPaymentDidComplete(with posResult: BKMPOSResult!); //Success
- func bkmExpressPaymentDidCancel(); //Cancel
- func bkmExpressPaymentDidFail(_ error: Error!) { //Fail
示例 SWIFT 支付流程使用
let kQUICK_PAY_TOKEN:String = "Quick pay token will be given by BKM after the merchant integration"
let kPAYMENT_TOKEN:String = "Payment token will be given by BKM after the merchant integration"
class ViewController: UIViewController , BKMExpressPaymentDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let instanceOfCustomObject: BKMExpressPaymentViewController = BKMExpressPaymentViewController(paymentToken: kPAYMENT_TOKEN, delegate: self)
// True:PreProd, False:Prod
instanceOfCustomObject.setEnableDebugMode(true)
instanceOfCustomObject.modalPresentationStyle = .fullScreen
self.present(instanceOfCustomObject , animated:true,completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func bkmExpressPaymentDidComplete(with posResult: BKMPOSResult!) {
NSLog("Successful payment with POS message")
}
func bkmExpressPaymentDidFail(_ error: Error!) {
NSLog("An error has occurred on payment %@", error.localizedDescription)
}
func bkmExpressPaymentDidCancel() {
NSLog("Payment is cancelled by user")
}