Setexpresscheckout (Submit an order to PayPal, your own website to do the Order warehousing operation) The core code is as follows:Public ActionResult Setexpresscheckout () {
String currency = request.form["Currencycodetype"];
String name = request.form["Name"];
String shiptostreet = request.form["Shiptostreet"];
String shiptocity = request.form["shiptocity"];
String shiptostate = request.form["Shiptostate"];
String shiptocountrycode = request.form["Shiptocountrycode"];
String shiptozip = request.form["Shiptozip"];
String l_name1 = request.form["l_name1"];
String l_amt1 = request.form["L_AMT1"];
String l_qty1 = request.form["L_qty1"];
String L_NAME0 = request.form["L_NAME0"];
String l_amt0 = request.form["L_amt0"];
String l_qty0 = request.form["L_qty0"];
String hots = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + "/";
NVPCODEC encoder = new Nvpcodec ();
Encoder. ADD ("Paymentaction", "Sale");
//Do not allow customers to change addresses
Encoder. ADD ("Addroverride", "1");
Encoder. ADD ("Cancelurl", Hots + "/pay/index");
Encoder. ADD ("CurrencyCode", currency);
Encoder. ADD ("Shiptoname", name);
Encoder. ADD ("Shiptostreet", Shiptostreet);
Encoder. ADD ("Shiptocity", shiptocity);
Encoder. ADD ("Shiptostate", shiptostate);
Encoder. ADD ("Shiptocountrycode", Shiptocountrycode);
Encoder. ADD ("Shiptozip", shiptozip);
Encoder. ADD ("L_NAME0", L_NAME0);
Encoder. ADD ("L_number0", "1000");
Encoder. ADD ("L_desc0", "size:8.8-oz");
Encoder. ADD ("L_amt0", l_amt0);
Encoder. ADD ("L_qty0", l_qty0);
Encoder. ADD ("l_name1", l_name1);
Encoder. ADD ("L_number1", "10001");
Encoder. ADD ("L_desc1", "Size:two 24-piece boxes");
Encoder. ADD ("L_amt1", L_AMT1);
Encoder. ADD ("L_qty1", l_qty1);
Encoder. ADD ("l_itemweightvalue1", "0.5");
Encoder. ADD ("L_itemweightunit1", "lbs");
Double ft = double. Parse (l_qty0) * Double. Parse (l_amt0) + double. Parse (l_qty1) * Double. Parse (L_AMT1);
Encoder. ADD ("Itemamt", Ft. ToString ());
Encoder. ADD ("Taxamt", "2.00");
Double amt = System.Math.Round (ft + 5.00f + 2.00f + 1.00f, 2);
Double Maxamt = System.Math.Round (Amt + 25.00f, 2);
Encoder. ADD ("Shipdiscamt", "3.00");
Encoder. ADD ("Amt", Amt. ToString ());
String ReturnURL = Hots + "/pay/getexpresscheckoutdetails?amount=" +amt. ToString ();//Get the address of the order details, also the address after this step
Encoder. ADD ("RETURNURL", RETURNURL);
Encoder. ADD ("Shippingamt", "8.00");
Encoder. ADD ("Maxamt", Maxamt. ToString ());
Encoder. ADD ("insuranceoptionoffered", "true");
Encoder. ADD ("Insuranceamt", "1.00");
Encoder. ADD ("Localecode", "US");
Encoder. ADD ("Noshipping", "1");
Encoder. ADD ("L_shippingoptionisdefault0", "false");
Encoder. ADD ("L_SHIPPINGOPTIONNAME0", "Ground");
Encoder. ADD ("L_shippingoptionlabel0", "UPS Ground 7 Days");
Encoder. ADD ("L_shippingoptionamount0", "3.00");
Encoder. ADD ("L_shippingoptionisdefault1", "true");
Encoder. ADD ("L_shippingoptionname1", "UPS Air");
Encoder. ADD ("L_shippingoptionlabel1", "UPS Next day Air");
Encoder. ADD ("L_shippingoptionamount1", "8.00");
Encoder. ADD ("Callbacktimeout", "4");
Nvpcodec decoder = paypalprovider.setexpresscheckout (encoder);
String ack = decoder["ack"];
String l_errorcode0 = decoder["L_errorcode0"];
String l_shortmessage0 = decoder["L_shortmessage0"];
String l_longmessage0 = decoder["L_longmessage0"];
String l_severitycode0 = decoder["L_severitycode0"];
if (!string. IsNullOrEmpty (ACK) &&
(ACK.) Equals ("Success", System.StringComparison.OrdinalIgnoreCase) | | Ack. Equals ("successwithwarning", System.StringComparison.OrdinalIgnoreCase))
)
{
Send e-mail
New Mailmanager (email, "order", "Order Information"). Send ();
session["token"] = decoder["token"];
Return Redirect (configurationmanager.appsettings["RedirectURL"] + decoder["token"]);
}
Else
{
Return Redirect ("/pay/index");
}
}
Public ActionResult Setexpresscheckout () {String currency = request.form["Currencycodetype"]; String name = request.form["Name"]; String shiptostreet = request.form["Shiptostreet"]; String shiptocity = request.form["shiptocity"]; String shiptostate = request.form["Shiptostate"]; String shiptocountrycode = request.form["Shiptocountrycode"]; String shiptozip = request.form["Shiptozip"]; String l_name1 = request.form["l_name1"]; String l_amt1 = request.form["L_AMT1"]; String l_qty1 = request.form["L_qty1"]; String L_NAME0 = request.form["L_NAME0"]; String l_amt0 = request.form["L_amt0"]; String l_qty0 = request.form["L_qty0"]; String hots = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + "/"; NVPCODEC encoder = new Nvpcodec (); Encoder. ADD ("Paymentaction", "Sale"); Customers are not allowed to change addresses Encoder. ADD ("Addroverride", "1"); Encoder. ADD ("Cancelurl", Hots + "/pay/index"); Encoder. ADD ("CurrencyCode", currency); Encoder. ADD ("Shiptoname", name); Encoder. ADD ("Shiptostreet", Shiptostreet); Encoder. ADD ("Shiptocity", shiptocity); Encoder. ADD ("Shiptostate", shiptostate); Encoder. ADD ("Shiptocountrycode", Shiptocountrycode); Encoder. ADD ("Shiptozip", shiptozip); Encoder. ADD ("L_NAME0", L_NAME0); Encoder. ADD ("L_number0", "1000"); Encoder. ADD ("L_desc0", "size:8.8-oz"); Encoder. ADD ("L_amt0", l_amt0); Encoder. ADD ("L_qty0", l_qty0); Encoder. ADD ("l_name1", l_name1); Encoder. ADD ("L_number1", "10001"); Encoder. ADD ("L_desc1", "Size:two 24-piece boxes"); Encoder. ADD ("L_amt1", L_AMT1); Encoder. ADD ("L_qty1", l_qty1); Encoder. ADD ("l_itemweightvalue1", "0.5"); Encoder. ADD ("L_itemweightunit1 "," lbs "); Double ft = double. Parse (l_qty0) * Double. Parse (l_amt0) + double. Parse (l_qty1) * Double. Parse (L_AMT1); Encoder. ADD ("Itemamt", Ft. ToString ()); Encoder. ADD ("Taxamt", "2.00"); Double amt = System.Math.Round (ft + 5.00f + 2.00f + 1.00f, 2); Double Maxamt = System.Math.Round (Amt + 25.00f, 2); Encoder. ADD ("Shipdiscamt", "3.00"); Encoder. ADD ("Amt", Amt. ToString ()); String ReturnURL = Hots + "/pay/getexpresscheckoutdetails?amount=" +amt. ToString ();//Gets the address of the order details, which is also the address encoder after this step. ADD ("RETURNURL", RETURNURL); Encoder. ADD ("Shippingamt", "8.00"); Encoder. ADD ("Maxamt", Maxamt. ToString ()); Encoder. ADD ("insuranceoptionoffered", "true"); Encoder. ADD ("Insuranceamt", "1.00"); Encoder. ADD ("Localecode", "US"); Encoder. ADD ("Noshipping", "1"); Encoder. ADD ("L_shippingoptionisdefault0", "false"); EncodeR.add ("L_SHIPPINGOPTIONNAME0", "Ground"); Encoder. ADD ("L_shippingoptionlabel0", "UPS Ground 7 Days"); Encoder. ADD ("L_shippingoptionamount0", "3.00"); Encoder. ADD ("L_shippingoptionisdefault1", "true"); Encoder. ADD ("L_shippingoptionname1", "UPS Air"); Encoder. ADD ("L_shippingoptionlabel1", "UPS Next day Air"); Encoder. ADD ("L_shippingoptionamount1", "8.00"); Encoder. ADD ("Callbacktimeout", "4"); Nvpcodec decoder = paypalprovider.setexpresscheckout (encoder); String ack = decoder["ack"]; String l_errorcode0 = decoder["L_errorcode0"]; String l_shortmessage0 = decoder["L_shortmessage0"]; String l_longmessage0 = decoder["L_longmessage0"]; String l_severitycode0 = decoder["L_severitycode0"]; if (!string. IsNullOrEmpty (ACK) && (ack. Equals ("Success", System.StringComparison.OrdinalIgnoreCase) | | Ack. Equals ("SuccessWithwarning ", System.StringComparison.OrdinalIgnoreCase)) {//Send e-mail New Mailmanager (email, "order", "Order Information"). Send (); session["token"] = decoder["token"]; Return Redirect (configurationmanager.appsettings["RedirectURL"] + decoder["token"]); } else {return Redirect ("/pay/index"); } }