本文整理匯總了PHP中AlipaySubmit::query_timestamp_pay_by方法的典型用法代碼示例。如果您正苦於以下問題:PHP AlipaySubmit::query_timestamp_pay_by方法的具體用法?PHP AlipaySubmit::query_timestamp_pay_by怎麽用?PHP AlipaySubmit::query_timestamp_pay_by使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AlipaySubmit
的用法示例。
在下文中一共展示了AlipaySubmit::query_timestamp_pay_by方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unserialize
/**
* 生成預存款支付代碼
*/
function get_predeposit_pay_code($order_info, $pay_info)
{
/***設置支付寶config Start*****/
$payment_config = unserialize($pay_info['payment_config']);
$alipay_account = $payment_config['alipay_account'];
//支付寶賬戶
$alipay_partner = $payment_config['alipay_partner'];
//開發者ID
$alipay_key = $payment_config['alipay_key'];
//開發者key
$alipay_pay_method = $payment_config['alipay_pay_method'];
//接口模式
$alipay_config['partner'] = $alipay_partner;
$alipay_config['key'] = $alipay_key;
$alipay_config['sign_type'] = strtoupper('MD5');
$alipay_config['input_charset'] = strtolower('utf-8');
$alipay_config['cacert'] = FCPATH . "libs\\wmlibs\\libraries\\payment\\cacert.pem";
$alipay_config['transport'] = 'http';
/***設置支付寶config End*****/
//支付類型
$payment_type = "1";
//1代表商品購買
$notify_url = base_url() . "predeposit/alipay_notify_url.php";
$return_url = base_url() . "predeposit/alipay_return_url.php";
$seller_email = $alipay_account;
$out_trade_no = $order_info['pdr_sn'];
$subject = '預存款充值訂單' . $out_trade_no;
$price = $order_info['pdr_price'];
$show_url = base_url() . "index.php?m=member&c=predeposit&a=recharge_list";
//建立請求
$alipaySubmit = new AlipaySubmit($alipay_config);
if ($alipay_pay_method == 3) {
//即時到帳接口
//防釣魚時間戳
$anti_phishing_key = $alipaySubmit->query_timestamp_pay_by();
//客戶端的IP地址
$exter_invoke_ip = ip();
//構造要請求的參數數組,無需改動
$parameter = array("service" => "create_direct_pay_by_user", "partner" => trim($alipay_config['partner']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $price, "body" => '', "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$html_text = $alipaySubmit->buildRequestButton($parameter, "get", "確認支付");
} else {
$html_text = '網站不支持支付寶預存款,請選擇其他充值方式或聯係網站管理員!';
}
return $html_text;
}