iOS接入说明
导入Framework:
导入SDPWalletOpenSDK.framework和SDPResource.bundle
依赖第三方如下:
FMDB、 Masonary、SDWebImage、NJKWebViewProgress、OpenSSL-Universal、Reachability、MJRefresh
集成方法、参数说明:
在进入钱包之前在进入钱包的任何位置、任何地方设置一下参数
#import <SDPWalletOpenSDK/SDPWalletOpenSDK_WF.h> 通过SDPWalletOpenSDK_WF 调用以下方法
/**
获取钱包sdk版本号
*/
+ (NSString *)version;
/**
设置盛付通钱包环境
@param envType环境类型
*/
+ (void)setWalletEnvType:(SDPWalletSDKEnvType)envType;
/**
钱包初始化
@param appID 钥匙appID
*/
+ (void)setAppID:(NSString *)appID;
/**
唤起钥匙登录
*/
+(void)setLoginBlock:(void(^)(void))loginBlock;
/**
唤起钥匙登录(弱登录)
*/
+(void)setWeakLoginBlock:(void(^)(NSDictionary *sourceDict, NSDictionary *objectDict))weakLoginBlock;
/**
登录成功*/
+(void)loginSuccess;
/**
登录失败*/
+(void)loginFailure;
/**
登录取消*/
+(void)loginCancel;
支付接口调用
1.请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
appId | 应用ID | Y | String(32) | ||
mchId | 商户号 | Y | String(20) | ||
prepayId | 预支付Id | Y | String(32) | 连信端从服务器获取 | |
nonceStr | 随机字符串 | Y | String(32) | ||
timestamp | 时间戳 | Y | String(32) | 系统时间精确到秒,10位数字 | |
signType | 加签类型 | Y | String(10) | RSA | 目前只支持:RSA |
sign | 签名 | Y | String(1000) | 加签方式参考:请求加签说明 |
2.传参事例
//初始化订单账号
SDPOrderInfo *orderInfo = [[SDPOrderInfo alloc] init];
/** 应用ID */
orderInfo.appId = @"fdji3ro29k";
/** 商户号 */
orderInfo.mchId = :@ "93745648";
/** 预支付Id */
orderInfo.prepayId = @ "WP102513295386841452633563136";
/** 随机字符串 */
orderInfo.nonceStr = "LecqkOztHwwfMVhVamtaCJ";
/** 时间戳
系统时间精确到秒,10位数字
*/
orderInfo.timestamp = @"1540445393";
/** 签名类型 */
orderInfo.signType = @"RSA";
/** 签名
请求加签说明
1.排序拼接方式:
按照首字母顺序排序,以key1=value1&key2=value2&key3=value3.....形式组装加签串,value为空字段不参与签名
eg: appId=fdji3ro29k&mchId=93745648&nonceStr=NDKwAJLZEPkBJKZbJyNjuUxMpkgapYPk&prepayId=WP091214175671270865777524736&signType=RSA×tamp=1536733076
2.将拼接后的结果进行RSA签名
*/
orderInfo.sign = @"K2wlOtaKnXEe59gwOjb+o+B30IxOoo23F1jRiSlXgZSQQbBsXhDiX+mT2zJ5fGY5h7cv8KuYP5r+yJWanFIQhv5YHK54bJQ0OMAvk6Cv8UhAc/c4bIqF8OpfzGf34Z5p1rxlGC4jv1boanQ/BQyXfP8sjNj14LkcjNsFUXc+u6T74QGD3A7qINFgUXbb8q/LYoDnZZzcrrRSQpwxOlUTLJCGvz8+v22XgJyS83KMf+f2ej2nQiC98zZG2o01Y7IVpnBeDbRNuiZa5G8erVp9xQpn5m9ZX033xPC9Ps5uTutRh3A/hRXG6yGsMgi/Ed89O6TtsX0TV+zYT7jyCNn2rA==";
/**
新增字段,不参与签名!!!!
支付场景
1.发红包:@"Y"
2. 其他:@"N"
*/
@property (nonatomic, strong) NSString *isRedPacket;
3.发起支付以及支付结果的回调
[[SDPPayManger sharedManager] payOrder:orderInfo fromScheme:nil callback:^(NSDictionary *resultDic) {
NSLog(@"result----->%@", resultDic);
NSLog(@"%s", __func__);
/*收到的支付结果回调*/
/*(1)、支付失败*/
{
"data": {
"ext": {
"pkgname": "",
"lati": "31.190352",
"wifipay_merchantOrderNo": "1540446060876",
"longi": "121.591777",
"wifipay_merchantNo": "93745648",
"mapsp": "",
"wifipay_appId": "fdji3ro29k"
},
"errmsg": "支付失败",
"errCode": "-2"
},
"what": "pay",
"retcode": "-2",
"retmsg": "支付失败"
}
/*(2)、支付成功*/
{
"data": {
"ext": {
"pkgname": "",
"lati": "31.190352",
"wifipay_merchantOrderNo": "1540446060876",
"longi": "121.591777",
"wifipay_merchantNo": "93745648",
"mapsp": "",
"wifipay_appId": "fdji3ro29k"
},
"errmsg": "支付成功",
"errCode": "0"
},
"what": "pay",
"retcode": "0",
"retmsg": "支付成功"
}
/*(3)、用户取消*/
{
"data": {
"ext": {
"pkgname": "",
"lati": "31.190352",
"wifipay_merchantOrderNo": "1540446060876",
"longi": "121.591777",
"wifipay_merchantNo": "93745648",
"mapsp": "",
"wifipay_appId": "fdji3ro29k"
},
"errmsg": "用户取消",
"errCode": "-3"
},
"what": "pay",
"retcode": "-3",
"retmsg": "用户取消"
}
/*(4)、登录取消*/
{
"data": {
"ext": {
"pkgname": "",
"lati": "31.190352",
"wifipay_merchantOrderNo": "1540446060876",
"longi": "121.591777",
"wifipay_merchantNo": "93745648",
"mapsp": "",
"wifipay_appId": "fdji3ro29k"
},
"errmsg": "登录取消",
"errCode": "-4"
},
"what": "pay",
"retcode": "-4",
"retmsg": "登录取消"
}
/*(5)、登录失败*/
{
"data": {
"ext": {
"pkgname": "",
"lati": "31.190352",
"wifipay_merchantOrderNo": "1540446060876",
"longi": "121.591777",
"wifipay_merchantNo": "93745648",
"mapsp": "",
"wifipay_appId": "fdji3ro29k"
},
"errmsg": "登录失败",
"errCode": "-5"
},
"what": "pay",
"retcode": "-5",
"retmsg": "登录失败"
}
}];