怎样选择给网站选择支付接口

怎样选择给网站选择支付接口
Q~~1⑨9⑦O*⑦46图片描述

//开始解析
[xml startParse:res];

NSMutableDictionary *resParams = [xml getDict];

//判断返回
NSString *return_code   = [resParams objectForKey:@return_code];
NSString *result_code   = [resParams objectForKey:@result_code];
if ( [return_code isEqualToString:@SUCCESS] )
{
    //生成返回数据的签名
    NSString *sign      = [self createMd5Sign:resParams ];
    NSString *send_sign =[resParams objectForKey:@sign] ;

    //验证签名正确性
    if( [sign isEqualToString:send_sign]){
        if( [result_code isEqualToString:@SUCCESS]) {
            //验证业务处理状态
            prepayid    = [resParams objectForKey:@prepay_id];
            return_code = 0;

            [self.debugInfo appendFormat:@获取预支付交易标示成功!

];
}
}else{
self.lastErrCode = 1;
[self.debugInfo appendFormat:@gen_sign=%@
_sign=%@
,sign,send_sign];
[self.debugInfo appendFormat:@服务器返回签名验证错误!!!
];
}
}else{
self.lastErrCode = 2;
[self.debugInfo appendFormat:@接口返回错误!!!
];
}

return prepayid;

}

  • (NSMutableDictionary*)getPrepayWithOrderName:(NSString*)name
    price:(NSString*)price
    device:(NSString*)device
    {
    //订单标题,展示给用户
    NSString* orderName = name;
    //订单金额,单位(分)
    NSString* orderPrice = price;//以分为单位的整数
    //支付设备号或门店号
    NSString* orderDevice = device;
    //支付类型,固定为APP
    NSString* orderType = @APP;
    //发器支付的机器ip,暂时没有发现其作用
    NSString* orderIP = @196.168.1.1;

    //随机数串
    srand( (unsigned)time(0) );
    NSString *noncestr = [NSString stringWithFormat:@%d, rand()];
    NSString *orderNO = [NSString stringWithFormat:@%ld,time(0)];

    //================================
    //预付单参数订单设置
    //================================
    NSMutableDictionary *packageParams = [NSMutableDictionary dictionary];

    [packageParams setObject: self.appId forKey:@appid]; //开放平台appid
    [packageParams setObject: self.mchId forKey:@mch_id]; //商户号
    [packageParams setObject: orderDevice forKey:@device_info]; //支付设备号或门店号
    [packageParams setObject: noncestr forKey:@nonce_str]; //随机串
    [packageParams setObject: orderType forKey:@trade_type]; //支付类型,固定为APP
    [packageParams setObject: orderName forKey:@body]; //订单描述,展示给用户
    [packageParams setObject: NOTIFY_URL forKey:@notify_url]; //支付结果异步通知
    [packageParams setObject: orderNO forKey:@out_trade_no];//商户订单号
    [packageParams setObject: orderIP forKey:@spbill_create_ip];//发器支付的机器ip
    [packageParams setObject: orderPrice forKey:@total_fee]; //订单金额,单位为分

    //获取prepayId(预支付交易会话标识)
    NSString *prePayid;
    prePayid = [self sendPrepay:packageParams];

    if(prePayid == nil)
    {
    [self.debugInfo appendFormat:@获取prepayid失败!
    ];
    return nil;
    }

    //获取到prepayid后进行第二次签名
    NSString *package, *time_stamp, *nonce_str;
    //设置支付参数
    time_t now;
    time(&now);
    time_stamp = [NSString stringWithFormat:@%ld, now];
    nonce_str = [WXUtil md5:time_stamp];
    //重新按提交格式组包,微信客户端暂只支持package=Sign=WXPay格式,须考虑升级后支持携带package具体参数的情况
    //package = [NSString stringWithFormat:@Sign=%@,package];
    package = @Sign=WXPay;
    //第二次签名参数列表
    NSMutableDictionary *signParams = [NSMutableDictionary dictionary];
    [signParams setObject: self.appId forKey:@appid];
    [signParams setObject: self.mchId forKey:@partnerid];
    [signParams setObject: nonce_str forKey:@noncestr];
    [signParams setObject: package forKey:@package];
    [signParams setObject: time_stamp forKey:@timestamp];
    [signParams setObject: prePayid forKey:@prepayid];

    //生成签名
    NSString *sign = [self createMd5Sign:signParams];

    //添加签名
    [signParams setObject: sign forKey:@sign];

    [self.debugInfo appendFormat:@第二步签名成功,sign=%@
    ,sign];

    //返回参数列表
    return signParams;
    }
    How to realize the personal website of Alipay?
    Answer: we know that Alipay is very popular in the current payment, personal website integrated a Alipay payment, is very conducive to the website business; however, because Alipay paid only for company registration, opening, and operating a company’s cost is very high, like a personal webmaster website revenue is not great, so go a company registration, operation clearly inappropriate. So how to realize the personal website of Alipay on your site? This must be carried out in order to achieve the assistance of the fourth party platform to achieve. This is our fourth party, because we are the corporate entity, for Alipay and Alipay authentication interface, online payment. Personal website registered in our platform to become a member, you can enjoy Alipay paid to bring you the convenient collection service.
    Personal website collection fee to Alipay?
    Answer: of course. Access to the site for each transaction, Paypal will deduct the Alipay special platform taking account service fees, the service fees must be recorded in the website access account. At the same time, our operating companies and platforms need to access the website comprehensive cost, so the rate is slightly higher than that of our company and Alipay contract rate, higher operation cost by subtracting is our profit, it is a low profit industry.
    Personal website Alipay can immediately to the account?
    Answer: can. Alipay paid immediately to the account, we have opened a good payment function of Alipay Alipay special platform taking account transfer to you, you have your own password, their own operating funds account management
    Personal website for Alipay there is no limit to what conditions?
    Answer: No, we take one cut the illegal edge ball website, specific please contact our 19970746 business 请翻译 解 读

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值