
说明书原文:
You'll need to create an API username for PayPal that's different from your shopping cart's username You can access PayPal via API only if you have a PayPal Premier / Business / Website Payments Pro account [需要在你的后台设定API用户名,只有Paypal高级与商业用户可以使用API。]
Follow these steps:
Log in to your PayPal Business account [登陆paypal账户。]
Click the My Account tab [进入我的账户。]
Click the Profile tab If you haven't already done so, you need to verify your account before requesting API credentials [已认证用户,进入我的设置。]
Click Request API credentials under Account information [在Account information里点击Request API credentials。]
Click Set up PayPal API credentials and permissions under Option 1[在Option 1区域点击Set up Paypal API credentials and permissions]
Click Request API Credentials[点击Request API Credentials。]
Click Request API signature[点击Request API 签名。]
Click Agree and Submit[点击同意和提交。]
Copy and paste the API username, password, and signature into your shopping cart's configuration or administration screen[复制粘贴API的用户名,密码,和签名到你的网站后台设置。]
Complete the process by following your shopping cart's final steps[剩下的 *** 作步骤转至你的后台。]
/// <summary> /// 验证微信签名 /// </summary> /// 将token、timestamp、nonce三个参数进行字典序排序 /// 将三个参数字符串拼接成一个字符串进行sha1加密 /// 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信。 /// <returns></returns> private bool CheckSignature() { string signature = RequestQueryString["signature"]; string timestamp = RequestQueryString["timestamp"]; string nonce = RequestQueryString["nonce"]; string[] ArrTmp = { Token, timestamp, nonce }; ArraySort(ArrTmp); //字典排序 string tmpStr = stringJoin("", ArrTmp); tmpStr = FormsAuthenticationHashPasswordForStoringInConfigFile(tmpStr, "SHA1"); tmpStr = tmpStrToLower(); if (tmpStr == signature) { return true; } else { return false; } } public static bool CheckSignature(String signature, String timestamp, String nonce) { String[] arr = new String[] { Token, timestamp, nonce }; // 将token、timestamp、nonce三个参数进行字典序排序 ArraySort<String>(arr); StringBuilder content = new StringBuilder(); for (int i = 0; i < arrLength; i++) { contentAppend(arr[i]); } String tmpStr = SHA1_Encrypt(contentToString()); // 将sha1加密后的字符串可与signature对比,标识该请求来源于微信 return tmpStr != null tmpStrEquals(signature) : false; } /// <summary> /// 使用缺省密钥给字符串加密 /// </summary> /// <param name="Source_String"></param> /// <returns></returns> public static string SHA1_Encrypt(string Source_String) { byte[] StrRes = EncodingDefaultGetBytes(Source_String); HashAlgorithm iSHA = new SHA1CryptoServiceProvider(); StrRes = iSHAComputeHash(StrRes); StringBuilder EnText = new StringBuilder(); foreach (byte iByte in StrRes) { EnTextAppendFormat("{0:x2}", iByte); } return EnTextToString(); } private void Valid() { string echoStr = RequestQueryString["echoStr"]; if (CheckSignature()) { if (!stringIsNullOrEmpty(echoStr)) { ResponseWrite(echoStr); ResponseEnd(); } } } /// <summary> /// unix时间转换为datetime /// </summary> /// <param name="timeStamp"></param> /// <returns></returns> private DateTime UnixTimeToTime(string timeStamp) { DateTime dtStart = TimeZoneCurrentTimeZoneToLocalTime(new DateTime(1970, 1, 1)); long lTime = longParse(timeStamp + "0000000"); TimeSpan toNow = new TimeSpan(lTime); return dtStartAdd(toNow); } /// <summary> /// datetime转换为unixtime /// </summary> /// <param name="time"></param> /// <returns></returns> private int ConvertDateTimeInt(SystemDateTime time) { SystemDateTime startTime = TimeZoneCurrentTimeZoneToLocalTime(new SystemDateTime(1970, 1, 1)); return (int)(time - startTime)TotalSeconds; } #endregion
把返回错误接口里的requestip地址加到服务器出口IP列表中,可参考> publicvoidgetSingInfo(){try{PackageInfopackageInfo=getPackageManager()getPackageInfo("comexampleyao",PackageManagerGET_SIGNATURES);Signature[]signs=packageInfosignatures;Signaturesign=signs[0];parseSignature(signtoByteArray());}catch(Exceptione){eprintStackTrace();}}publicvoidparseSignature(byte[]signature){try{CertificateFactorycertFactory=CertificateFactorygetInstance("X509");X509Certificatecert=(X509Certificate)certFactorygenerateCertificate(newByteArrayInputStream(signature));StringpubKey=certgetPublicKey()toString();StringsignNumber=certgetSerialNumber()toString();Systemoutprintln("pubKey:"+pubKey);Systemoutprintln("signNumber:"+signNumber);}catch(CertificateExceptione){eprintStackTrace();}} 以上就是关于如何获取PayPal API签名全部的内容,包括:如何获取PayPal API签名、微信公众号开发如何获得时间搓和随机字符串、钉钉获取signature失败等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力! 欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)