哪位整合过外国的paypal支付接口呢?
哪位整合过外国的paypal支付接口呢?
支付成功后,返回页面,并修改数据库里的订单状态,应该怎么做?
[解决办法]
不知道paypal。弄过国内的epay
[解决办法]
只搞过国内的支付宝支付
[解决办法]
其实支付原理都一样..
将参数传递过去...然后接收传回来的数据.
[解决办法]
up
[解决办法]
#region HTTP 方式
//****读取要发送凭证的XML文件
private string GetPZINFOXML()
{
//*****得到要读取文件哈
string XMLFileNamePath = Server.MapPath( "../UploadFile/NCXML/ " + hidNCXMLFileName.Value + ".xml ");
//*****加载要发送的凭证文件
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(XMLFileNamePath);
//*****读取文件信息
string URLData = xmlDoc.InnerXml.ToString();
//*****返回文件信息
return URLData;
}
//*****第一种方法
private string HTTPPostPZ(string NCXmlContent, bool IsReadXML)
{
try
{
//****NC接收地址
string uriString = AppLibrary.AppGlobal.GetZWConfigValue( "B_NC_URL ");
//****需要提交的XML文件
string postString = " ";
if (IsReadXML == true)
{
postString = GetPZINFOXML();
}
else
{
postString = NCXmlContent;
}
Encoding encoder = Encoding.GetEncoding( "gb2312 ");
//****初始化WebClient
WebClient webClient = new WebClient();
webClient.Headers.Add( "Content-Type ", "text/xml; charset=gb2312 ");
//****将字符串转换成字节数组,转换XML为流得形式,进行相应的处理
byte[] postData = encoder.GetBytes(postString);
//****上传数据,返回页面的字节数组
byte[] responseData = webClient.UploadData(uriString, "POST ", postData);
//*****返回的将字节数组转换成字符串(HTML)
string srcString = encoder.GetString(responseData);
//****得到NC处理返回得值
return srcString;
}
catch
{
return " ";
}
}
#endregion
#region SOAP 方式
//****第二种方法
private string SOAPPostPZ(string NCXmlContent, bool IsReadXML)
{
//****NC接收地址
string uriString = AppLibrary.AppGlobal.GetZWConfigValue( "B_NC_URL ");
Encoding encoder = Encoding.GetEncoding( "gb2312 ");
//****需要提交的XML文件
string soapMessage = " ";
if (IsReadXML == true)
{
soapMessage = GetPZINFOXML();
}
else
{
soapMessage = NCXmlContent;
}
MSXML.XMLHTTPRequest xmlHttp = new MSXML.XMLHTTPRequest();
xmlHttp.open( "post ", uriString, false, null, null);
xmlHttp.setRequestHeader( "Content-Type ", "text/xml; charset=gb2312 ");
xmlHttp.setRequestHeader( "SOAPAction ", "http://tempuri.org/HelloWorld ");
//****将字符串转换成字节数组,转换XML为流得形式,进行相应的处理
byte[] postData = encoder.GetBytes(soapMessage);
xmlHttp.send(postData);
//****得到NC处理结果的返回值
return xmlHttp.responseText.ToString();
}
#endregion
#endregion
#region 发送接口
//****传递接口
private void PZSendInterface(string mF_PZZB_ID)
{
//****清空己有的发送提示信息
hidSendMessage.Value = " ";
int Securiyt = 0;
int Error = 0;
int Repeat = 0;
//****拆分传递的凭证
string[] DBParamters = mF_PZZB_ID.Split( ', ');
foreach (string F_PZZB_ID in DBParamters)
{
if (F_PZZB_ID != " ")
{
//*****生成要发送的凭证NC XML接口
string BulidPZNCXmlFile = Build_PZ_XML(Convert.ToInt64(F_PZZB_ID), false);
string NCReturnString = " ";
//****得到NC返回来的接口
NCReturnString = HTTPPostPZ(BulidPZNCXmlFile, false);
if (NCReturnString != " ")
{
//****加载返回业的XML文件
XmlDocument XmlDoc = new XmlDocument();
//****加载NC 返回的XML文件
XmlDoc.LoadXml(NCReturnString);
System.Xml.XmlElement root = XmlDoc.DocumentElement;
XmlNode xmlNode = root.SelectSingleNode( "//resultcode ");
//****获取传递凭证,返回文档信息
XmlNode resultdescription = root.SelectSingleNode( "//resultdescription ");
//****得到返回来的状态哈
int resultcode = Convert.ToInt32(xmlNode.InnerText);
//****获取返回来的文件说明信息
string mresultdescription = resultdescription.InnerText.Replace( "\r\n ", " ").Replace( "\r ", " ").Replace( "\n ", " ");
switch (resultcode)
{
case 1://*****发送成功
//****更新传递状态
AppLibrary.AppGlobal.UpdatePZSendState(Convert.ToInt64(F_PZZB_ID));
//****记录传凭成功条数
Securiyt++;
break;
case -1://*****发送重复
//****记录传递重复条数
Repeat++;
break;
default://*****没有发送成功哈
//*****记录传递失败条数
Error++;
break;
}
if (hidSendMessage.Value == " ")
{
hidSendMessage.Value = " " + mresultdescription;
}
else
{
hidSendMessage.Value += " <br> " + " " + mresultdescription;
}
}
}
}
//*****调用凭证传递函数
Page.ClientScript.RegisterStartupScript(typeof(string), "HiddProc ", " <script> HiddenProccess( ' " + Securiyt + " ', ' " + Error + " ', ' " +Repeat+ " '); </script> ");
}
#endregion
[解决办法]
原理都一样,就看程序怎么实现,按照需求写就行了!