工商银行支付接口 B2C PHP ecshop

本文档介绍如何利用PHP在ECShop电子商务平台上集成工商银行的B2C支付接口,包括所需资料、DEMO示例及JAR文件的使用说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


<?php

if (!defined('IN_ECS'))
{
	die('Hacking attempt');
}

$payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/icbc.php';

if (file_exists($payment_lang))
{
	global $_LANG;

	include_once($payment_lang);
}

/**
 * 模块信息
 */
if (isset($set_modules) && $set_modules == true)
{
	$i = isset($modules) ? count($modules) : 0;
	/* 代码 */
	$modules[$i]['code'] = basename(__FILE__, '.php');

	/* 描述对应的语言项 */
	$modules[$i]['desc'] = 'icbc_desc';


	/* 是否支持货到付款 */
	$modules[$i]['is_cod'] = '0'; //否

	/* 是否支持在线支付 */
	$modules[$i]['is_online'] = '1'; //是

	/* 作者 */
	$modules[$i]['author']  = 'ec';

	/* 网址 */
	$modules[$i]['website'] = 'http://www.baidu.com';

	/* 版本号 */
	$modules[$i]['version'] = '1.0.0.11';

	/* 配置信息 */
	$modules[$i]['config'] = array(
	array('name' => 'merID', 'type' => 'text', 'value' => ''),//商户代码
	array('name' => 'merAcct', 'type' => 'text', 'value' => ''),//商户帐号
	array('name' => 'curType', 'type' => 'text', 'value' => ''),//支付币种

	);
	return;
}

class icbc
{
	/**
	 * 构造函数
	 *
	 * @access  public
	 * @param
	 *
	 * @return void
	 */

	function icbc()
	{
	}

	function __construct()
	{
		$this->icbc();
	}

	/**
	 * 生成支付代码
	 * @param   array   $order  订单信息
	 * @param   array   $payment    支付方式信息
	 */
	function get_code($order, $payment)
	{
		//构造参数
		$a_parameter = array(

		//公共证书地址
			'cert_public_file' => ROOT_PATH."includes/modules/payment/icbc/ebb2cpublic.crt",

		//私有证书地址
			'cert_private_file' => ROOT_PATH."includes/modules/payment/icbc/th2.crt",

		//私钥地址
			'cert_key_file' => ROOT_PATH."includes/modules/payment/icbc/th2.key",

		//接口名称
			'interfaceName' => 'ICBC_PERBANK_B2C',

		//接口版本
			'interfaceVersion' => '1.0.0.11',

		//商城代码
			'merID' => $payment['merID'],

		//商户帐号
			'merAcct' => $payment['merAcct'],

		// 支持订单支付的银行卡种类 0表示仅允许使用借记卡支付,1表示仅允许使用信用卡支付,2表示借记卡和信用卡都能对订单进行支付
			'creditType' => 2,

		//HS方式实时发送通知 AG方式不发送通知
			'notifyType' => 'HS',

		//订单号
			'orderid' => $order['order_sn'],

		//金额以分为单位
			'amount' => number_format($order['order_amount'], 2, '.', '') * 100,

		//币种目前只支持人民币,代码为001
			'curType' => '001',

		//对于HS方式 0: 发送成功或者失败信息 1: 只发送交易成功信息
			'resultType' => 0,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值