本文整理汇总了PHP中RequestHandler::sendPrepay方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::sendPrepay方法的具体用法?PHP RequestHandler::sendPrepay怎么用?PHP RequestHandler::sendPrepay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::sendPrepay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strval
$packetParams['out_trade_no'] = $out_trade_no;
//总金额
$packetParams['total_fee'] = $total_fee;
//访问接口IP
//$packetParams['spbill_create_ip'] = Request::getClientIp();
$packetParams['spbill_create_ip'] = '127.0.0.1';
//接受微信支付异步通知回调地址
$packetParams['notify_url'] = ecmobile_url() . $notify_url;
//交易类型:JSAPI,NATIVE,APP
$packetParams['trade_type'] = "APP";
//签名 TODO
$sign = $reqHandler->createMd5Sign($packetParams);
$packetParams['sign'] = $sign;
$time_stamp = strval(time());
//获取prepayid
$prepayid = $reqHandler->sendPrepay($packetParams);
if ($prepayid != null) {
$pack = 'Sign=WXPay';
//输出参数列表
$prePayParams = array();
$prePayParams['appid'] = $APP_ID;
$prePayParams['partnerid'] = $PARTNER;
$prePayParams['prepayid'] = $prepayid;
$prePayParams['package'] = $pack;
$prePayParams['noncestr'] = $nonce_str;
$prePayParams['timestamp'] = $time_stamp;
//生成签名
$sign = $reqHandler->createMd5Sign($prePayParams);
$outparams['error_code'] = 0;
$outparams['succeed'] = 1;
$outparams['error_desc'] = 'ok';
示例2: array
$signParams = array();
$signParams['appid'] = $APP_ID;
$signParams['appkey'] = $APP_KEY;
$signParams['noncestr'] = $nonce_str;
$signParams['package'] = $package;
$signParams['timestamp'] = $time_stamp;
$signParams['traceid'] = 'mytraceid_001';
//生成支付签名
$sign = $reqHandler->createSHA1Sign($signParams);
//增加非参与签名的额外参数
$signParams['sign_method'] = 'sha1';
$signParams['app_signature'] = $sign;
//剔除appkey
unset($signParams['appkey']);
//获取prepayid
$prepayid = $reqHandler->sendPrepay($signParams);
if ($prepayid != null) {
$pack = 'Sign=WXPay';
//输出参数列表
$prePayParams = array();
$prePayParams['appid'] = $APP_ID;
$prePayParams['appkey'] = $APP_KEY;
$prePayParams['noncestr'] = $nonce_str;
$prePayParams['package'] = $pack;
$prePayParams['partnerid'] = $PARTNER;
$prePayParams['prepayid'] = $prepayid;
$prePayParams['timestamp'] = $time_stamp;
//生成签名
$sign = $reqHandler->createSHA1Sign($prePayParams);
$outparams['retcode'] = 0;
$outparams['retmsg'] = 'ok';
示例3: wechatAction
/**
* 微信支付
*/
public function wechatAction()
{
$babyId = $this->devices->getBabyIdByShoeId($this->userInfo['uid'], $this->_sanReq['shoe_id']);
if (!$babyId) {
$this->_showMsg(self::NON_SHOE, $this->di['flagmsg'][self::NON_SHOE]);
}
//角色名
if (!empty($rel) && $rel['family_rolename'] != '') {
$rolename = $rel['family_rolename'];
} else {
$rolename = '';
}
//获取套餐
$renew = $this->renew->getRenew($serviceId, 1);
if (!$renew) {
$this->_showMsg(self::NON_PACKAGE, $this->di['flagmsg'][self::NON_PACKAGE]);
}
//订单号
$orderNo = (string) Common::makeOrderSn();
//生成续费订单,入库
if (($res = $this->renew->renewUpdate($shoeId, $this->userInfo['uid'], $serviceId, $_SERVER['REQUEST_TIME'], 1, $orderNo, 3, $renew['cr_real_price'], $renew['cr_name'], $renew['cr_period'], $renew['cr_coins'], $rolename, $babyId['baby_id'], $babyId['dev_imei'])) != self::SUCCESS) {
$this->_showMsg($res, $this->di['flagmsg'][$res]);
}
include_once __DIR__ . '/../../utils/wechat/classes/RequestHandler.class.php';
include_once __DIR__ . '/../../utils/wechat/tenpay_config.php';
include __DIR__ . '/../../utils/wechat/classes/client/TenpayHttpClient.class.php';
//获取token值
$reqHandler = new RequestHandler();
//配置
$wechatConf = $this->di->get('sysconfig')['payment']['wechat'];
$reqHandler->init($wechatConf['app_id'], $wechatConf['app_secret'], $wechatConf['partner_key'], $wechatConf['app_key']);
$Token = $reqHandler->GetToken();
if ($Token != '') {
//设置package支付参数
$packageParams = array();
$packageParams['bank_type'] = 'WX';
//支付类型
$packageParams['body'] = $renew['cr_name'];
//商品描述
$packageParams['fee_type'] = '1';
//银行币种
$packageParams['input_charset'] = 'UTF-8';
//字符集 renewServer
$packageParams['notify_url'] = $this->di->get['sysconfig']['renewServer'] . $wechatConf['notify_url'];
//通知地址
$packageParams['out_trade_no'] = $orderNo;
//商户订单号
$packageParams['partner'] = $wechatConf['partner'];
//设置商户号
$packageParams['spbill_create_ip'] = $_SERVER['REMOTE_ADDR'];
//支付机器IP
$packageParams['total_fee'] = $renew['cr_real_price'] * 100;
//商品总金额,以分为单位
$package = $reqHandler->genPackage($packageParams);
$time_stamp = (string) time();
$nonce_str = md5(rand());
//设置支付参数
$signParams = array();
$signParams['appid'] = $APP_ID;
$signParams['appkey'] = $APP_KEY;
$signParams['noncestr'] = $nonce_str;
$signParams['package'] = $package;
$signParams['timestamp'] = $time_stamp;
$signParams['traceid'] = 'yunduo_wechat';
//生成支付签名
$sign = $reqHandler->createSHA1Sign($signParams);
//增加非参与签名的额外参数
$signParams['sign_method'] = 'sha1';
$signParams['app_signature'] = $sign;
//剔除appkey
unset($signParams['appkey']);
//获取prepayid
$prepayid = $reqHandler->sendPrepay($signParams);
if ($prepayid != null) {
$pack = 'Sign=WXPay';
//输出参数列表
$prePayParams = array();
$prePayParams['appid'] = $APP_ID;
$prePayParams['appkey'] = $APP_KEY;
$prePayParams['noncestr'] = $nonce_str;
$prePayParams['package'] = $pack;
$prePayParams['partnerid'] = $PARTNER;
$prePayParams['prepayid'] = $prepayid;
$prePayParams['timestamp'] = $time_stamp;
//生成签名
$sign = $reqHandler->createSHA1Sign($prePayParams);
$outparams['retcode'] = '0';
$outparams['retmsg'] = 'ok';
$outparams['partnerid'] = $PARTNER;
$outparams['noncestr'] = $nonce_str;
$outparams['package'] = $pack;
$outparams['prepayid'] = $prepayid;
$outparams['timestamp'] = $time_stamp;
$outparams['sign'] = $sign;
//增加返回相关产品信息
$outparams['order_no'] = $orderNo;
$outparams['order_subject'] = $renew['cr_name'];
//.........这里部分代码省略.........