Commit 1b0de771492b4a5decc4d3b7a3c7e3f810850d7e

Authored by 赵康
1 parent e9a2f24b35
Exists in master

增加iap支付

Showing 1 changed file with 26 additions and 4 deletions Side-by-side Diff

... ... @@ -3,12 +3,12 @@
3 3  
4 4 接入手册
5 5 V
6   -2015年02月13
  6 +2015年08月07
7 7  
8 8  
9 9  
10 10 ## 1、添加动态库
11   -在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a
  11 +在工程里添加MobileCoreServices.framework、SystemConfiguration.framework、libz.dylib、CFNetwork.framework、libletsgame.a、StoreKit.framework
12 12  
13 13  
14 14 ## 2、设置头文件搜索路径
... ... @@ -37,7 +37,7 @@ V
37 37 };
38 38  
39 39  
40   -## 5、支付
  40 +## 5、第三方支付
41 41 [LetsGameAPI instance].appId = @"10022";
42 42 [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
43 43 NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
... ... @@ -46,4 +46,26 @@ V
46 46 [payInfo setValue:@"10" forKey:@"amount"];//金额
47 47 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
48 48 [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
49   - [[LetsGameAPI instance] pay:payInfo];
50 49 \ No newline at end of file
  50 + [[LetsGameAPI instance] pay:payInfo];
  51 +
  52 +## 6、IAP支付
  53 +若要使用apple IAP支付,需要在AppDelegate的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  54 +方法内注册iap observer,使用如下方法
  55 +
  56 + [[LetsGameAPI instance] registeIapObserver];
  57 +具体调用iap支付的方法如下:
  58 +
  59 + [LetsGameAPI instance].appId = @"10022";
  60 + [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";
  61 + NSMutableDictionary *payInfo = [NSMutableDictionary dictionary];
  62 + [payInfo setValue:@"5001" forKey:@"serverId"];//当前用户所在的服务器Id
  63 + [payInfo setValue:@"10010" forKey:@"roleId"];//当前用户的角色id
  64 + [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id,用于统计
  65 + [payInfo setValue:@"10" forKey:@"amount"];//对应支付项的支付金额,实际支付金额以itunes配置为准
  66 + [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//扩展信息,可以游戏自定义,建议传自有订单号
  67 + [payInfo setValue:@"test.product.1" forKey:@"product"];//itunes 后台配置的对应支付项的productId
  68 + [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){
  69 + //此处的回调表明支付已经完成,但此时支付不一定成功,需要服务端验证支付结果
  70 + //orderId为gump生成的订单号,此订单号可以在gump server查询此笔支付是否成功
  71 + NSLog(@"iap completed orderId of gumptech:%@",orderId);
  72 + }];
51 73 \ No newline at end of file