From 1b0de771492b4a5decc4d3b7a3c7e3f810850d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BA=B7?= Date: Fri, 7 Aug 2015 14:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0iap=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/IOSDocument.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/doc/IOSDocument.md b/doc/IOSDocument.md index 1f01480..ab7ae00 100644 --- a/doc/IOSDocument.md +++ b/doc/IOSDocument.md @@ -3,12 +3,12 @@ 接入手册 V -2015年02月13日 +2015年08月07日 ## 1、添加动态库 -在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a +在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a、StoreKit.framework ## 2、设置头文件搜索路径 @@ -37,7 +37,7 @@ V }; -## 5、支付 +## 5、第三方支付 [LetsGameAPI instance].appId = @"10022"; [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd"; NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; @@ -46,4 +46,26 @@ V [payInfo setValue:@"10" forKey:@"amount"];//金额 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息 - [[LetsGameAPI instance] pay:payInfo]; \ No newline at end of file + [[LetsGameAPI instance] pay:payInfo]; + +## 6、IAP支付 +若要使用apple IAP支付,需要在AppDelegate的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +方法内注册iap observer,使用如下方法 + + [[LetsGameAPI instance] registeIapObserver]; +具体调用iap支付的方法如下: + + [LetsGameAPI instance].appId = @"10022"; + [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; + NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; + [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id + [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id + [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计 + [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准 + [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号 + [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId + [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ + //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果 + //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功 + NSLog(@"iap completed orderId of gumptech:%@",orderId); + }]; \ No newline at end of file -- 2.0.0