Latest 1.5.0
Homepage https://github.com/CorkiiOS/ICPaySDK
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

配置

  • 使用Pod一键配置,也可以选择性的使用子模块
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'ICPaySDK', '~> 1.5.0'

# pod 'ICPaySDK/ICWxPay'
# pod 'ICPaySDK/ICAliPay'
# pod 'ICPaySDK/UnionPay'

end
  • 相对繁琐一些,需要配置支付厂家的SDK

初始化SDK

  • 方式一:可采用在项目info.plist中添加ICWxPayChannelKey,对用的值为微信支付的appkey,如果没有微信支付可以任意填写,之后会自动初始化SDK
  • 方式二:
[[ICPayDesignManager shareInstance] registerSDKWithDictionary:@{ICWxPayChannelKey : @"wechat key"}];

设置支付回调

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [[ICPayDesignManager shareInstance] handleOpenURL:url sourceApplication:sourceApplication];

}

// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    return [[ICPayDesignManager shareInstance] handleOpenURL:url sourceApplication:nil];
}

实现支付

  • 支付宝(支付宝为例)
/*闭包方式*/
/*自定义数据模型 实现协议 <ICIAliModel>*/
AliModel *model = [[AliModel alloc] init];
model.orderString = orderString;
[[ICPayDesignManager shareInstance] payWithModel:model controller:nil completion:^(ICError *error) {
/*回调*/
}];

/*代理方式*/
[[ICPayDesignManager shareInstance] payWithModel:model controller:nil delegate:self];
/*回调*/
- (void)payManagerdidCompleteWithError:(ICError *)error {}

Author

iCorki, [email protected]
发现问题或者bug 👏指正!

License

ICPaySDK is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ICPaySDK",
    "version": "1.5.0",
    "summary": "ICPaySDK is an unique sdk to pay",
    "description": "ICPaySDK = wxpay + alipay. the api is unique",
    "homepage": "https://github.com/CorkiiOS/ICPaySDK",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "corkiios": "[email protected]"
    },
    "source": {
        "git": "https://github.com/CorkiiOS/ICPaySDK.git",
        "tag": "1.5.0"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "8.0"
    },
    "subspecs": [
        {
            "name": "ICPayManager",
            "source_files": "ICPaySDK/ICManager/*.{h,m}"
        },
        {
            "name": "ICAliPay",
            "dependencies": {
                "ICPaySDK/ICPayManager": [],
                "AliPay_SDK": []
            },
            "source_files": "ICPaySDK/ICAliPay/*.{h,m}"
        },
        {
            "name": "ICWxPay",
            "dependencies": {
                "ICPaySDK/ICPayManager": [],
                "WechatOpenSDK": []
            },
            "source_files": "ICPaySDK/ICWxPay/*.{h,m}"
        },
        {
            "name": "UnionPay",
            "dependencies": {
                "ICPaySDK/ICPayManager": [],
                "UnionPay_SDK_iOS": []
            },
            "source_files": "ICPaySDK/ICUnionpay/*.{h,m}"
        }
    ]
}

Pin It on Pinterest

Share This