微信支付流程(IOS)

微信支付流程(IOS)


1.注册微信开发账号,开通支付权限(注册谁都会了)


2.把三个文件拉进去

libWeChatSDK.a
WXApi.h
WXApiObject.h

3.添加URL Types

技术分享


4.AppDelegate.m中添加微信账号

[
WXApi
registerApp
:
@”wxalsdfjalsfals”
withDescription
:
@”tencent

];
回调
– (
BOOL
)application:(
UIApplication
*)application handleOpenURL:(
NSURL
*)url {
   

return
  [
WXApi
handleOpenURL
:url
delegate
:
self
];
}

– (
BOOL
)application:(
UIApplication
*)application openURL:(
NSURL
*)url sourceApplication:(
NSString
*)sourceApplication annotation:(
id
)annotation {
   

return
  [
WXApi
handleOpenURL
:url
delegate
:
self
];
}

– (
void
)onResp:(
BaseResp
*)resp {
   

if
([resp
isKindOfClass
:[
PayResp
class
]]) {
       

PayResp
*response = (
PayResp
*)resp;
       

switch
(response.
errCode
) {
           

case
WXSuccess
:
               

NSLog
(
@”suceess”
);
               

break
;
           

default
:
               

NSLog
(
@”failed”
);
               

break
;
        }
    }

}

5.调用的文件

https://github.com/wuxueying/weixin

版权声明:本文为博主原创文章,未经博主允许不得转载。