USDK国内接入文档


支付与回调 pay

<p><strong>简要描述:</strong> </p> <ul> <li>SDK支付接口</li> </ul> <p><strong>调用方式:</strong></p> <ol> <li> <p>导入SDK类</p> <pre><code class="language-c">#import "ky_usdk/USDK.h"</code></pre> </li> <li> <p>注册回调监听器 重点说: 1&gt; 监听器不一定会监听到支付成功的回调, 部分渠道支付成功不给予回调, 2&gt; 请与服务端收到的支付状态为准,客户端支付结果仅供参考 </p> <pre><code class="language-c">[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(UsdkPayNotification:) name:nUSDKPayNotification object:nil];</code></pre> </li> <li>调用接口 <pre><code class="language-c">[[USDK shareManager]payForModel:payinfo];</code></pre></li> </ol> <p><strong>请求参数:</strong> </p> <p>以NSDictionary 封装参数数组</p> <table> <thead> <tr> <th>参数名</th> <th>数组类型</th> <th>参数说明</th> </tr> </thead> <tbody> <tr> <td>cpOrderId</td> <td>string</td> <td>游戏订单号</td> </tr> <tr> <td>serverId</td> <td>string</td> <td>区服ID</td> </tr> <tr> <td>serverName</td> <td>string</td> <td>区服名称</td> </tr> <tr> <td>productId</td> <td>string</td> <td>商品ID</td> </tr> <tr> <td>productName</td> <td>string</td> <td>商品名</td> </tr> <tr> <td>productdesc</td> <td>string</td> <td>商品简介</td> </tr> <tr> <td>productPrice</td> <td>string</td> <td>商品总价</td> </tr> <tr> <td>roleId</td> <td>string</td> <td>角色ID</td> </tr> <tr> <td>roleName</td> <td>string</td> <td>角色名</td> </tr> <tr> <td>ext</td> <td>string</td> <td>透传信息,支付成功之后回调至游戏后端的参数</td> </tr> </tbody> </table> <p><strong>请求示例:</strong> </p> <pre><code class="language-c"> NSDictionary *orderInfo = @{ @"key_cpOrderId": @"993052_UDGimQGt3m13299", @"key_serverId": @"55", @"key_serverName": @"纪元1服", @"key_productId": @"com.game.dl.ky.ios.60", @"key_productName": @"元宝", @"key_productdesc": @"元宝", @"key_ext": @"1_80127", @"key_productPrice": @"1", @"key_roleId": @"1234321", @"key_roleName": @"jacke", }; UGamePayInfo * payinfo = [[UGamePayInfo alloc]init]; payinfo.cpOrderId =orderInfo[@"key_cpOrderId"]; payinfo.serverId =orderInfo[@"key_serverId"]; payinfo.serverName =orderInfo[@"key_serverName"]; payinfo.productId =orderInfo[@"key_productId"]; payinfo.productName =orderInfo[@"key_productName"]; payinfo.productdesc =orderInfo[@"key_productdesc"]; payinfo.ext = orderInfo[@"key_ext"]; payinfo.productPrice =orderInfo[@"key_productPrice"]; payinfo.roleId =orderInfo[@"key_roleId"]; payinfo.roleName =orderInfo[@"key_roleName"]; [[USDK shareManager]payForModel:payinfo];</code></pre> <p><strong>返回示例</strong></p> <pre><code class="language-c">- (void) UsdkPayNotification:(NSNotification *)notification{ if ([notification.object isEqualToString:cNotificationSuccess]) { NSLog(@"支付成功"); }else { NSLog(@"支付失败 %@",notification.userInfo[@"msg"]); } }</code></pre> <p><strong>返回参数说明</strong> </p> <pre><code>无</code></pre> <p><strong>备注</strong> </p>

页面列表

ITEM_HTML