asiapay支付调用

国际信用卡支付,官方有英文也有中文文档,
登录后可以看中文文档
[url]https://test.paydollar.com/b2cDemo/gb/merchant/mis_index.html[/url]
[img]http://dl2.iteye.com/upload/attachment/0127/3580/f1c0b3cc-16c3-3852-b7c1-4f9415f57711.png[/img]
[url]https://test.paydollar.com/b2cDemo/gb/merchant/download/PayDollar_Merchant_User_Guide_gb_v3-5.pdf[/url]

引入sdk包:
  <properties>
<!-- asiapay -->
<version.asiapay>1.0</version.asiapay>
</properties>
<dependencies>
<!-- asiapay -->
<dependency>
<groupId>com.asiapay</groupId>
<artifactId>asiapay</artifactId>
<version>${version.asiapay}</version>
</dependency>
</dependencies>


代码:

public PaymentFormEntity doGetPaymentFormEntity(
OrderPaymentInfo paymentInfo,
String payMethodParm){

String lang = LangUtil.getCurrentLang();

String templateId="";
// String amount = String.valueOf(SalesOrderCommand.getTotal().add(SalesOrderCommand.getActualFreight()));
// String language = paymentParamCommand.getLanguage();
// String language = LangUtil.getCurrentLang();
// String payMethod = SalesOrderCommand.getPayInfo().get(0).getPayInfo();
String soCode = paymentInfo.getSerialNumber();// 使用流水号
//socode cancleUrl successUrl bankCode language totalFee
Map<String, String> params = new HashMap<String, String>();
// 商户号,商家代号
params.put("merchantId", merchantId);
// 商家要向客户收取的总金额(小数字)
params.put("amount", paymentInfo.getPayAmount().toString());
// 商家订单编号,商家的订单参考号
params.put("orderRef", soCode);
// 支付货币的种类 “344” – HKD “840” – USD “702” – SGD “156” - CNY(RMB)
params.put("currCode", currCode);
// mpsMode = SCP, the currCode value should be in foreign currency.
// mpsMode = MCP, the currCode value should be in base currency.
params.put("mpsMode", mpsMode);
params.put("successUrl", successUrl);
params.put("failUrl", failUrl);
params.put("cancelUrl", cancelUrl);
// “N”-正常支付(销售)“h”-持有付款(仅授权)
params.put("payType", payType);
if ("zh_HK".equals(lang)){
// “C” – Traditional Chinese 繁体中文
params.put("lang", "C");
templateId = "1";
}else if ("en_US".equals(lang)){
// “E” – English 英语
params.put("lang", "E");
templateId = "2";
}else{
params.put("lang", "C");
templateId = "1";
}
params.put("templateId", templateId);
// 商人的订单号,商户订单参考编号
params.put("Ref", soCode);
params.put("remark","");
// 重定向次数
params.put("redirect", redirect);
// 344 – “HK” 840 – “US”
params.put("oriCountry", oriCountry);
// 344 – “HK” 840 – “US”
params.put("destCountry", destCountry);
// 支付用信用卡的种类
// “ALL” – All the available payment method
// “CC” – Credit Card Payment
// “VISA” – Visa Payment
// “Master” – MasterCard Payment
if (Validator.isNotNullOrEmpty(payMethodParm)){
params.put("payMethod", payMethodParm); // aispay 支付方式提交后不能变更
}else{
params.put("payMethod", "ALL");
}
String secureHash = SHA1(merchantId,soCode, currCode, paymentInfo.getPayAmount().toString(), payType, secureHashSecret);
if (secureHash != null){
params.put("secureHash", secureHash);
}
PaymentFormEntity paymentFormEntity = new PaymentFormEntity();
paymentFormEntity.setAction(postUrl);
paymentFormEntity.setMethod("post");
paymentFormEntity.setHiddenParamMap(params);
return paymentFormEntity;
}

private String SHA1(String merchantId,String orderRef,String currCode,String amount,String payType,String serurityKey ){
try{
PaydollarSecure paydollarSecure = PaydollarSecureFactory.getPaydollarSecure("SHA");
return paydollarSecure.generatePaymentSecureHash(merchantId, orderRef, currCode, amount, payType, serurityKey);
}catch (Exception e){
e.printStackTrace();
}
return null;
}


主要用到两个参数:
商户号,安全密钥
[img]http://dl2.iteye.com/upload/attachment/0127/3584/3c846055-ec6b-3f45-a99b-4d5128d3248f.png[/img]

账号申请后,asiapay会发送用户邮件:
Dear Merchant,

Thanks for your interest in PayDollar payment services and solutions, and we are pleased to set up a testing PayDollar account for you.

Please kindly find the PayDollar Merchant User Guide http://www.paydollar.com/pdf/op/enuserguide.pdf
and PayDollar Integration Guide http://www.paydollar.com/pdf/op/enpdintguide.pdf

Meanwhile, please follow the following steps to complete the setup at your end.

FOR PAYMENT INTEGRATION DEVELOPER

1) Payment Connection Page (implement it with your own payment page)

Merchant Id = 8******4

Currency = HKD

Client Post Method (input card number at our side) = https://test.paydollar.com/b2cDemo/eng/payment/payForm.jsp

2) Access to Merchant Administration functions: e.g. Transaction Report

Merchant Admin link= https://test.paydollar.com/b2cDemo/eng/merchant/index.html

Merchant Id = 88*****4
Login Name = admin
Password = (Password will be sent in the following email)

API Login Name: adminAPI
API Password = (Password will be sent in the following email)

3) Testing Card Accounts - (please use the following accounts on testing platform)

VISA 3D - 4335900000140045 Exp date: 07, 2020, Cardholder name: testing card,CVC2: 123 3D password: password
MasterCard - 5422882800700007, Exp date: 07, 2020, Cardholder name: testing card, CVC2: 123
AMEX - 371891410719507, Exp date: 07, 2020, 4DBC: 1234
AliPay - Account name: alipaytest20091@gmail.com, Login Password: 111111, Payment Password: 111111

4) Use of Datafeed Page and Processing

To implement the datafeed page to get our return payment result data, please refer the System Integration guide for more details and you can enable or disable the data feed function in the merchant administration site > Profile > Payment Options

5) IP Checking Function

Please note that transactions will be rejected if same payer IP attempted more than pre-defined no. a day which is 10 times by default. This checking can be disabled or the number can be increased according to your need. If you wish to adjust it, please kindly log into our admin page and go to risk control > other security control to update the checking accordingly.

6) Secure hash secret: KVFsf**********KjhW7Rvy5B


配置回调:

[img]http://dl2.iteye.com/upload/attachment/0128/6637/01eb523a-03ff-3fb4-b820-1b56dd7ede61.png[/img]


坑一:这里比较坑爹的是默认对ip有限制,限制高风险国家,和调用次数。
如果限制了,支付后回调里successcode=1,永远支付不成功。
需要登录账号,到风险控制里去设置ip:
[img]http://dl2.iteye.com/upload/attachment/0127/4542/7a52fc91-5d6b-368e-99ef-839ca27e7e37.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0127/4544/03c961b2-9a49-375c-9a25-d60a8f81271f.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0127/4546/0a2b9f14-7fb0-318c-9cf4-b352b38300a5.png[/img]

坑二:
信用卡支付可以不断的跳出新的支付链接
支付宝跳第二次时报:
Duplicate merchant reference no.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值