支付寶、微信支付??https://github.com/SMARTSMALL/MobilePayDemo?
URL Schemes 配置如下

info.plist 白名單配置及網(wǎng)絡(luò)配置


ps. 支付集成及注意事項(xiàng) 均在LZMobilePayManager.h中 有提到
/************支付寶支付****************/
/*
1.導(dǎo)入(AlipaySDK.bundle AlipaySDK.framework)到項(xiàng)目文件庫下
2.在Build Phases選項(xiàng)卡的Link Binary With Libraries中,增加以下依賴:libc++.tbd、libz.tbd、SystemConfiguration.framework、CoreTelephony.framework、QuartzCore.framework、CoreText.framework、CoreGraphics.framework、UIKit.framework、Foundation.framework、CFNetwork.framework、CoreMotion.framework、AlipaySDK.framework
3.導(dǎo)入#import
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
if ([url.host isEqualToString:@"safepay"]) {
//支付跳轉(zhuǎn)支付寶錢包進(jìn)行支付,處理支付結(jié)果
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
NSLog(@"result = %@",resultDic);
if (resultDic) {
[[NSNotificationCenter defaultCenter]postNotificationName:@"AlipayNotification" object:selfuserInfo:resultDic];
}
}];
//授權(quán)跳轉(zhuǎn)支付寶錢包進(jìn)行支付,處理支付結(jié)果
[[AlipaySDK defaultService] processAuth_V2Result:url standbyCallback:^(NSDictionary *resultDic) {
NSLog(@"defaultService result = %@",resultDic);
//解析auth code
NSString *result = resultDic[@"result"];
NSString *authCode = nil;
if (result.length>0) {
NSArray *resultArr = [result componentsSeparatedByString:@"&"];
for (NSString *subResult in resultArr) {
if (subResult.length > 10 && [subResult hasPrefix:@"auth_code="]) {
authCode = [subResult substringFromIndex:10];
break;
}
}
}
NSLog(@"授權(quán)結(jié)果authCode = %@", authCode?:@"");
}];
}
}
return YES;
}
// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options
{
//支付跳轉(zhuǎn)支付寶錢包進(jìn)行支付,處理支付結(jié)果
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
if (resultDic) {
[[NSNotificationCenter defaultCenter]postNotificationName:@"AlipayNotification" object:selfuserInfo:resultDic];
}
NSLog(@"result = %@",resultDic);
}];
//授權(quán)跳轉(zhuǎn)支付寶錢包進(jìn)行支付,處理支付結(jié)果
[[AlipaySDK defaultService] processAuth_V2Result:url standbyCallback:^(NSDictionary *resultDic) {
NSLog(@"defaultService==result = %@",resultDic);
//解析auth code
NSString *result = resultDic[@"result"];
NSString *authCode = nil;
if (result.length>0) {
NSArray *resultArr = [result componentsSeparatedByString:@"&"];
for (NSString *subResult in resultArr) {
if (subResult.length > 10 && [subResult hasPrefix:@"auth_code="]) {
authCode = [subResult substringFromIndex:10];
break;
}
}
}
NSLog(@"授權(quán)結(jié)果authCode = %@", authCode?:@"");
}];
}
return YES;
}
4.、點(diǎn)擊項(xiàng)目名稱,點(diǎn)擊“Info”選項(xiàng)卡,在“URL Types”選項(xiàng)中,點(diǎn)擊“+”,在“URL Schemes”中輸入“alisdkdemo”。“alisdkdemo”來自于文件“APViewController.m”的NSString *appScheme = @“alisdkdemo”;。
注意:這里的URL Schemes中輸入的alisdkdemo,為測試demo,實(shí)際商戶的app中要填寫?yīng)毩⒌膕cheme,建議跟商戶的app有一定的標(biāo)示度,要做到和其他的商戶app不重復(fù),否則可能會導(dǎo)致支付寶返回的結(jié)果無法正確跳回商戶app。
5.注意'openssl/asn1.h' file not found在Build Setting下Header search paths添加"$(SRCROOT)/工程名/文件夾"
6.注意如果出現(xiàn)【rsa_private read error : private key is NULL】
1.修改RSADataSigner中方法formatPrivateKey中
[result appendString:@"-----BEGIN PRIVATE KEY-----\n"];
[result appendString:@"\n-----END PRIVATE KEY-----"];
為
[result appendString:@"-----BEGIN RSA PRIVATE KEY-----\n"];
[result appendString:@"\n-----END RSA PRIVATE KEY-----"];
2.
檢查提供是私鑰是否正確*/
如何使用 LZMobilePayManager?

ps. 后面有時(shí)間集成銀聯(lián)支付功能