PHP怎么做银联的支付接口调用 现在只有一个银联的支付接口文档,上面只列举了一系列规范,无从下手,求大神指教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 curl请求 它的demo可以参考 等于你传递支付参数过去,然后它那边回调个key给你 就可以啦 给了个java的Demo,还要用那边提供的java加密算法进行私钥签名,现在在苦逼研究php-java-bridge,老出问题 PHP做银联支付接口调用问题//在工商支付接口之前要找到工行提供的接口文件级dll文件//将订单签名数据公钥加密提供给工行指定页面//组织要签名的数据串$src="ICBC_PERBANK_B2C1.0.0.0".$infomer["merid"].$infomer["meracct"].$returnaddress."HS".$ddnumber.$amount."0010".$nowtime."0";$com=new com('ICBCEBANKUTIL.B2CUtil');$rc=$com->init("c:\WINDOWS\user.crt","c:\WINDOWS\user.crt","c:\WINDOWS\user.key","11111111");$ssrc=$com->signC($src, strlen($src)); //订单签名数据$rc=$com->verifySignC($src,strlen($src), $ssrc, strlen($ssrc));$cert=$com->getCert(1); //商城证书公钥//将商户证书存储到c:\WINDOWS目录下,然后创建form表单,将指定的数据提交到工行指定的网页中<!--支付宝支付的接口操作,提交的数据--> <td width="100"><a href="<{$link}>"><img src="images/sy_19.gif" width="90" height="25" border="0"></a></td><!--——————————————————--><!--工行支付的接口操作,提交的数据--> <form action="https://mybank.icbc.com.cn/" method="post" name="form_bank"> <input name="interfaceName" type="hidden" value="ICBC_PERBANK_B2C"/> <input name="interfaceVersion" type="hidden" value="1.0.0.0"/> <input name="orderid" type="hidden" value="<{$ddnumber}>"/> <input name="amount" type="hidden" value="<{$amount}>"/> <input name="curType" type="hidden" value="001"/> <input name="merID" type="hidden" value="<{$merid}>"/> <input name="merAcct" type="hidden" value="<{$meracct}>"/> <input name="verifyJoinFlag" type="hidden" value="0"/> <input name="notifyType" type="hidden" value="HS"/> <input name="merURL" type="hidden" value="<{$returnaddress}>"/> <input name="resultType" type="hidden" value="0"/> <input name="orderDate" type="hidden" value="<{$nowtime}>"/> <input name="merSignMsg" type="hidden" value="<{$ssrc}>" /> <input name="merCert" type="hidden" value="<{$cert}>" /></form> 问他要php的demo 妥妥的 https://open.unionpay.com/ajweb/help/file 银联的sdk、demo、示例代码下载网址。 package com.unionpay.acp.demo01; import java.util.HashMap; import java.util.Map; import com.unionpay.acp.sdk.SDKConfig; /** * 名称: 第1部分 互联网支付跳转支付 ——网关支付产品<br> * 功能: 6.2 消费类交易<br> * 前台类交易<br> * 版本: 5.0<br> * 日期: 2014-07<br> * 作者: 中国银联<br> * 版权: 中国银联<br> * 更多信息请访问银联技术开放平台 https://open.unionpay.com <br> * 说明:以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考。<br> */public class Form01_6_2_f extends DemoBase { public static void main(String[] args) { /** * 初始化证书 */ /** * 参数初始化 * 在java main 方式运行时必须每次都执行加载 * 如果是在web应用开发里,这个方写在可使用监听的方式写入缓存,无须在这出现 */ SDKConfig.getConfig().loadPropertiesFromSrc();// 从classpath加载acp_sdk.properties文件 /** * 交易请求url 从配置文件读取 */ String requestFrontUrl = SDKConfig.getConfig() .getFrontRequestUrl(); /** * 组装请求报文 */ Map<String, String> contentData = new HashMap<String, String>(); //固定填写 contentData.put("version", "5.0.0");//M //默认取值:UTF-8 contentData.put("encoding", "UTF-8");//M //取值:01(表示采用的是RSA) contentData.put("signMethod", "01");//M //取值:01 contentData.put("txnType", "01");//M //01:自助消费,通过地址的方式区分前台消费和后台消费(含无跳转支付)03:分期付款 contentData.put("txnSubType", "01");//M //000201 业务类型 000201 B2C网关支付 contentData.put("bizType", "000201");//M //07 contentData.put("channelType", "07");//M //前台返回商户结果时使用,前台类交易需上送 contentData.put("frontUrl", frontUrl);//C //后台返回商户结果时使用,如上送,则发送商户后台交易结果通知 contentData.put("backUrl", backUrl);//M //0:普通商户直连接入2:平台类商户接入 contentData.put("accessType", "0");//M // contentData.put("merId", "802290049000180");//M //商户类型为平台类商户接入时必须上送 contentData.put("subMerId", "");//C //商户类型为平台类商户接入时必须上送 contentData.put("subMerName", "");//C //商户类型为平台类商户接入时必须上送 contentData.put("subMerAbbr", "");//C //商户端生成 contentData.put("orderId", getOrderId());//M //商户发送交易时间 contentData.put("txnTime", getCurrentTime());//M //后台类交易且卡号上送;跨行收单且收单机构收集银行卡信息时上送01:银行卡02:存折03:C卡默认取值:01取值“03”表示以IC终端发起的IC卡交易,IC作为普通银行卡进行支付时,此域填写为“01” contentData.put("accType", "");//C //1、 后台类消费交易时上送全卡号或卡号后4位 2、 跨行收单且收单机构收集银行卡信息时上送、 3、前台类交易可通过配置后返回,卡号可选上送 contentData.put("accNo", "");//C //交易单位为分 contentData.put("txnAmt", "1");//M //默认为156 contentData.put("currencyCode", "156");//M //1、后台类消费交易时上送2、跨行收单且收单机构收集银行卡信息时上送3、认证支付2.0,后台交易时可选Key=value格式(具体填写参考数据字典) contentData.put("customerInfo", getCustomer(encoding));//C //PC1、前台类消费交易时上送2、认证支付2.0,后台交易时可选 contentData.put("orderTimeout", "");//O //PC超过此时间用户支付成功的交易,不通知商户,系统自动退款,大约5个工作日金额返还到用户账户 contentData.put("payTimeout", "");//O // contentData.put("termId", "");//O //商户自定义保留域,交易应答时会原样返回 contentData.put("reqReserved", "");//O contentData.put("reserved", "");//O //格式如下:{子域名1=值&子域名2=值&子域名3=值} contentData.put("riskRateInfo", "");//O //当使用银联公钥加密密码等信息时,需上送加密证书的CertID;说明一下?目前商户、机构、页面统一套 contentData.put("encryptCertId", "");//C //前台消费交易若商户上送此字段,则在支付失败时,页面跳转至商户该URL(不带交易信息,仅跳转) contentData.put("frontFailUrl", "");//O //分期付款交易,商户端选择分期信息时,需上送 组合域,填法见数据元说明 contentData.put("instalTransInfo", "");//C //C 取值参考数据字典 contentData.put("defaultPayType", "");//O //C当帐号类型为02-存折时需填写在前台类交易时填写默认银行代码,支持直接跳转到网银商户发卡银行控制系统应答返回 contentData.put("issInsCode", "");//O //仅仅pc使用,使用哪种支付方式 由收单机构填写,取值为以下内容的一种或多种,通过逗号(,)分割。取值参考数据字典 contentData.put("supPayType", "");//O //移动支付业务需要上送 contentData.put("userMac", "");//O //前台交易,有IP防钓鱼要求的商户上送 contentData.put("customerIp", "");//C //有卡交易必填有卡交易信息域 contentData.put("cardTransData", "");//C //渠道类型为语音支付时使用 contentData.put("vpcTransData", "");//C //移动支付上送 contentData.put("orderDesc", "");//C /** * 创建表单 */ String html = createHtml(requestFrontUrl, signData(contentData)); System.out.println(html); } } UChome rewrite 为什么只重定向到了 space.php ?? 求 eshop,想做个商城 phpcms后台管理 【求教】请教高手怎样才能将生成的验证码放到session中?在线等待... 求PHP 5.5注册码 大小写转换 情况关于RED5 的meetingpoint 找一个能够开发工作站的人士。。。。。。 java比php有哪些优势 thinkPHP中的select提交表单时遇到的问题 怎么用PHP抓取网站HTML thinkphp 根据无限极分类添加内容 小弟在线急求答案 跟写法
//在工商支付接口之前要找到工行提供的接口文件级dll文件
//将订单签名数据公钥加密提供给工行指定页面
//组织要签名的数据串
$src="ICBC_PERBANK_B2C1.0.0.0".$infomer["merid"].$infomer["meracct"].$returnaddress."HS".$ddnumber.$amount."0010".$nowtime."0";
$com=new com('ICBCEBANKUTIL.B2CUtil');
$rc=$com->init("c:\WINDOWS\user.crt","c:\WINDOWS\user.crt","c:\WINDOWS\user.key","11111111");
$ssrc=$com->signC($src, strlen($src)); //订单签名数据
$rc=$com->verifySignC($src,strlen($src), $ssrc, strlen($ssrc));
$cert=$com->getCert(1); //商城证书公钥
//将商户证书存储到c:\WINDOWS目录下,然后创建form表单,将指定的数据提交到工行指定的网页中
<!--支付宝支付的接口操作,提交的数据-->
<td width="100"><a href="<{$link}>"><img src="images/sy_19.gif" width="90" height="25" border="0"></a></td>
<!--——————————————————-->
<!--工行支付的接口操作,提交的数据-->
<form action="https://mybank.icbc.com.cn/" method="post" name="form_bank">
<input name="interfaceName" type="hidden" value="ICBC_PERBANK_B2C"/>
<input name="interfaceVersion" type="hidden" value="1.0.0.0"/>
<input name="orderid" type="hidden" value="<{$ddnumber}>"/>
<input name="amount" type="hidden" value="<{$amount}>"/>
<input name="curType" type="hidden" value="001"/>
<input name="merID" type="hidden" value="<{$merid}>"/>
<input name="merAcct" type="hidden" value="<{$meracct}>"/>
<input name="verifyJoinFlag" type="hidden" value="0"/>
<input name="notifyType" type="hidden" value="HS"/>
<input name="merURL" type="hidden" value="<{$returnaddress}>"/>
<input name="resultType" type="hidden" value="0"/>
<input name="orderDate" type="hidden" value="<{$nowtime}>"/>
<input name="merSignMsg" type="hidden" value="<{$ssrc}>" />
<input name="merCert" type="hidden" value="<{$cert}>" />
</form>
import java.util.HashMap;
import java.util.Map;
import com.unionpay.acp.sdk.SDKConfig;
/**
* 名称: 第1部分 互联网支付跳转支付 ——网关支付产品<br>
* 功能: 6.2 消费类交易<br>
* 前台类交易<br>
* 版本: 5.0<br>
* 日期: 2014-07<br>
* 作者: 中国银联<br>
* 版权: 中国银联<br>
* 更多信息请访问银联技术开放平台 https://open.unionpay.com <br>
* 说明:以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考。<br>
*/
public class Form01_6_2_f extends DemoBase {
public static void main(String[] args) {
/**
* 初始化证书
*/
/**
* 参数初始化
* 在java main 方式运行时必须每次都执行加载
* 如果是在web应用开发里,这个方写在可使用监听的方式写入缓存,无须在这出现
*/
SDKConfig.getConfig().loadPropertiesFromSrc();// 从classpath加载acp_sdk.properties文件
/**
* 交易请求url 从配置文件读取
*/
String requestFrontUrl = SDKConfig.getConfig()
.getFrontRequestUrl();
/**
* 组装请求报文
*/
Map<String, String> contentData = new HashMap<String, String>();
//固定填写
contentData.put("version", "5.0.0");//M
//默认取值:UTF-8
contentData.put("encoding", "UTF-8");//M
//取值:01(表示采用的是RSA)
contentData.put("signMethod", "01");//M
//取值:01
contentData.put("txnType", "01");//M
//01:自助消费,通过地址的方式区分前台消费和后台消费(含无跳转支付)03:分期付款
contentData.put("txnSubType", "01");//M
//000201 业务类型 000201 B2C网关支付
contentData.put("bizType", "000201");//M
//07
contentData.put("channelType", "07");//M
//前台返回商户结果时使用,前台类交易需上送
contentData.put("frontUrl", frontUrl);//C
//后台返回商户结果时使用,如上送,则发送商户后台交易结果通知
contentData.put("backUrl", backUrl);//M
//0:普通商户直连接入2:平台类商户接入
contentData.put("accessType", "0");//M
//
contentData.put("merId", "802290049000180");//M
//商户类型为平台类商户接入时必须上送
contentData.put("subMerId", "");//C
//商户类型为平台类商户接入时必须上送
contentData.put("subMerName", "");//C
//商户类型为平台类商户接入时必须上送
contentData.put("subMerAbbr", "");//C
//商户端生成
contentData.put("orderId", getOrderId());//M
//商户发送交易时间
contentData.put("txnTime", getCurrentTime());//M
//后台类交易且卡号上送;跨行收单且收单机构收集银行卡信息时上送01:银行卡02:存折03:C卡默认取值:01取值“03”表示以IC终端发起的IC卡交易,IC作为普通银行卡进行支付时,此域填写为“01”
contentData.put("accType", "");//C
//1、 后台类消费交易时上送全卡号或卡号后4位 2、 跨行收单且收单机构收集银行卡信息时上送、 3、前台类交易可通过配置后返回,卡号可选上送
contentData.put("accNo", "");//C
//交易单位为分
contentData.put("txnAmt", "1");//M
//默认为156
contentData.put("currencyCode", "156");//M
//1、后台类消费交易时上送2、跨行收单且收单机构收集银行卡信息时上送3、认证支付2.0,后台交易时可选Key=value格式(具体填写参考数据字典)
contentData.put("customerInfo", getCustomer(encoding));//C
//PC1、前台类消费交易时上送2、认证支付2.0,后台交易时可选
contentData.put("orderTimeout", "");//O
//PC超过此时间用户支付成功的交易,不通知商户,系统自动退款,大约5个工作日金额返还到用户账户
contentData.put("payTimeout", "");//O
//
contentData.put("termId", "");//O
//商户自定义保留域,交易应答时会原样返回
contentData.put("reqReserved", "");//O
contentData.put("reserved", "");//O
//格式如下:{子域名1=值&子域名2=值&子域名3=值}
contentData.put("riskRateInfo", "");//O
//当使用银联公钥加密密码等信息时,需上送加密证书的CertID;说明一下?目前商户、机构、页面统一套
contentData.put("encryptCertId", "");//C
//前台消费交易若商户上送此字段,则在支付失败时,页面跳转至商户该URL(不带交易信息,仅跳转)
contentData.put("frontFailUrl", "");//O
//分期付款交易,商户端选择分期信息时,需上送 组合域,填法见数据元说明
contentData.put("instalTransInfo", "");//C
//C 取值参考数据字典
contentData.put("defaultPayType", "");//O
//C当帐号类型为02-存折时需填写在前台类交易时填写默认银行代码,支持直接跳转到网银商户发卡银行控制系统应答返回
contentData.put("issInsCode", "");//O
//仅仅pc使用,使用哪种支付方式 由收单机构填写,取值为以下内容的一种或多种,通过逗号(,)分割。取值参考数据字典
contentData.put("supPayType", "");//O
//移动支付业务需要上送
contentData.put("userMac", "");//O
//前台交易,有IP防钓鱼要求的商户上送
contentData.put("customerIp", "");//C
//有卡交易必填有卡交易信息域
contentData.put("cardTransData", "");//C
//渠道类型为语音支付时使用
contentData.put("vpcTransData", "");//C
//移动支付上送
contentData.put("orderDesc", "");//C
/**
* 创建表单
*/
String html = createHtml(requestFrontUrl, signData(contentData));
System.out.println(html);
}
}