微信支付IOS集成流程
1,官方帮助文档:https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1
2,下载SDK
3,修改IOS配置:在Build Phases选项卡的Link Binary With Libraries中,增加以下依赖
libz.tbd
libsqlite3.0.tbd
SystemConfiguration.framework
CoreTelephony.framework
QuartzCore.framework
libWeChatSDK.a4,注册APP:修改AppDelegate文件
class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
......
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.initWeixinPay()
return true
}
func onResp(_ resp: BaseResp!) {
var strMsg = "\(resp.errCode)"
Logger.debug(strMsg)
if resp.isKind(of: PayResp.self) {
switch resp.errCode {
case 0 :
NotificationCenter.default.post(name: PayHelper.Notification_WX_Result, object: nil)
case -2:
strMsg = "您已取消支付,请尽快完成支付"
default:
strMsg = "支付失败:\(resp.errStr)"
Logger.debug("retcode = \(resp.errCode), retstr = \(resp.errStr)")
}
}
if resp.errCode != 0{
let alert = UIAlertView(title: nil, message: strMsg, delegate: nil, cancelButtonTitle: "好的")
alert.show()
}
}
func initWeixinPay(){
WXApi.registerApp(GlobalConstant.WX_APP_ID, withDescription: "APP描述")
}5,注册Schema:图片来源微信官网

支付宝IOS集成
相关推荐
znbvx 2020-11-13
Dayer 2020-10-27
taiyangyu 2020-09-10
且听真言 2020-06-08
齐天大圣数据候 2020-05-16
郴州小程序 2020-04-20
zengfanpei 2020-02-17
xumengfang 2019-12-16
xiaonao00 2020-01-24
cbao 2020-01-01
xiaonao00 2019-12-18
gfgy 2019-11-12
xiaonao00 2019-10-31
zengfanpei 2019-11-02
CCVOTF 2019-10-29
qzzza 2013-11-29
zhihuzheya 2019-09-08
bruceli 2018-11-26