iOS SDK要求iOS6.0及以上
pod 'ipaynowOneClickPay','~> 1.0.9'
- IPNOneClickDESUtil.h
- IPNOneClickPayDelegate.h
- IPNOneClickPayPlugin.h
- IPNOneClickPreSignMessageUtil.h
- libIPNOneClickPayPlugin.a
- ipaynow.bundle
一键支付页面需要隐藏status bar
,需要在工程info.plist
中设置View Controller-based status bar apperance
为No
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMMddHHmmss"];
IPNPreSignMessageUtil *preSign=[[IPNPreSignMessageUtil alloc]init];
preSign.appId=kAppId;
preSign.mhtOrderNo=[dateFormatter stringFromDate:[NSDate date]]; preSign.mhtName=@"我是商户";
preSign.mhtOrderName=_txtOrderName.text;
preSign.mhtOrderType=@"01";
preSign.mhtCurrencyType=@"156";
preSign.mhtOrderAmt=_txtOrdrAmt.text;
preSign.mhtOrderDetail=_txtOrderDetail.text; preSign.mhtOrderStartTime=[dateFormatter stringFromDate:[NSDate
date]];
preSign.notifyUrl=@"http://192.168.1.154:8080/api/mchnotify";
preSign.mhtReserved=_txtMhtReserved.text;
preSign.userId=_txtUserId.text;
NSString *originStr=[preSign generatePresignMessage];
此处需要在服务端对originStr
进行签名。
[IPNOneClickPayPlugin payByData:payData viewController:self delegate:self];
通知协议为IPNOneClickPayDelegate
商户需要在调起支付的ViewController
中遵守协议
- (void)oneClickPayPluginResult:(IPNOneClickPayResult)result errorInfo:(NSString *)errorInfo;
result
支付结果枚举值为:
typedef NS_ENUM(NSInteger, IPNOneClickPayResult) {
IPNOneClickPayResultSuccess , //成功
IPNOneClickPayResultFail , //失败
IPNOneClickPayResultCancel , //取消
IPNOneClickPayResultUnknown //未知
};
+ (void)setIPNStemeColor:(UIColor *)color;
默认为红色
+ (void)setIsShowIPNPayResultPage:(Bool)beShowIPNPayResultPage;
详见Demo及文档