分享

快钱接口

 CevenCheng 2010-10-09

请求快钱的参数

  1. package com.bitmyth.pay.domain;  
  2.   
  3. import com.bitmyth.util.MD5;  
  4. /** 
  5.  * 快钱接口REQUEST 
  6.  */  
  7. public class PayBillRequest {  
  8.     /** 
  9.      * 商户编号 
  10.      */  
  11.     private String merchant_id = "";  
  12.     /** 
  13.      * 商户密钥 
  14.      */  
  15.     private String merchant_key = "";  
  16.     /** 
  17.      * 订单编号 
  18.      */  
  19.     private String orderid = "";  
  20.     /** 
  21.      * 订单金额 
  22.      */  
  23.     private int amount = 0;  
  24.     /** 
  25.      * 货币类型,1为人民币 
  26.      */  
  27.     private String curr = "1";  
  28.     /** 
  29.      * 是否安全校验,2为必校验,推荐 
  30.      */  
  31.     private String isSupportDES = "2";  
  32.     /** 
  33.      * 支付结果返回地址 
  34.      */  
  35.     private String merchant_url = "";  
  36.     /** 
  37.      * 支付人真实姓名 
  38.      */  
  39.     private String pname = "";  
  40.     /** 
  41.      * 商品信息 
  42.      */  
  43.     private String commodity_info = "";  
  44.     /** 
  45.      * 商户私有参数 
  46.      */  
  47.     private String merchant_param = "";  
  48.     /** 
  49.      * 传递email到快钱网关页面 
  50.      */  
  51.     private String pemail = "";  
  52.     /** 
  53.      * 代理/合作伙伴商户编号 
  54.      */  
  55.     private String pid = "";  
  56.     /** 
  57.      * 加密串 
  58.      */  
  59.     private String mac = "";  
  60.     public String getMerchant_id() {  
  61.         return merchant_id;  
  62.     }  
  63.     public void setMerchant_id(String merchant_id) {  
  64.         this.merchant_id = merchant_id;  
  65.     }  
  66.     public String getMerchant_key() {  
  67.         return merchant_key;  
  68.     }  
  69.     public void setMerchant_key(String merchant_key) {  
  70.         this.merchant_key = merchant_key;  
  71.     }  
  72.     public String getOrderid() {  
  73.         return orderid;  
  74.     }  
  75.     public void setOrderid(String orderid) {  
  76.         this.orderid = orderid;  
  77.     }  
  78.     public int getAmount() {  
  79.         return amount;  
  80.     }  
  81.     public void setAmount(int amount) {  
  82.         this.amount = amount;  
  83.     }  
  84.     public String getCurr() {  
  85.         return curr;  
  86.     }  
  87.     public void setCurr(String curr) {  
  88.         this.curr = curr;  
  89.     }  
  90.     public String getIsSupportDES() {  
  91.         return isSupportDES;  
  92.     }  
  93.     public void setIsSupportDES(String isSupportDES) {  
  94.         this.isSupportDES = isSupportDES;  
  95.     }  
  96.     public String getMerchant_url() {  
  97.         return merchant_url;  
  98.     }  
  99.     public void setMerchant_url(String merchant_url) {  
  100.         this.merchant_url = merchant_url;  
  101.     }  
  102.     public String getPname() {  
  103.         return pname;  
  104.     }  
  105.     public void setPname(String pname) {  
  106.         this.pname = pname;  
  107.     }  
  108.     public String getCommodity_info() {  
  109.         return commodity_info;  
  110.     }  
  111.     public void setCommodity_info(String commodity_info) {  
  112.         this.commodity_info = commodity_info;  
  113.     }  
  114.     public String getMerchant_param() {  
  115.         return merchant_param;  
  116.     }  
  117.     public void setMerchant_param(String merchant_param) {  
  118.         this.merchant_param = merchant_param;  
  119.     }  
  120.     public String getPemail() {  
  121.         return pemail;  
  122.     }  
  123.     public void setPemail(String pemail) {  
  124.         this.pemail = pemail;  
  125.     }  
  126.     public String getPid() {  
  127.         return pid;  
  128.     }  
  129.     public void setPid(String pid) {  
  130.         this.pid = pid;  
  131.     }  
  132.     /** 
  133.      * 这个方法一定要最后调用 
  134.      * 生成加密串,注意顺序 
  135.      */  
  136.     public String getMac() {  
  137.         String ScrtStr = "merchant_id=" + this.merchant_id + "&orderid=" + this.orderid  
  138.         + "&amount=" + this.amount + "&merchant_url=" + this.merchant_url  
  139.         + "&merchant_key=" + this.merchant_key;  
  140.         mac = MD5.getMD5Str(ScrtStr);  
  141.         return mac;  
  142.     }  
  143. }  

快钱返回的参数

  1. package com.bitmyth.pay.domain;  
  2.   
  3. import com.bitmyth.util.MD5;  
  4. /** 
  5.  * 快钱接口RESPONSE 
  6.  */  
  7. public class PayBillResponse {  
  8.     private String merchant_key = "";  
  9.     private String merchant_id = "";// 获取商户编号  
  10.     private String orderid = "";// 获取订单编号  
  11.     private String amount = "";// 获取订单金额  
  12.     private String dealdate = "";// 获取交易日期  
  13.     private String succeed = "";// 获取交易结果,Y成功,N失败  
  14.     private String mac = "";// 获取安全加密串  
  15.     private String merchant_param = "";// 获取商户私有参数  
  16.     private String couponid = "";// 获取优惠券编码  
  17.     private String couponvalue = "";// 获取优惠券面额  
  18.     public String getMerchant_key() {  
  19.         return merchant_key;  
  20.     }  
  21.     public void setMerchant_key(String merchant_key) {  
  22.         this.merchant_key = merchant_key;  
  23.     }  
  24.     public String getMerchant_id() {  
  25.         return merchant_id;  
  26.     }  
  27.     public void setMerchant_id(String merchant_id) {  
  28.         this.merchant_id = merchant_id;  
  29.     }  
  30.     public String getOrderid() {  
  31.         return orderid;  
  32.     }  
  33.     public void setOrderid(String orderid) {  
  34.         this.orderid = orderid;  
  35.     }  
  36.     public String getAmount() {  
  37.         return amount;  
  38.     }  
  39.     public void setAmount(String amount) {  
  40.         this.amount = amount;  
  41.     }  
  42.     public String getDealdate() {  
  43.         return dealdate;  
  44.     }  
  45.     public void setDealdate(String dealdate) {  
  46.         this.dealdate = dealdate;  
  47.     }  
  48.     public String getSucceed() {  
  49.         return succeed;  
  50.     }  
  51.     public void setSucceed(String succeed) {  
  52.         this.succeed = succeed;  
  53.     }  
  54.     public String getRemoteMac() {  
  55.         return mac;  
  56.     }  
  57.     public void setMac(String mac) {  
  58.         this.mac = mac;  
  59.     }  
  60.     public String getMerchant_param() {  
  61.         return merchant_param;  
  62.     }  
  63.     public void setMerchant_param(String merchant_param) {  
  64.         this.merchant_param = merchant_param;  
  65.     }  
  66.     public String getCouponid() {  
  67.         return couponid;  
  68.     }  
  69.     public void setCouponid(String couponid) {  
  70.         this.couponid = couponid;  
  71.     }  
  72.     public String getCouponvalue() {  
  73.         return couponvalue;  
  74.     }  
  75.     public void setCouponvalue(String couponvalue) {  
  76.         this.couponvalue = couponvalue;  
  77.     }  
  78.     public String getLocalMac(){  
  79.         String ScrtStr = "merchant_id="+this.merchant_id+"&orderid="+this.orderid+"&amount="+this.amount+"&date="+this.dealdate+"&succeed="+this.succeed+"&merchant_key="+this.merchant_key;  
  80.         String rest = MD5.getMD5Str(ScrtStr);  
  81.         return rest;  
  82.     }  
  83. }  

把这些参数条件用POST方法提交到快钱

  1. <%@page contentType="text/html; charset=GBK"%>  
  2. <%@taglib uri="http://java./jsp/jstl/core" prefix="c"%>  
  3. <%@ taglib uri="http://java./jsp/jstl/fmt" prefix="fmt" %>  
  4. <%@ taglib uri="/WEB-INF/Token.tld" prefix="t"%>  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www./TR/html4/loose.dtd">  
  6. <html>  
  7. <head>  
  8. <title>鲜花预定</title>  
  9. <meta http-equiv="Pragma" content="no-cache" />  
  10. <meta http-equiv="Cache-Control" content="no-cache" />  
  11. <meta http-equiv="Expires" content="0" />  
  12. <mce:script type="text/javascript"><!--  
  13.     function goPayBill(){  
  14.         document.myform.submit();  
  15.     }  
  16. // --></mce:script>  
  17. </head>  
  18. <body onload="goPayBill()">  
  19. <form action="https://www./webapp/receiveMerchantInfoAction.do" method="post" name="myform">  
  20. <input type="hidden" name="merchant_id" value="${pay.merchant_id}">  
  21. <input type="hidden" name="merchant_key" value="${pay.merchant_key}">  
  22. <input type="hidden" name="orderid" value="${pay.orderid}">  
  23. <input type="hidden" name="amount" value="${pay.amount}">  
  24. <input type="hidden" name="curr" value="${pay.curr}">  
  25. <input type="hidden" name="isSupportDES" value="${pay.isSupportDES}">  
  26. <input type="hidden" name="merchant_url" value="${pay.merchant_url}">  
  27. <input type="hidden" name="pname" value="${pay.pname}">  
  28. <input type="hidden" name="commodity_info" value="${pay.commodity_info}">  
  29. <input type="hidden" name="merchant_param" value="${pay.merchant_param}">  
  30. <input type="hidden" name="pemail" value="${pay.pemail}">  
  31. <input type="hidden" name="pid" value="${pay.pid}">  
  32. <input type="hidden" name="mac" value="${pay.mac}">  
  33. </form>  
  34. </body>  
  35. </html>  

这样就搞定了,快钱返回的参数上面已经给出,找个连接接着返回的参数就是了...

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多