支付

  • 下载地址

SDK下载

Demo下载

  • SDK 版本记录

版本

日期

说明

v1.0.1

2021-11-18

java sdk上线

v1.0.2

2022-04-08

java sdk上线

聚合支付?

  • 简介

针对不同的支付方式,我们提供了两种模式的交互:

(1)跳转到汇付网关的模式:商户下单后,汇付返回跳转地址,商户执行页面重定向后,消费者进行支付,如支付宝扫码、快捷支付、网银支付等。

(2)无需跳转汇付网关的模式:商户下单后,汇付返回二维码链接或微信的payInfo,商户生成二维码展示或按照微信指引唤起微信支付,如微信公众号、微信小程序等。 两种模式可通过deviceType+payType组合进行支付方式的指定

跳转网关模式?

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 聚合支付服务的url(测试环境)
	String serverUrl = "https://hfgj.testpnr.com/pay/unifiedorder.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbAggPaymentRequest request = new GcbAggPaymentRequest();
	
	//必填,商户系统接受支付结果的页面地址
	request.setPageUrl("http://localhost:8080/notifyReceiverPg.do"); 
	//必填,商户系统接受支付结果的后台地址【url公网可以访问,否则接收不到通知】
	request.setBgUrl("http://localhost:8080/notifyReceiverBg.do"); 
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");	
	//条件必填,支付人姓名,中文名,网银直连时必填
	request.setPayerName("李财水"); 
	 //条件必填,支付人身份证号码,字符串,18位身份证号;跨境结算且为直连模式时必填
	request.setPayerIdentityCard("320125198805232313");
	//非必填,支付人所持卡号
	request.setCardNumber("6225881257400000"); 
	//必填,商户订单号,只允许使用字母、数字、_,每商户提交的订单号,必须在自身账户交易中唯一
	String orderId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setOrderId(orderId); 
	//必填,订单币种,3位币别码,详情请参照币别代码附录。
	request.setOrderCurrency("CNY"); 
	//必填,结算币种,3位币别码,详情请参照币别代码附录。
	request.setSettlementCurrency("CNY");
	//必填,商户订单金额,整型数字,单位为分。日韩元支持的最小单位为元。如100元,则填写10000
	request.setOrderAmount("100"); 
	//必填,商户订单提交时间,一共14位格式为:yyyyMMddHHmmss
	String orderTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setOrderTime(orderTime); 
	//必填,商品名称
	request.setProductName("CellPhone"); 
	//必填,商品数量,整型数字
	request.setProductNum("1"); 
	//必填,商品代码,请根据我司提供的商品代码附录进行填写。
	request.setProductId("100003"); 
	
	//非必填,填写规则:商品编号|商品名称|商品数量|商品单价(单位元)|商品链接;商品编号|商品名称|商品数量|商品单价(单位元)|商品链接
	GcbAggPaymentProductDesc desc = new GcbAggPaymentProductDesc();
	desc.setCode("P0000002");
	desc.setName("iphone 6 plus");
	desc.setQuantity("1");
	desc.setPrice("200");
	desc.setUrl("http://www.mshop.com/product?id=P0000002");
	
	List<GcbAggPaymentProductDesc> productDescList = new ArrayList<GcbAggPaymentProductDesc>();
	productDescList.add(desc);
	
	request.setProductDescList(productDescList);
	
	//非必填,扩展字段1,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt1("ext1");
	//非必填,扩展字段2,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt2("ext2");
	//必填,1:pc端支付2:移动端支付
	request.setDeviceType("1"); 
	//必填,6-1245或者6展示全部开通支付方式
	request.setPayType("6");  
	//条件必填,银行代码,请参考银行代码表附录。网银直连时必填;即deviceType=1且payType为4时
	request.setBankId("");
	//非必填,1:表示同一订单禁止重复提交标志,预留字段。2:表示 同一订单,可重复提交(订单状态为未支付成功)
	request.setRedoFlag("1");
	//非必填,1:表示分账,不上送或上送。0:表示不分账;分账需要联系我司运营进行开通配置
	request.setDivFlag("0"); 
	//非必填, 指定付款人时上送,格式为:{"desPayer":{"isDestPayer":"Y"}},仅支付宝相关支付方式支持,微信公众号/小程序支付请联系我司沟通
	request.setBizContent(""); 
	
	//发送请求
	GcbAggPaymentResponse response = gcbPayClient.execute(request);
	
	//商户系统需将用户浏览器重定向到响应的url
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 接收异步示例

Java

  
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 实例化通知解析器
	GcbPayCallbackMessageParser gcbMessageParser = new DefaultGcbPayCallbackMessageParser(base64PublicKey);
	
	// 解析通知结果
	GcbAggPaymentResult result = gcbMessageParser.parse(httpServeletRequest, GcbAggPaymentResult.class);
	
	//根据结果,进行业务逻辑处理
	// ......
  													
									
  • 参数说明

调用参数详见 聚合支付接口

  • 流程示意

调用流程详见 支付流程

非跳转模式?

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 聚合支付服务的url(测试环境)
	String serverUrl = "https://hfgj.testpnr.com/pay/unifiedorder.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbAggPaymentRequest request = new GcbAggPaymentRequest();
	
	//必填,商户系统接受支付结果的页面地址
	request.setPageUrl("http://localhost:8080/notifyReceiverPg.do"); 
	//必填,商户系统接受支付结果的后台地址【url公网可以访问,否则接收不到通知】
	request.setBgUrl("http://localhost:8080/notifyReceiverBg.do"); 
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");	
	//条件必填,支付人姓名,中文名,网银直连时必填
	request.setPayerName("李财水"); 
	 //条件必填,支付人身份证号码,字符串,18位身份证号;跨境结算且为直连模式时必填
	request.setPayerIdentityCard("320125198805232313");
	//非必填,支付人所持卡号
	request.setCardNumber("6225881257400000"); 
	//必填,商户订单号,只允许使用字母、数字、_,每商户提交的订单号,必须在自身账户交易中唯一
	String orderId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setOrderId(orderId); 
	//必填,订单币种,3位币别码,详情请参照币别代码附录。
	request.setOrderCurrency("CNY"); 
	//必填,结算币种,3位币别码,详情请参照币别代码附录。
	request.setSettlementCurrency("CNY");
	//必填,商户订单金额,整型数字,单位为分。日韩元支持的最小单位为元。如100元,则填写10000
	request.setOrderAmount("100"); 
	//必填,商户订单提交时间,一共14位格式为:yyyyMMddHHmmss
	String orderTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setOrderTime(orderTime); 
	//必填,商品名称
	request.setProductName("CellPhone"); 
	//必填,商品数量,整型数字
	request.setProductNum("1"); 
	//必填,商品代码,请根据我司提供的商品代码附录进行填写。
	request.setProductId("100003"); 
	
	//非必填,填写规则:商品编号|商品名称|商品数量|商品单价(单位元)|商品链接;商品编号|商品名称|商品数量|商品单价(单位元)|商品链接
	GcbAggPaymentProductDesc desc = new GcbAggPaymentProductDesc();
	desc.setCode("P0000002");
	desc.setName("iphone 6 plus");
	desc.setQuantity("1");
	desc.setPrice("200");
	desc.setUrl("http://www.mshop.com/product?id=P0000002");
	
	List<GcbAggPaymentProductDesc> productDescList = new ArrayList<GcbAggPaymentProductDesc>();
	productDescList.add(desc);
	
	request.setProductDescList(productDescList);
	
	//非必填,扩展字段1,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt1("ext1");
	//非必填,扩展字段2,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt2("ext2");
	//必填,1:pc端支付2:移动端支付
	request.setDeviceType("1"); 
	//必填,2:支付宝扫码
	request.setPayType("2");  
	//条件必填,银行代码,请参考银行代码表附录。网银直连时必填;即deviceType=1且payType为4时
	request.setBankId("");
	//非必填,1:表示同一订单禁止重复提交标志,预留字段。2:表示 同一订单,可重复提交(订单状态为未支付成功)
	request.setRedoFlag("1");
	//非必填,1:表示分账,不上送或上送。0:表示不分账;分账需要联系我司运营进行开通配置
	request.setDivFlag("0"); 
	//非必填, 指定付款人时上送,格式为:{"desPayer":{"isDestPayer":"Y"}},仅支付宝相关支付方式支持,微信公众号/小程序支付请联系我司沟通
	request.setBizContent(""); 
	
	//发送请求
	GcbAggPaymentResponse response = gcbPayClient.execute(request);
	
	//当payType上送2时,商户系统需将响应结果中的url转换成二维码展示
	//根据响应结果,进行业务逻辑处理
	// ......  
  													
									
  • 接收异步示例

Java

  
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 实例化通知解析器
	GcbPayCallbackMessageParser gcbMessageParser = new DefaultGcbPayCallbackMessageParser(base64PublicKey);
	
	// 解析通知结果
	GcbAggPaymentResult result = gcbMessageParser.parse(httpServeletRequest, GcbAggPaymentResult.class);
	
	//根据结果,进行业务逻辑处理
	// ......
  													
									
  • 参数说明

调用参数详见 聚合支付接口

  • 流程示意

调用流程详见 支付流程

转账支付?

  • 简介

商户下单返回银行转账的收款方信息,支付人从银行网银进行转账完成支付。

(1)跳转到汇付网关的模式:商户下单后,汇付返回跳转地址,商户执行页面重定向后,消费者在汇付页面填写信息,提交汇付后通过回调给商户,商户再展示给支付人转账信息。

(2)API模式:商户收集客户信息API模式提交给汇付,汇付返回payInfo转账信息,商户自行展示给支付人转账信息。

跳转网关模式?

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 转账支付网关服务的url
	String serverUrl = "https://hfgj.testpnr.com/pay/unifiedorder.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbBankTransPaymentRequest request = new GcbBankTransPaymentRequest();
	
	//必填,商户系统接受支付结果的页面地址
	request.setPageUrl("http://localhost:8080/notifyReceiverPg.do"); 
	//必填,商户系统接受支付结果的后台地址【url公网可以访问,否则接收不到通知】
	request.setBgUrl("http://localhost:8080/notifyReceiverBg.do"); 
	//必填,转账支付-网关模式(PC/移动端)必填,用以接受网关中转异步下单结果
	request.setAsyncUrl("http://localhost:8080/notifyReceiverAsync.do"); 
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");	
	//条件必填,支付人姓名,中文名,网银直连时必填
	request.setPayerName("李财水"); 
	 //条件必填,支付人身份证号码,字符串,18位身份证号;跨境结算且为直连模式时必填
	request.setPayerIdentityCard("320125198805232313");
	//非必填,支付人所持卡号
	request.setCardNumber("6225881257400000"); 
	//必填,商户订单号,只允许使用字母、数字、_,每商户提交的订单号,必须在自身账户交易中唯一
	String orderId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setOrderId(orderId); 
	//必填,订单币种,3位币别码,详情请参照币别代码附录。
	request.setOrderCurrency("CNY"); 
	//必填,结算币种,3位币别码,详情请参照币别代码附录。
	request.setSettlementCurrency("CNY");
	//必填,商户订单金额,整型数字,单位为分。日韩元支持的最小单位为元。如100元,则填写10000
	request.setOrderAmount("100"); 
	//必填,商户订单提交时间,一共14位格式为:yyyyMMddHHmmss
	String orderTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setOrderTime(orderTime); 
	//必填,商品名称
	request.setProductName("CellPhone"); 
	//必填,商品数量,整型数字
	request.setProductNum("1"); 
	//必填,商品代码,请根据我司提供的商品代码附录进行填写。
	request.setProductId("100003"); 
	
	//非必填,填写规则:商品编号|商品名称|商品数量|商品单价(单位元)|商品链接;商品编号|商品名称|商品数量|商品单价(单位元)|商品链接
	GcbAggPaymentProductDesc desc = new GcbAggPaymentProductDesc();
	desc.setCode("P0000002");
	desc.setName("iphone 6 plus");
	desc.setQuantity("1");
	desc.setPrice("200");
	desc.setUrl("http://www.mshop.com/product?id=P0000002");
	
	List<GcbAggPaymentProductDesc> productDescList = new ArrayList<GcbAggPaymentProductDesc>();
	productDescList.add(desc);
	
	request.setProductDescList(productDescList);
	
	//非必填,扩展字段1,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt1("ext1");
	//非必填,扩展字段2,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt2("ext2");
	//必填,1:pc端支付2:移动端支付
	request.setDeviceType("1"); 
	//必填,G:转账支付(PC网关)
	request.setPayType("G");  
	//非必填,1:表示同一订单禁止重复提交标志,预留字段。2:表示 同一订单,可重复提交(订单状态为未支付成功)
	request.setRedoFlag("1");
	//非必填,1:表示分账,不上送或上送。0:表示不分账;分账需要联系我司运营进行开通配置
	request.setDivFlag("0"); 
	// 风控信息(JSON格式),留学、航空、酒店类需按要求上送。
	String riskInfo =	"{\"studentInfo\":"
					+ "	{"
					+ "		\"payAddr\":\"上海徐家汇区\","
					+ "		\"payType\":\"10\","
					+ "		\"courseType\":\"1\","
					+ "		\"studentCertId\":\"32125202108106666\","
					+ "		\"studentCertType\":\"00\","
					+ "		\"studentCertEndDate\":\"20301221\","
					+ "		\"studentNo\":\"1234567\","
					+ "		\"subProductCode\":\"SA\","
					+ "		\"studentName\":\"阿拉基\""
					+ "	}"
					+ "}";
	request.setRiskInfo(riskInfo);
	
	// 发送请求
	GcbBankTransPaymentResponse response = gcbPayClient.execute(request);
	
	//商户系统需将用户浏览器重定向到响应的url
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 接收异步示例

Java

  
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 实例化通知解析器
	GcbPayCallbackMessageParser gcbMessageParser = new DefaultGcbPayCallbackMessageParser(base64PublicKey);
	
	// 解析通知结果
	GcbBankTransPaymentResult result = gcbMessageParser.parse(httpServeletRequest, GcbBankTransPaymentResult.class);
	
	//根据结果,进行业务逻辑处理
	// ......
  													
									
  • 参数说明

调用参数详见 转账支付接口-网关模式

  • 流程示意

调用流程详见 支付流程(参见:8.转账支付-网关模式)

API模式?

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 转账支付API服务的url
	String serverUrl = "https://hfgj.testpnr.com/pay/banktransApi.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbBankTransPaymentRequest request = new GcbBankTransPaymentRequest();
	
	//必填,商户系统接受支付结果的后台地址【url公网可以访问,否则接收不到通知】
	request.setBgUrl("http://localhost:8080/notifyReceiverBg.do"); 
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");	
	//条件必填,支付人姓名,中文名,网银直连时必填
	request.setPayerName("李财水"); 
	 //条件必填,支付人身份证号码,字符串,18位身份证号;跨境结算且为直连模式时必填
	request.setPayerIdentityCard("320125198805232313");
	//非必填,支付人所持卡号
	request.setCardNumber("6225881257400000"); 
	//必填,商户订单号,只允许使用字母、数字、_,每商户提交的订单号,必须在自身账户交易中唯一
	String orderId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setOrderId(orderId); 
	//必填,订单币种,3位币别码,详情请参照币别代码附录。
	request.setOrderCurrency("CNY"); 
	//必填,结算币种,3位币别码,详情请参照币别代码附录。
	request.setSettlementCurrency("CNY");
	//必填,商户订单金额,整型数字,单位为分。日韩元支持的最小单位为元。如100元,则填写10000
	request.setOrderAmount("100"); 
	//必填,商户订单提交时间,一共14位格式为:yyyyMMddHHmmss
	String orderTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setOrderTime(orderTime); 
	//必填,商品名称
	request.setProductName("CellPhone"); 
	//必填,商品数量,整型数字
	request.setProductNum("1"); 
	//必填,商品代码,请根据我司提供的商品代码附录进行填写。
	request.setProductId("100003"); 
	
	//必填,填写规则:商品编号|商品名称|商品数量|商品单价(单位元)|商品链接;商品编号|商品名称|商品数量|商品单价(单位元)|商品链接
	GcbAggPaymentProductDesc desc = new GcbAggPaymentProductDesc();
	desc.setCode("P0000002");
	desc.setName("iphone 6 plus");
	desc.setQuantity("1");
	desc.setPrice("200");
	desc.setUrl("http://www.mshop.com/product?id=P0000002");
	
	List<GcbAggPaymentProductDesc> productDescList = new ArrayList<GcbAggPaymentProductDesc>();
	productDescList.add(desc);
	
	request.setProductDescList(productDescList);
	
	//非必填,扩展字段1,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt1("ext1");
	//非必填,扩展字段2,英文或中文字符串支付完成后,按照原样返回给商户
	request.setExt2("ext2");
	//必填,1:pc端支付2:移动端支付
	request.setDeviceType("1"); 
	//必填,F:转账支付(API)
	request.setPayType("F");  
	//非必填,1:表示同一订单禁止重复提交标志,预留字段。2:表示 同一订单,可重复提交(订单状态为未支付成功)
	request.setRedoFlag("1");
	//非必填,1:表示分账,不上送或上送。0:表示不分账;分账需要联系我司运营进行开通配置
	request.setDivFlag("0"); 
	// 风控信息(JSON格式),留学、航空、酒店类需按要求上送。
	request.setRiskInfo("{\"logisticsInfo\":{\"subProductCode\":\"LOG\"}}");
	
	// 发送请求
	GcbBankTransPaymentResponse response = gcbPayClient.execute(request);
	
	// 提取payInfo字段内容
	String payInfo = response.getPayInfo();
	Map map = JSON.parseObject(payInfo, Map.class);
	
	// 付款参考号,支付人在转账时需要填写到转账附言中
	String referenceId = (String)map.get("referenceId");
	// 汇付收款银行账户户名
	String benificiaryName = (String)map.get("benificiaryName");
	// 汇付的收款账户所属银行
	String benificiaryBank = (String)map.get("benificiaryBank");
	// 汇付收款银行地址
	String bankAddr = (String)map.get("bankAddr");
	// 汇付收款账号
	String benificiaryAcct = (String)map.get("benificiaryAcct");
	// cinapsNo
	String cinapsNo = (String)map.get("cinapsNo");
 
 	//根据响应结果,进行业务逻辑处理
	// ......
  													
									
  • 接收异步示例

Java

  
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 实例化通知解析器
	GcbPayCallbackMessageParser gcbMessageParser = new DefaultGcbPayCallbackMessageParser(base64PublicKey);
	
	// 解析通知结果
	GcbBankTransPaymentResult result = gcbMessageParser.parse(httpServeletRequest, GcbBankTransPaymentResult.class);
	
	//根据结果,进行业务逻辑处理
	// ......
  													
									
  • 参数说明

调用参数详见 转账支付接口-api(参见目录2)

  • 流程示意

调用流程详见 支付流程(参见:9.转账支付-api)

收单分账?

  • 简介

收单分账产品用于帮助特约商户完成订单收单成功后的资金分配,例如分润给合作伙伴等。商户使用分账产品前,需要帮助分账的接收方创建用户账户(参考账户管理用户开户功能:用户开户接口),分账功能在交易成功后,由商户主动发起,指定接收方的用户号和交易金额,剩余部分自动结算至商户账户。

分账申请?

用于对指定需要分账的交易发起分账,分账前需要开立对应的用户账户。

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 交易分账申请服务的url
	String serverUrl = "https://hfgj.testpnr.com/ledger/transDiv.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealDivApplyRequest request = new GcbPaymentDealDivApplyRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,请求流水号,只允许使用字母、数字、_,每个商户提交的流水号,必须在自身账户交易中唯一
	String requestId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setRequestId(requestId);
	//必填,请求时间, 数字串,一共14位。 格式:yyyyMMddHHmmss
	String requestTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setRequestTime(requestTime);
	//必填,收单系统交易号,该交易在收单系统对应的交易号。并且交易是支持分账的交易,即交易的DivFlag=1
	request.setDealId("1110000363965");
	
	//必填,分账明细, 明细笔数最多99。如:10019671|10000|描述1;1001962|20000|描述2
	GcbPaymentDealDivApplyDetail detail1 = new GcbPaymentDealDivApplyDetail();
	detail1.setUserId("10000001");
	detail1.setAmount("100");
	detail1.setDesc("desc1");
	
	GcbPaymentDealDivApplyDetail detail2 = new GcbPaymentDealDivApplyDetail();
	detail2.setUserId("10000002");
	detail2.setAmount("200");
	detail2.setDesc("desc2");
	
	List<GcbPaymentDealDivApplyDetail> detailList = new ArrayList<GcbPaymentDealDivApplyDetail>();
	detailList.add(detail1);
	detailList.add(detail2);
	
	request.setDetailList(detailList);
	
	//非必填,扩展字段1, 预留
	request.setExt1("ext1");
	//非必填,扩展字段2, 预留
	request.setExt2("ext2");
	
	// 发送请求
	GcbPaymentDealDivApplyResponse response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ......
		 
  													
											
  • 参数说明

调用参数详见 收单分账接口

  • 流程示意

调用流程详见 支付流程(参见:10.分账交易流程)

分账查询?

用于查询分账申请指令的状态,即查询分账结果。

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 分账交易结果查询服务的url
	String serverUrl = "https://hfgj.testpnr.com/ledger/transDivQuery.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealDivQueryRequest request = new GcbPaymentDealDivQueryRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,请求流水号,只允许使用字母、数字、_,每个商户提交的流水号,必须在自身账户交易中唯一
	String requestId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setRequestId(requestId);
	//必填,请求时间, 数字串,一共14位。 格式:yyyyMMddHHmmss
	String requestTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setRequestTime(requestTime);
	//必填,原分账指令中的dealId
	request.setDealId("1110000363965");
	//必填,原分账指令的请求流水号
	request.setOrigRequestId("20211020182237500");
	//非必填,扩展字段1, 预留
	request.setExt1("ext1");
	//非必填,扩展字段2, 预留
	request.setExt2("ext2");
	
	// 发送请求
	GcbPaymentDealDivQueryResponse response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ...... 
  													
											
  • 参数说明

调用参数详见 分账查询接口(参见收单分账目录2)

待分账查询?

商户可以通过该接口查询对应订单的总可分账金额、已分账金额、剩余待分账金额。

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 待分账查询服务的url
	String serverUrl = "https://hfgj.testpnr.com/ledger/unsplitQuery.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealDivAmtQueryRequest request = new GcbPaymentDealDivAmtQueryRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,请求流水号,只允许使用字母、数字、_,每个商户提交的流水号,必须在自身账户交易中唯一
	String requestId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setRequestId(requestId);
	//必填,请求时间, 数字串,一共14位。 格式:yyyyMMddHHmmss
	String requestTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setRequestTime(requestTime);
	//必填,支付成功时返回的汇付支付交易唯一流水号
	request.setDealId("1110000363965");
	//非必填,扩展字段1, 预留
	request.setExt1("ext1");
	//非必填,扩展字段2, 预留
	request.setExt2("ext2");
	
	// 发送请求
	GcbPaymentDealDivAmtQueryResponse response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 参数说明

调用参数详见 待分账查询接口(参见收单分账目录3)

分账回退?

分账交易发生退款时,从用户账户扣除金额,返还给商户。分账回退时需指定原始分账请求流水号及分账接收方。允许对同一笔分账的同一个分账方进行多次回退,总金额不超过分账指令时分给该用户的金额。分账回退不影响原始交易的分账状态,即分账回退后,原交易仍为已分账,不能再次执行分账。

  • 调用分账回退申请示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 分账回退申请服务的url
	String serverUrl = "https://hfgj.testpnr.com/ledger/rollback.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealDivRollbackApplyRequest request = new GcbPaymentDealDivRollbackApplyRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,分账回退请求流水号,只允许使用字母、数字、_、-,每个商户提交的流水号,必须在自身商户号下唯一
	String returnReqId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setReturnReqId(returnReqId);
	//必填,请求时间, 数字串,一共14位。 格式:yyyyMMddHHmmss
	String requestTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
	request.setRequestTime(requestTime);
	//必填,原分账指令的请求流水号
	request.setOrigReqId("20211020182237500");
	//必填,需要回退的原分账接收方,即资金是从该用户返还
	request.setUserId("10000001");
	//必填,CNY,单位为分,不能超过原始分给该用户的总金额。
	request.setAmount("100");
	//非必填,扩展字段1, 预留
	request.setExt1("ext1");
	//非必填,扩展字段2, 预留
	request.setExt2("ext2");
	
	// 发送请求
	GcbPaymentDealDivRollbackApplyResponse response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 调用分账回退结果查询示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 分账回退结果查询服务的url
	String serverUrl = "https://hfgj.testpnr.com/ledger/rollbackQuery.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealDivRollbackQueryRequest request = new GcbPaymentDealDivRollbackQueryRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,查询请求流水号,只允许使用字母、数字、_、-,每个商户提交的流水号,必须在自身商户号下唯一
	String queryReqId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setQueryReqId(queryReqId);
	//必填,分账回退请求流水号
	request.setReturnReqId("20211108152033761");
	//非必填,扩展字段1, 预留
	request.setExt1("ext1");
	//非必填,扩展字段2, 预留
	request.setExt2("ext2");
	
	// 发送请求
	GcbPaymentDealDivRollbackQueryResponse  response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 参数说明

调用参数详见 分账回退接口(参见收单分账目录4)

分账完结?

支付交易发生时标记需要分账,但由于商户自身需求,不再需要对该笔交易进行分账操作时,提供分账完结接口。商户调用分账完结接口对待分账交易进行完结分账,资金结算至商户账户。

  • 调用分账完结申请示例

Java

  
	// 商户的私钥(base64编码格式)
        String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";

        // 汇付国际的公钥(base64编码格式)
        String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";

        // 分账完结申请服务的url
        String serverUrl = "https://hfgj.testpnr.com/ledger/close.htm";

        // 实例化客户端
        GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);

        // 构建请求对象
        GcbPaymentDealDivCloseRequest request = new GcbPaymentDealDivCloseRequest();

        //必填,会员账号,由我司提供的商户号+01,共13位数字
        request.setMerchantAcctId("1001215986501");
        //必填,终端号,由我司提供的终端号
        request.setTerminalId("0010001");
        //必填,分账完结请求流水号,只允许使用字母、数字、_、-,每个商户提交的流水号,必须在自身商户号下唯一
        String requestId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
        request.setRequestId(requestId);
        //必填,目标交易号,对应需要执行分账完结的原支付交易的汇付交易号,可在支付流程的返回中获取。
        request.setDealId("1110000363965");
        //必填,请求时间, 数字串,一共14位。 格式:yyyyMMddHHmmss
        String requestTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        request.setRequestTime(requestTime);
        //非必填,扩展字段1, 预留
        request.setExt1("ext1");
        //非必填,扩展字段2, 预留
        request.setExt2("ext2");

        // 发送请求
        GcbPaymentDealDivCloseResponse response = gcbPayClient.execute(request);
        System.out.println(new String(response.getResponseBody()));

        //调用成功,则处理业务逻辑
        // ......
  													
											
  • 调用分账完结结果查询示例

Java

  
	// 商户的私钥(base64编码格式)
        String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";

        // 汇付国际的公钥(base64编码格式)
        String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";

        // 分账完结查询服务的url
        String serverUrl = "https://hfgj.testpnr.com/ledger/closeQuery.htm";

        // 实例化客户端
        GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);

        // 构建请求对象
        GcbPaymentDealDivCloseQueryRequest request = new GcbPaymentDealDivCloseQueryRequest();

        //必填,会员账号,由我司提供的商户号+01,共13位数字
        request.setMerchantAcctId("1001215986501");
        //必填,终端号,由我司提供的终端号
        request.setTerminalId("0010001");
        //必填,查询请求流水号,只允许使用字母、数字、_、-,每个商户提交的流水号,必须在自身商户号下唯一
        String queryReqId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
        request.setQueryReqId(queryReqId);
        //必填,分账完结指令的请求流水号
        request.setOrigReqId("1110000363965");
        //非必填,扩展字段1, 预留
        request.setExt1("ext1");
        //非必填,扩展字段2, 预留
        request.setExt2("ext2");

        // 发送请求
        GcbPaymentDealDivCloseQueryResponse response = gcbPayClient.execute(request);
        System.out.println(new String(response.getResponseBody()));

        //调用成功,则处理业务逻辑
        // ......
  													
											
  • 参数说明

调用参数详见 分账完结接口(参见收单分账目录6)

退款?

  • 简介

对成功的支付交易发起退款,支持全额或部分退款。

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 单笔交易退款申请服务的url
	String serverUrl = "https://hfgj.testpnr.com/pay/refundreceive.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealRefundRequest request = new GcbPaymentDealRefundRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,服务器接受支付结果的后台地址。bgUrl地址公网必须能访问。
	request.setBgUrl("http://localhost:8080/refundResultReciver.do");
	//必填,商户退款交易订单号,只允许使用字母、数字、_,并以_,字母或数字开头每商户提交的订单号,必须在自身账户交易中唯一
	String refundOrderId = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
	request.setRefundOrderId(refundOrderId);
	//必填,原交易订单号,只允许使用字母、数字、_,并以_,字母或数字开头每商户提交的订单号,必须在自身账户交易中唯一
	request.setOriginalOrderId("9920211020182024421");
	//必填,退货币种,字符串,3位币别码,详情请参照币别代码附录进行参考
	request.setRefundCurrency("CNY");
	//必填,退货金额,整型数字,单位为分。日韩元支持的最小单位为元。。如100元,则填写10000
	request.setRefundAmount("100");
	//非必填,退货说明,字符串
	request.setRefundDesc("refund desc");
	//非必填,扩展字段1,英文或中文字符串,交易完成后按照原样返回给商户
	request.setExt1("ext1");
	//非必填,扩展字段2,英文或中文字符串,交易完成后按照原样返回给商户
	request.setExt2("ext2");
	
	// 发送请求
	GcbPaymentDealRefundResponse response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ...... 
  													
									
  • 接收异步示例

Java

  
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 实例化通知解析器
	GcbPayCallbackMessageParser gcbMessageParser = new DefaultGcbPayCallbackMessageParser(base64PublicKey);
	
	// 解析通知结果
	GcbPaymentDealRefundResult result = gcbMessageParser.parse(httpServeletRequest, GcbPaymentDealRefundResult.class);

	//根据结果,进行业务逻辑处理
	// ......
  													
									
  • 参数说明

调用参数详见 交易退款接口

单笔交易查询?

  • 简介

用于查询支付交易或退款交易的交易状态。

  • 调用示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 单笔交易查询服务的url
	String serverUrl = "https://hfgj.testpnr.com/pay/singleTrxQuery.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbPaymentDealQueryRequest request = new GcbPaymentDealQueryRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");
	//必填,商户提交的原订单号
	request.setOrderId("9920211020182024421");
	//非必填,收单系统交易号,该交易在收单系统对应的交易号
	request.setDealId("");
	
	// 发送请求
	GcbPaymentDealQueryResponse response = gcbPayClient.execute(request);
	
	//根据响应结果,进行业务逻辑处理
	// ...... 
  													
											
  • 参数说明

调用参数详见 单笔交易查询接口

日终交易查询?

  • 简介

用于下载指定日期(当天之前)成功的支付和退款记录。先调用查询接口获取token,然后调用下载接口获取文件。

  • 查询示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 日终交易明细查询服务的url
	String serverUrl = "https://hfgj.testpnr.com/pay/dailyTxnConfirm.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbOneDayPaymentDealsQueryRequest request = new GcbOneDayPaymentDealsQueryRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");	
	// 交易日,数字串,一共8位格式为:yyyyMMdd
	request.setTrxDate("20210930");
	
	// 发送请求
	GcbOneDayPaymentDealsQueryResponse response = gcbPayClient.execute(request);
	
	// 唯一关联号,由我司提供。日终交易下载时需要上送此token
	String token = response.getToken();
	// token的过期时间,格式:yyyyMMddHHmmss。过期token下载不了日终交易
	String expTime = response.getExpTime();
	
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 下载示例

Java

  
	// 商户的私钥(base64编码格式)
	String base64PrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMpT/BKCrfkPKbMggoIQVpYL8chw8e9do+vuh5f5OsZNVm+BAtpJY+nGTBW4ggWEbtDWh4e+IsCVDzeXVDUmPO4GXro0o7QZpOVN+bo28k1x69tw65HMLTgjx3jjrQK7JdON7cqbtqWN624GVMgk5mJGu0ua+eBiOPuIBM3Re+61AgMBAAECgYEAqWvWIjHnOCzoQCSy4/KGbrKlzbA2BrgksUVVqX57Jt5PyKMBHoRh87mmsHGF/tS8boeViac/NoAa8/P2AWN5lGFl8Z9A4NlpXojA+vn7bn2fIjDzsB8s2txkmskuzzoDhUSeiPGf/HjPG7w6fl1BiHiix2xRr8Bw5wTeMJmsXQECQQDwrktdw8NP0FzmqmyFzTfz97UDsexKQfLSaFq31YydMoYlHEwsZcZhNTTBx71tni7/2eEQdVtFToAQRbEvGJBVAkEA1zTDC18DBHeGQdMwywrdc9BhbYY4a2ucc8XhRHScQzzyG4WgSFTrorLAH6QohpmFHfHm0Ws6AfDDhdQwuNTE4QJARI6hUTguLlH/5ISvHP3z7j6lBURtNknKzTyEetENmMmHhJKm8A6dj5sESB6JSuxAHwkFHxcOxJMzz27KpcutcQJAfnQNS6g3kK9e31zmJdiriXrfVMjybAReeRTEKkJO859jL9LT/MyRbReVlsIR4g1hT9gtZc6Y1j0P1pp5SpITYQJAdxwKEBXokaZwWy2gzEt3XdXBYoR5lvg/3T4GSEMBJZRmlmZpBOTbg/yYaf7lXtGUm+mZ3UZsCfJvwufit314sw==";
	
	// 汇付国际的公钥(base64编码格式)
	String base64PublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvBaKblsfXTEAFLujPiQ3PlWL1TJd+l/ApN/16BcArl6Oo18Tb6xOCLlcFBr3xgmVokc8DP32PHAQdtmS8/Y9HziMFaf8NxTNH9whA7GobU1dmVP+tI31z1S5ZO82knNW9ghbcDwLCo251AWHg5tP4wgRCBOJS+bSuyRuAW15M/wIDAQAB";
	
	// 日终交易明细文件下载服务的url
	String serverUrl = "https://hfgj.testpnr.com/pay/dailyFileDownload.htm";
	
	// 实例化客户端
	GcbPayClient gcbPayClient = new DefaultGcbPayClient(serverUrl, base64PrivateKey, base64PublicKey);
	
	// 构建请求对象
	GcbOneDayPaymentDealsDownloadRequest request = new GcbOneDayPaymentDealsDownloadRequest();
	
	//必填,会员账号,由我司提供的商户号+01,共13位数字
	request.setMerchantAcctId("1001215986501"); 
	//必填,终端号,由我司提供的终端号
	request.setTerminalId("0010001");	
	// 唯一关联号,由我司提供。调用日终交易查询接口返回的token
	request.setToken("4028cb087c15f5d8017c9ca79a680042");
	
	// 发送请求
	GcbOneDayPaymentDealsDownloadResponse response = gcbPayClient.execute(request);
	
	// 交易明细压缩文件字节流,注:压缩文件格式为zip
	byte[] fileContent = response.getFileContent();
	
	//根据响应结果,进行业务逻辑处理
	// ......
  													
											
  • 参数说明

调用参数详见 日终交易文件查询接口