欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#支付寶新版支付請(qǐng)求接口調(diào)用

 更新時(shí)間:2018年07月13日 08:45:54   作者:lwpoor123  
這篇文章主要為大家詳細(xì)介紹了C#支付寶新版支付請(qǐng)求接口調(diào)用,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了C#支付寶新版支付請(qǐng)求接口調(diào)用的具體代碼,供大家參考,具體內(nèi)容如下

因?yàn)橹Ц秾氁呀?jīng)集成了完整的SDK,所以可以使用SDK直接調(diào)用API,這里獲取SDK源碼。

首先我們需要引用支付寶SDK集成 AopSdk.dll。

添加相關(guān)引用:

using Aop.Api;
using Aop.Api.Domain;
using Aop.Api.Request;
using Aop.Api.Response;

需要用到商戶私鑰,支付寶公鑰,請(qǐng)求地址等公共參數(shù),所以可以新建一個(gè)config文件:

public class newalipayconfig
{
 public newalipayconfig()
 {
 //
 // TODO: 在此處添加構(gòu)造函數(shù)邏輯
 //
 }
 // 應(yīng)用ID,您的APPID
 public static string app_id = "";
 
 // 支付寶網(wǎng)關(guān)
 public static string gatewayUrl = "https://openapi.alipay.com/gateway.do";
 
 // 支付寶公鑰,查看地址:https://openhome.alipay.com/platform/keyManage.htm 對(duì)應(yīng)APPID下的支付寶公鑰。 
 public static string alipay_public_key = "";
      
 // 商戶私鑰,您的原始格式RSA私鑰
 public static string private_key = "";
 
 // 簽名方式
 public static string sign_type = "RSA2";
 
 // 編碼格式
 public static string charset = "UTF-8";
}

支付請(qǐng)求處理頁面:

DefaultAopClient client = new DefaultAopClient(newalipayconfig.gatewayUrl, newalipayconfig.app_id, newalipayconfig.private_key, "json", version, newalipayconfig.sign_type, newalipayconfig.alipay_public_key, newalipayconfig.charset, false);
 
 if (order != null)
 {
  // 支付中途退出返回商戶網(wǎng)站地址
  string quit_url = "www.alipay.com";
 
  // 組裝業(yè)務(wù)參數(shù)model
  AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
  model.Body = body; //商品描述
  model.Subject = subject; //商品名稱
  model.TotalAmount = total_amount; ////訂單總金額,單位為元,精確到小數(shù)點(diǎn)后兩位,取值范圍[0.01,100000000]
  model.OutTradeNo = out_trade_no; //商戶網(wǎng)站唯一訂單號(hào)
  model.ProductCode = "QUICK_WAP_WAY";//銷售產(chǎn)品碼,商家和支付寶簽約的產(chǎn)品碼。
  model.QuitUrl = quit_url;
 
  AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
  // 設(shè)置支付完成同步回調(diào)地址
  request.SetReturnUrl(AlipayConfig.Call_back_url);
  // 設(shè)置支付完成異步通知接收地址
  request.SetNotifyUrl(AlipayConfig.Notify_url);
  // 將業(yè)務(wù)model載入到request
  request.SetBizModel(model);
 
  AlipayTradeWapPayResponse response = null;
  try
  {
  response = client.pageExecute(request, null, "post");
  Response.Write(response.Body);
  }
  catch (Exception exp)
  {
  throw exp;
  }
 }

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論