快钱接口实例

//////////Send.aspx///////////////////////////////////

<script Language="C#" runat="server">
/**
 * @Description: 快钱网关接口范例
 * @Copyright (c) 上海快钱信息服务有限公司
 * @version 2.0
 */

 void Page_Load(Object sender, EventArgs E){ 
 
 String merchant_id.Value = "879905060103109788";  ///商户编号
 String merchant_key="99billKeyForTest";  ///商户密钥
 String orderid.Value="0226001";  ///订单编号
 String amount.Value="0.02";  ///订单金额
 String currency.Value="1";  ///货币类型,1为人民币
 String isSupportDES.Value="2";  ///是否安全校验,2为必校验,推荐

 String merchant_url.Value="";  ///支付结果返回地址
 String pname.Value="";  ///支付人姓名,如果含中文请通过System.Web.HttpUtility.UrlEncode()编码
 String commodity_info.Value="";  ///商品信息,如果含中文请通过System.Web.HttpUtility.UrlEncode()编码
 String merchant_param.Value="";  ///商户私有参数
 
 String pemail.Value="";  ///传递email到快钱网关页面
 String pid.Value="";  ///代理/合作伙伴商户编号

 ///生成加密串,注意顺序
 String ScrtStr="merchant_id=" + merchant_id.Value + "&orderid=" + orderid.Value + "&amount=" + amount.Value + "&merchant_url=" + merchant_url.Value + "&merchant_key=" +merchant_key;
 mac.Value=FormsAuthentication.HashPasswordForStoringInConfigFile(ScrtStr, "MD5") ;
 
  
  
 ///以下输出提示
 Lab_orderid.Text=orderid.Value;
 Lab_amount.Text=amount.Value;
 Lab_pname.Text=pname.Value;
 Lab_commodity_info.Text=commodity_info.Value;

   }
</script>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
 <head>
  <title>快钱99bill</title>
  <meta http-equiv="content-type" content="text/html; charset=gb2312" />
 </head>
 
<body>
 
 <div align="center">
  <table width="259" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" >
   <tr bgcolor="#FFFFFF">
    <td width="68">订单编号:</td>
     <td width="182"><asp:label id="Lab_orderid" RunAt="Server"/></td>
   </tr>
   <tr bgcolor="#FFFFFF">
    <td>订单金额:</td>
     <td><asp:label id="Lab_amount" RunAt="Server"/></td>
   </tr>
   <tr bgcolor="#FFFFFF">
    <td>支付人:</td>
     <td><asp:label id="Lab_pname" RunAt="Server"/></td>
   </tr>
   <tr bgcolor="#FFFFFF">
    <td>商品名称:</td>
     <td><asp:label id="Lab_commodity_info" RunAt="Server"/></td>
   </tr>
   <tr>
    <td></td><td></td>
   </tr>
   </table>
 </div>


  <div align="center" style="font-size=12px;font-weight: bold;color=red;">
  <form name="frm" method="post" action="https://www.99bill.com/webapp/receiveMerchantInfoAction.do">
   <input id="merchant_id" type="hidden" runat="server">
   <input id="orderid"  type="hidden"  runat="server">
   <input id="amount"  type="hidden"  runat="server">
   <input id="currency"  type="hidden"  runat="server">
   <input id="isSupportDES"  type="hidden"  runat="server">
   <input  id="mac"  type="hidden"  runat="server">
   
   <input id="merchant_url"  type="hidden"  runat="server">
   <input id="pname"  type="hidden"  runat="server">
   <input id="commodity_info"  type="hidden"  runat="server">
   <input id="merchant_param" type="hidden"   runat="server">

   <input id="pemail" type="hidden"   runat="server">
   <input id="pid" type="hidden"   runat="server">
   
   <input name="payby99bill"  type="image" src="../about99bill/button/button_99bill_tj1.gif"  value="快钱支付">
  </form>
          可以支持银行卡、快钱账户、银行或邮局汇款方式支付.还可参加积分换礼活动!<a href="http://www.99bill.com/index/hd/99bill_hd2.html" target="_blank" class="font-size: 12px;">&gt;&gt;&gt;详情点击</a>
  </div>
 
</body>
</html>





////////////////////////Receive.aspx///////////////////////////////////




<script Language="C#" runat="server">
/**
 * @Description: 快钱网关接口范例
 * @Copyright (c) 上海快钱信息服务有限公司
 * @version 2.0
 */
 void Page_Load(Object sender, EventArgs E){ 
 
 String merchant_key ="99billKeyForTest";  ///商户密钥
 
 String merchant_id =Request["merchant_id"].ToString() ;  ///获取商户编号
 String orderid =Request["orderid"].ToString() ;  ///获取订单编号
 String amount =Request["amount"].ToString() ;  ///获取订单金额
 String dealdate =Request["date"].ToString() ;  ///获取交易日期
 String succeed =Request["succeed"].ToString() ;  ///获取交易结果,Y成功,N失败
 String mac =Request["mac"].ToString() ;  ///获取安全加密串
 String merchant_param =Request["merchant_param"].ToString() ;  ///获取商户私有参数

 String couponid =Request["couponid"].ToString() ;  ///获取优惠券编码
 String couponvalue =Request["couponvalue"].ToString() ;  ///获取优惠券面额
 
  ///生成加密串,注意顺序
   String SrctStr = "merchant_id=" + merchant_id + "&orderid=" + orderid + "&amount=" + amount + "&date=" + dealdate + "&succeed=" + succeed + "&merchant_key=" + merchant_key; 
   String mymac=FormsAuthentication.HashPasswordForStoringInConfigFile(SrctStr, "MD5") ;

 
 String v_result="失败";
  
 if(mac==mymac){
  
   if(succeed=="Y"){  ///支付成功
    
    v_result="成功";
    /*
    #商户网站逻辑处理#
    */
   
   }else{  ///支付失败
  
    
   }
  
 }else{  ///签名错误
 
   
 }

 
 ///以下输出提示
 Lab_orderid.Text=orderid;
 Lab_amount.Text=amount;
 Lab_result.Text=v_result;

   }
  
</script>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
 <head>
  <title>快钱99bill</title>
  <meta http-equiv="content-type" content="text/html; charset=gb2312" />
 </head>
 
 <body>
  
  <div align="center">
  <table width="259" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" >
   <tr bgcolor="#FFFFFF">
    <td width="68">订单编号:</td>
     <td width="182"><asp:label id="Lab_orderid" RunAt="Server"/></td>
   </tr>
   <tr bgcolor="#FFFFFF">
    <td>订单金额:</td>
     <td><asp:label id="Lab_amount" RunAt="Server"/></td>
   </tr>
   <tr bgcolor="#FFFFFF">
    <td>支付结果:</td>
     <td><asp:label id="Lab_result" RunAt="Server"/></td>
   </tr>
   </table>
 </div>

 </body>
</html>

posted @ 2007-04-17 13:53  海底的鱼  阅读(5262)  评论(1编辑  收藏  举报