本文整理汇总了C#中NVPCodec.Encode方法的典型用法代码示例。如果您正苦于以下问题:C# NVPCodec.Encode方法的具体用法?C# NVPCodec.Encode怎么用?C# NVPCodec.Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NVPCodec
的用法示例。
在下文中一共展示了NVPCodec.Encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ECGetExpressCheckout
public PayPalResponse ECGetExpressCheckout(string token)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = getProfile();
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "84.0";
encoder["METHOD"] = "GetExpressCheckoutDetails";
// Add request-specific fields to the request.
encoder["TOKEN"] = token; // Pass the token returned in SetExpressCheckout.
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
PayPalResponse response = new PayPalResponse {
token = (decoder["TOKEN"] != null) ? decoder["TOKEN"] : "",
acknowledgement = decoder["ACK"],
first = decoder["FIRSTNAME"],
last = decoder["LASTNAME"],
email = decoder["EMAIL"],
amount = decoder["PAYMENTREQUEST_0_AMT"],
payerID = decoder["PAYERID"]
};
return response;
}
示例2: DoCheckoutPayment
public bool DoCheckoutPayment(string finalPaymentAmount, string token, string PayerID, ref NVPCodec decoder, ref string retMsg)
{
if (bSandbox)
{
pEndPointURL = pEndPointURL_SB;
}
NVPCodec encoder = new NVPCodec();
encoder["METHOD"] = "DoExpressCheckoutPayment";
encoder["TOKEN"] = token;
encoder["PAYERID"] = PayerID;
encoder["PAYMENTREQUEST_0_AMT"] = finalPaymentAmount;
encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp);
decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder["ACK"].ToLower();
if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
{
return true;
}
else
{
retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" +
"Desc=" + decoder["L_SHORTMESSAGE0"] + "&" +
"Desc2=" + decoder["L_LONGMESSAGE0"];
return false;
}
}
示例3: GetTransactionDetailsCode
public string GetTransactionDetailsCode(string transactionID)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "GetTransactionDetails";
// Add request-specific fields to the request.
encoder["TRANSACTIONID"] = transactionID;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例4: ECSetExpressCheckout_PayLaterCode
public string ECSetExpressCheckout_PayLaterCode(string returnURL,string cancelURL,string amount,string paymentType,string currencyCode)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "SetExpressCheckout";
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["AMT"] = amount;
encoder["PAYMENTACTION"] = paymentType;
encoder["CURRENCYCODE"] = currencyCode;
encoder["L_PROMOCODE0"] = "101";
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例5: GetBalanceCode
public string GetBalanceCode()
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "GetBalance";
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例6: CancelAuthorization
public NVPCodec CancelAuthorization(string transactionID, string note)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "DoVoid";
// Add request-specific fields to the request.
encoder["AUTHORIZATIONID"] = transactionID;
encoder["NOTE"] = note;
encoder["TRXTYPE"] = "V";
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
return decoder;
}
示例7: ECDoExpressCheckoutCode
public NVPCodec ECDoExpressCheckoutCode(string token, string payerID, string amount, string paymentType, string currencyCode)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
{
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment = "sandbox";
}
else if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "L")
{
profile.APIUsername = "murty.korada_api1.cybertech.com";
profile.APIPassword = "KKKC8PY8E4R9LN48";
profile.APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31Ab5GxWPc-1XSb8rJctwNCFHIYb84";
profile.Environment = "live";
}
else
{
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment = "sandbox";
}
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "65.1";
encoder["METHOD"] = "DoExpressCheckoutPayment";
// Add request-specific fields to the request.
// Pass the token returned in SetExpressCheckout.
encoder["TOKEN"] = token;
encoder["PAYERID"] = payerID;
encoder["AMT"] = amount;
encoder["PAYMENTACTION"] = paymentType;
encoder["CURRENCYCODE"] = currencyCode;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder;
}
示例8: ShortcutExpressCheckout
public bool ShortcutExpressCheckout(string amt, ref string token, ref string retMsg)
{
if (bSandbox)
{
pEndPointURL = pEndPointURL_SB;
host = host_SB;
}
string returnURL = "http://localhost:4671/Checkout/CheckoutReview.aspx";
string cancelURL = "http://localhost:4671/Checkout/CheckoutCancel.aspx";
NVPCodec encoder = new NVPCodec();
encoder["METHOD"] = "SetExpressCheckout";
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["BRANDNAME"] = "Wingtip Toys Sample Application";
encoder["PAYMENTREQUEST_0_AMT"] = amt;
encoder["PAYMENTREQUEST_0_ITEMAMT"] = amt;
encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
// Get the Shopping Cart Products
QueensBookstore.Logic.ShoppingCartActions myCartOrders = new QueensBookstore.Logic.ShoppingCartActions();
List<CartItem> myOrderList = myCartOrders.GetCartItems();
for (int i = 0; i < myOrderList.Count; i++)
{
encoder["L_PAYMENTREQUEST_0_NAME" + i] = myOrderList[i].Product.ProductName.ToString();
encoder["L_PAYMENTREQUEST_0_AMT" + i] = myOrderList[i].Product.UnitPrice.ToString();
encoder["L_PAYMENTREQUEST_0_QTY" + i] = myOrderList[i].Quantity.ToString();
}
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder["ACK"].ToLower();
if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
{
token = decoder["TOKEN"];
string ECURL = "https://" + host + "/cgi-bin/webscr?cmd=_express-checkout" + "&token=" + token;
retMsg = ECURL;
return true;
}
else
{
retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" +
"Desc=" + decoder["L_SHORTMESSAGE0"] + "&" +
"Desc2=" + decoder["L_LONGMESSAGE0"];
return false;
}
}
示例9: MassPayCode
public string MassPayCode(string emailSubject,string receiverType,string currencyCode,string ReceiverEmail0,string amount0,string UniqueID0,string Note0,string ReceiverEmail1,string amount1,string UniqueID1,string Note1)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "MassPay";
// Add request-specific fields to the request.
encoder["EMAILSUBJECT"] = emailSubject;
encoder["RECEIVERTYPE"] = receiverType;
encoder["CURRENCYCODE"]=currencyCode;
if(ReceiverEmail0.Length>0)
{
encoder["L_EMAIL0"] = ReceiverEmail0;
encoder["L_Amt0"] = amount0;
encoder["L_UNIQUEID0"] = UniqueID0;
encoder["L_NOTE0"] = Note0;
}
if(ReceiverEmail1.Length>0)
{
encoder["L_EMAIL1"] = ReceiverEmail1;
encoder["L_Amt1"] = amount1;
encoder["L_UNIQUEID1"] = UniqueID1;
encoder["L_NOTE1"] = Note1;
}
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例10: ECDoExpressCheckout
public string ECDoExpressCheckout(string token, string payerID, string amount, Cart cart)
{
Settings settings = new Settings();
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = getProfile();
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder.Add("VERSION","84.0");
encoder.Add("METHOD","DoExpressCheckoutPayment");
// Add request-specific fields to the request.
encoder.Add("TOKEN",token);
encoder.Add("PAYERID",payerID);
encoder.Add("RETURNURL",getSiteURL() + "Payment/PayPalCheckout");
encoder.Add("CANCELURL",getSiteURL() + "Payment");
encoder.Add("PAYMENTREQUEST_0_AMT",amount);
encoder.Add("PAYMENTREQUEST_0_PAYMENTACTION","Sale");
encoder.Add("PAYMENTREQUEST_0_CURRENCYCODE","USD");
encoder.Add("BRANDNAME",settings.Get("SiteName"));
encoder.Add("LOGIN","Login");
encoder.Add("HDRIMG",settings.Get("EmailLogo"));
encoder.Add("CUSTOMERSERVICENUMBER",settings.Get("PhoneNumber"));
encoder.Add("PAYMENTREQUEST_0_SHIPPINGAMT",cart.shipping_price.ToString());
encoder.Add("PAYMENTREQUEST_0_DESC","Your " + settings.Get("SiteName") + " Order");
encoder.Add("ALLOWNOTE","0");
encoder.Add("NOSHIPPING","1");
int count = 0;
decimal total = 0;
foreach (CartItem item in cart.CartItems) {
encoder.Add("L_PAYMENTREQUEST_0_NUMBER" + count, item.partID.ToString());
encoder.Add("L_PAYMENTREQUEST_0_NAME" + count, item.shortDesc);
encoder.Add("L_PAYMENTREQUEST_0_AMT" + count, String.Format("{0:N2}", item.price));
encoder.Add("L_PAYMENTREQUEST_0_QTY" + count, item.quantity.ToString());
encoder.Add("L_PAYMENTREQUEST_0_ITEMCATEGORY" + count, "Physical");
encoder.Add("L_PAYMENTREQUEST_0_ITEMURL" + count, settings.Get("SiteURL") + "part/" + item.partID);
total += item.price * item.quantity;
count++;
}
encoder.Add("PAYMENTREQUEST_0_TAXAMT", String.Format("{0:N2}", cart.tax));
encoder.Add("PAYMENTREQUEST_0_ITEMAMT", String.Format("{0:N2}", total));
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例11: DoDirectPaymentCode
public string DoDirectPaymentCode(string paymentAction,string amount,string creditCardType,string creditCardNumber,string expdate_month,string cvv2Number,string firstName,string lastName,string address1,string city,string state,string zip,string countryCode,string currencyCode)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "DoDirectPayment";
// Add request-specific fields to the request.
encoder["PAYMENTACTION"] = paymentAction;
encoder["AMT"] = amount;
encoder["CREDITCARDTYPE"] = creditCardType;
encoder["ACCT"] = creditCardNumber;
encoder["EXPDATE"] = expdate_month;
encoder["CVV2"] = cvv2Number;
encoder["FIRSTNAME"] = firstName;
encoder["LASTNAME"] = lastName;
encoder["STREET"] = address1;
encoder["CITY"] = city;
encoder["STATE"] = state;
encoder["ZIP"] = zip;
encoder["COUNTRYCODE"] = countryCode;
encoder["CURRENCYCODE"] = currencyCode;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例12: VerifyCreditCardInfo
public ICreditCardAuthorizationResponse VerifyCreditCardInfo(ICreditCardAuthorizationRequest request)
{
var caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "mv1_1302977681_biz_api1.hotmail.com";
profile.APIPassword = "1302977698";
profile.APISignature = "AzbQABSL2jEPPHG.eDus2jfMT0xEAUITxvhhUWGmd3DHxaPXx6Zs1MPR";
profile.Environment = "sandbox";
caller.APIProfile = profile;
var encoder = new NVPCodec();
encoder["SIGNATURE"] = "AzbQABSL2jEPPHG.eDus2jfMT0xEAUITxvhhUWGmd3DHxaPXx6Zs1MPR";
encoder["USER"] = "mv1_1302977681_biz_api1.hotmail.com";
encoder["PWD"] = "1302977698";
encoder["VERSION"] = "60.0";
encoder["METHOD"] = "DoDirectPayment";
// Add request-specific fields to the request.
encoder["PAYMENTACTION"] = CreditCardPaymentActions.Authorization.ToString();
encoder["AMT"] = "100";
encoder["CREDITCARDTYPE"] = request.CreditCardInfo.Type.ToString();
encoder["IPADDRESS"] = "192.168.0.1";
encoder["ACCT"] = request.CreditCardInfo.CreditCardNumber;
encoder["EXPDATE"] = request.CreditCardInfo.ExpirationDate.ToString("MMyyyy");
encoder["CVV2"] = request.CreditCardInfo.Cvv2Number;
encoder["FIRSTNAME"] = request.FirstName;
encoder["LASTNAME"] = request.LastName;
encoder["STREET"] = request.AddressInfo.Address1;
encoder["CITY"] = request.AddressInfo.City;
encoder["STATE"] = request.AddressInfo.State;
encoder["ZIP"] = request.AddressInfo.ZipCode;
encoder["COUNTRYCODE"] = request.AddressInfo.Country;
encoder["CURRENCYCODE"] = "USD";
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
var decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return new CreditCardAuthorizationReponse(decoder["ACK"] == "Success");
}
示例13: CreateRecurringPaymentsProfileCode
public string CreateRecurringPaymentsProfileCode(string token,string amount,string profileDate, string billingPeriod, string billingFrequency)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
// Add request-specific fields to the request.
encoder["METHOD"] = "CreateRecurringPaymentsProfile";
encoder["TOKEN"] = token;
encoder["AMT"] = amount;
encoder["PROFILESTARTDATE"] = profileDate; //Date format from server expects Ex: 2006-9-6T0:0:0
encoder["BILLINGPERIOD"] = billingPeriod;
encoder["BILLINGFREQUENCY"] = billingFrequency;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例14: SetCustomerBillingAgreementCode
public string SetCustomerBillingAgreementCode(string returnURL,string cancelURL,string billingDesc)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "SetCustomerBillingAgreement";
// Add request-specific fields to the request.
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["BILLINGTYPE"] = "RecurringPayments";
encoder["BILLINGAGREEMENTDESCRIPTION"] = billingDesc;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例15: ShortcutExpressCheckout
public bool ShortcutExpressCheckout(string subTotal, string shippingIn, string amt, ref string token, ref string retMsg, Customer customerIn)
{
if (bSandbox)
{
pEndPointURL = pEndPointURL_SB;
host = host_SB;
}
string returnURL = "http://localhost:64352/Graded%20Unit1/CheckoutReview.aspx";
string cancelURL = "http://localhost:64352/Graded%20Unit1/CheckoutCancel.aspx";
NVPCodec encoder = new NVPCodec();
encoder["METHOD"] = "SetExpressCheckout";
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["BRANDNAME"] = "LidiFlu Ltd";
encoder["PAYMENTREQUEST_0_AMT"] = amt;
encoder["PAYMENTREQUEST_0_ITEMAMT"] = subTotal;
encoder["PAYMENTREQUEST_0_SHIPPINGAMT"] = shippingIn;
encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "GBP";
// Get the Shopping Cart Products
for (int i = 0; i < customerIn.Orders[0].OrderLines.Count; i++)
{
encoder["L_PAYMENTREQUEST_0_NAME" + i] = customerIn.Orders[0].OrderLines[i].Product.ProdName.ToString();
encoder["L_PAYMENTREQUEST_0_AMT" + i] = customerIn.Orders[0].OrderLines[i].Product.ProdPrice.ToString();
encoder["L_PAYMENTREQUEST_0_QTY" + i] = customerIn.Orders[0].OrderLines[i].Quantity.ToString();
}
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder["ACK"].ToLower();
if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
{
token = decoder["TOKEN"];
string ECURL = "https://" + host + "/cgi-bin/webscr?cmd=_express-checkout" + "&token=" + token;
retMsg = ECURL;
return true;
}
else
{
retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" +
"Desc=" + decoder["L_SHORTMESSAGE0"] + "&" +
"Desc2=" + decoder["L_LONGMESSAGE0"];
return false;
}
}