public class MicropayTest {
public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com"; //testing domain
public static final String PROD_URL = "https://mapi.yuansfer.com"; //production domain
public static final String YUANSFER_TOKEN = "5c5fe30183be69fceff8174358d4b8ae";
public static void main(String[] args) {
YuansferVerifySignHelper helper = new YuansferVerifySignHelper();
AppMircopayDto dto = paramSetting();
Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(dto, new String[]{"serialVersionUID"});
String verifySign = helper.getYuansferVerifySign(params, YUANSFER_TOKEN);
params.put("verifySign", verifySign);
String url = TEST_URL + "/micropay/v2/prepay";
String ret = HttpClientUtils.post(url, null, params);
public static AppMircopayDto paramSetting() {
AppMircopayDto dto = new AppMircopayDto();
* merchantNo,storeNo is necessory, and they are provided by Yuansfer
dto.setMerchantNo("200043"); //The Merchant NO.
dto.setStoreNo("300014"); //The Store NO.
* transaction infomation is necessory
dto.setAmount("0.01"); //The amount, unit "division"
dto.setCurrency("USD"); //currency, "USD"
dto.setSettleCurrency("USD"); //SettleCurrency, "USD"
dto.setIpnUrl("https://nengjtian.s1.natapp.cc/login/test"); //Asynchronous callback address
dto.setReference("9091023122"); //order NO. of client's system
dto.setOpenid("***"); //wechat openid
dto.setVendor("wechatpay"); //"wechatpay"
* note,desription are optional
dto.setDescription("test-description"); //description
dto.setNote("test-note"); //note