贝宝添加到购物车多个项目形式的折扣 [英] Paypal add to cart multiple items form with discount

查看:162
本文介绍了贝宝添加到购物车多个项目形式的折扣的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据买家使用PayPal添加到购物车表单的购买金额来提供折扣。基本上我会给出折扣代码Disc1,Disc2,Disc3,Disc4,它可以折扣5美元,10美元,20美元,50美元。但是,只有当购买金额分别超过25美元,50美元,100美元和250美元时,每种方法才有效。



我试图通过调用一个Javascript文件来实现这一点,如果满足最低价格条件,它将应用折扣。



问题在于表单适用于多个项目。因此,金额的变量不存在,但每个选项的金额不同,所以option_amount0,option_amount1,option_amount2 ....等我可以使代码工作,如果有一个金额,但不喜欢这里多个项目/价格。



HTML代码如下所示:

 < head> 
< script language =JavaScripttype =text / javascriptsrc =coupon.js>< / script>
< / head>
< form target =_ blankaction =https://www.paypal.com/cgi-bin/webscrmethod =post>
< input type =hiddenname =cmdvalue =_ cart>
< input type =hiddenname =businessvalue =email@email.com>
< input type =hiddenname =lcvalue =US>
< input type =hiddenname =item_namevalue =Products>
< input type =hiddenname =button_subtypevalue =>
< input type =hiddenname =no_shippingvalue =1>
< input type =hiddenname =undefined_quantityvalue =1>
< input type =hiddenname =rmvalue =1>
< input type =hiddenname =returnvalue =www.website.com>
< input type =hiddenname =cancel_returnvalue =www.website.com>
< input type =hiddenname =currency_codevalue =USD>
< input type =hiddenname =tax_ratevalue =0.000>
< input type =hiddenname =shippingvalue =0.00>
< input type =hiddenname =addvalue =1>
< input type =hiddenname =bnvalue =PP-ShopCartBF:btn_cart_LG.gif:NonHosted>
< table>
< tr>< td>< br />< h4>
< center>< input type =hiddenname =on0value =Products>选择产品< / center>< / h4>< / td>< / tr> < TR>< TD><中心],[
< select name =os0style =width:230px>< / center>
< option value =item1>产品1:$ 15< / option>
< option value =item2>产品2:$ 25< / option>
< option value =item3>产品3:$ 75< / option>
< option value =item4>产品4:$ 150< / option>
< option value =item5>产品5:$ 300< / option>

< / select> < / TD>< / TR>
< / table>
< input type =hiddenname =currency_codevalue =USD>

< input type =hiddenname =option_select0value =item1>
< input type =hiddenname =option_amount0value =15.00>
< input type =hiddenname =option_select1value =item2>
< input type =hiddenname =option_amount1value =25.00>
< input type =hiddenname =option_select2value =item3>
< input type =hiddenname =option_amount2value =75.00>
< input type =hiddenname =option_select3value =item4>
< input type =hiddenname =option_amount3value =150.00>
< input type =hiddenname =option_select4value =item4>
< input type =hiddenname =option_amount4value =300.00>
< input type =hiddenname =option_indexvalue =0>


< input type =hiddenname =discount_amount>

< br />
<! - 输入优惠券 - >
< center>优惠券代码:< / span> < br />
< input type =textname =text1/> < /中心],[
< br />
<! - 结束优惠券 - >

< input type =imagesrc =images / btn_cart.gifborder =0onclick = CalculateOrder(this.form)name =submitalt =PayPal - 更安全,更简单的在线支付方式!>
< img alt =border =0src =images / btn_cart.gifwidth =1height =1>
< / form>

Javascript文件是:

  var coup1 =Disc1; 
var coup2 =Disc2;
var coup3 =Disc3;
var coup4 =Disc4;



函数CalculateOrder(form){

if(form.text1.value == coup1&&((form.option_amount。价值> = 25)))

{

form.discount_amount.value =5;


$ b if(form.text1.value == coup2&&((form.option_amount.value> = 50)))

{

form.discount_amount.value =10; (form.text1.value == coup3&&((form.option_amount.value> = 100)(





if ))

{

form.discount_amount.value =20;

}


if(form.text1.value == coup4)&& ((form.option_amount.value> = 250)))

{

form.discount_amount.value =50;

}

}

我怎样才能从HTML表单中为option_amount创建脚本帐户?
任何帮助将不胜感激!

解决方案

我正在使用PayPalMerchantSDK进行购物车整合。

为了您的回答,我将这个场景作为我需要用快速结账按钮将PayPal发送到PayPal。另外我的篮子有一张可以申请总金额的折扣券。我正在使用Asp.Net MVC解决方案



请遵循PayPal支付集成的代码和说明。



第1步:下载并引用PayPal_Merchant_SDK.dll



第2步:将所需设置添加到web.config文件为PayPal_Merchant_SDK服务

第3步:在您的购物篮控制器付款操作中,添加以下代码:

  [HttpPost] 
public ActionResult Payment()
{
var basketForPayment = GetBasket();
if(basketForPayment.Order == null || basketForPayment.OrderItem.Count< = 0 || basketForPayment.Order.DVEcomOrderStatus.ID!=(int)DvEcomOrderStatusEnum.Initiated){return View(basket-empty ,新的DvClientViewModel(UrlBasketEmptyPage,Languages.English)); }


// Paypal Expresscheckout集成===============================

//步骤1:创建PayPal请求对象
var request = new SetExpressCheckoutRequestType();
PopulatePaypalRequestObject(request,basketForPayment);

//第二步:调用API
SetExpressCheckoutReq getTockenWrapper = new SetExpressCheckoutReq();
getTockenWrapper.SetExpressCheckoutRequest =请求;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
SetExpressCheckoutResponseType setEcResponse = service.SetExpressCheckout(getTockenWrapper);

//第3步:检查API返回状态并获得付款tocken
HttpContext currContext = System.Web.HttpContext.Current;
currContext.Items.Add(paymentDetails,request.SetExpressCheckoutRequestDetails.PaymentDetails);
var currResponseContext = SetPayPalKeyResponseObjects(service,setEcResponse);

var responseobject =(Dictionary< string,string>)currResponseContext.Items [Response_keyResponseObject];
if(responseobject [API Status]!=SUCCESS)
{
return View(Invalid-basket,new DvClientViewModel(UrlBasketEmptyPage,Languages.English));
}

//步骤4:使用tocken
var tocken = responseobject [EC token];
字符串queryString =https://www.sandbox.paypal.com/webscr?cmd=_express-checkout;
if(!string.IsNullOrEmpty(tocken))
{

//使用事务标记
更新订单_orderRepository.UpdateOrder(model.Order.OrderNumber,tocken );

queryString + = string.Format(& token = {0},tocken);
Response.Redirect(queryString);
}

return RedirectToAction(Payment);
}

第4步: p>

  public ActionResult PaymentResponse()
{
//如果我们有SECURE_SECRET,那么使用MD5 hash
//包含在传入数据中
if(Request.QueryString [token]。Length> 0&& Request.QueryString [PayerID]。Length> 0)
{
var token = Request.QueryString [token];
var payerId = Request.QueryString [PayerID];
var order = _orderRepository.GetOrderTransaction(token);

if(order!= null)
{
//带订单令牌的更新订单
_orderRepository.UpdateOrderSuccess(order.OrderNumber,token,payerId);
}

PaymentResponseClearSessionAndCookie();
Response.Redirect(/);



return View(Invalid-basket,new DvClientViewModel(UrlBasketEmptyPage,Languages.English));

$ b

第5步:准备购物篮为PayPal

  private void PopulatePaypalRequestObject(SetExpressCheckoutRequestType请求,DvEcomOrderViewModel购物篮)
{
var ecDetails = new SetExpressCheckoutRequestDetailsType();
ecDetails.ReturnURL = ConfigurationManager.AppSettings [PayPalReturnUrl]; ecDetails.CancelURL = ConfigurationManager.AppSettings [PayPalCancelUrl]; ecDetails.BuyerEmail = basket.Order.CustomerEmailAddress;

//修复版本
ecDetails.AddressOverride =0;
ecDetails.NoShipping =1;

/ *填充支付请求详细信息。
* SetExpressCheckout允许多达10笔支付的并行支付。
*此样品仅显示一次付款。
* /
var paymentDetails = new PaymentDetailsType();
ecDetails.PaymentDetails.Add(paymentDetails);
double orderTotal = 0.0;
double itemTotal = 0.0;
var currency =(CurrencyCodeType)
Enum.Parse(typeof(CurrencyCodeType),ConfigurationManager.AppSettings [PayPalCurrency]);


paymentDetails.OrderTotal = new BasicAmountType(currency,orderTotal.ToString(CultureInfo.InvariantCulture));
orderTotal + = Double.Parse(basket.Order.SubTotal.ToString(CultureInfo.InvariantCulture)); //小计

paymentDetails.ShippingTotal = new BasicAmountType(currency,basket.Order.DeliveryAmount.ToString(CultureInfo.InvariantCulture)); //添加送货费用
orderTotal + = Double.Parse(basket.Order.DeliveryAmount.ToString(CultureInfo.InvariantCulture));

paymentDetails.TaxTotal = new BasicAmountType(currency,basket.Order.VAT.ToString(CultureInfo.InvariantCulture)); // Add Vat Tax
orderTotal + = Double.Parse(basket.Order.VAT.ToString(CultureInfo.InvariantCulture));

//paymentDetails.ShippingDiscount = new BasicAmountType(currency,basket.Order.DiscountAmount.ToString(CultureInfo.InvariantCulture)); //减折扣
orderTotal - = Double.Parse(basket.Order.DiscountAmount.ToString(CultureInfo.InvariantCulture));


paymentDetails.OrderDescription = string.Format(篮子订单付款{0},basket.Order.OrderNumber);

paymentDetails.PaymentAction =(PaymentActionCodeType)
Enum.Parse(typeof(PaymentActionCodeType),SALE);


AddressType shipAddress = new AddressType();
shipAddress.Name = string.Format({0} {1},basket.Order.DeliveryFirstName,basket.Order.DeliverySurname);
shipAddress.Street1 = basket.Order.BillingAddress1;
shipAddress.Street2 = basket.Order.BillingAddress2 ?? - ;
shipAddress.CityName = basket.Order.DeliveryTown ?? - ;
shipAddress.StateOrProvince = basket.Order.DeliveryCounty;
shipAddress.Country =(CountryCodeType)
Enum.Parse(typeof(CountryCodeType),GB);
shipAddress.PostalCode = basket.Order.DeliveryPostcode;

//修正版本
shipAddress.Phone = basket.Order.DeliveryTelePhone;

ecDetails.PaymentDetails [0] .ShipToAddress = shipAddress;


//每个付款都可以包含关于多个项目的requestDetails
//此示例仅显示一个付款项目

// ApplyDiscount
if(basket.Order.DiscountAmount> 0)
{
decimal disAmt = basket.Order.DiscountAmount -
(basket.Order.DiscountAmount + basket.Order.DiscountAmount);
PaymentDetailsItemType折扣=新的PaymentDetailsItemType();
discount.Amount = new BasicAmountType(currency,disAmt.ToString(CultureInfo.InvariantCulture));
discount.Description =应用的折扣;
discount.Name =优惠券代码;
paymentDetails.PaymentDetailsItem.Add(折扣);
}

var itemDetails = new PaymentDetailsItemType();
foreach(basket.OrderItem中的var item)
{
itemDetails.Name = item.ProductName;
itemDetails.Amount = new BasicAmountType(currency,item.UnitPrice.ToString(CultureInfo.InvariantCulture));
itemDetails.Quantity = Int32.Parse(item.Quantity.ToString(CultureInfo.InvariantCulture));
itemDetails.ItemCategory =(ItemCategoryType)
Enum.Parse(typeof(ItemCategoryType),0);
itemTotal + = Double.Parse(item.UnitPrice.ToString(CultureInfo.InvariantCulture))* itemDetails.Quantity.Value;

itemDetails.Tax = new BasicAmountType(currency,item.VAT.ToString(CultureInfo.InvariantCulture));

itemDetails.Description = item.ProductName;


paymentDetails.PaymentDetailsItem.Add(itemDetails);
}

itemTotal - = Double.Parse(basket.Order.DiscountAmount.ToString(CultureInfo.InvariantCulture));
paymentDetails.ItemTotal = new BasicAmountType(currency,itemTotal.ToString(CultureInfo.InvariantCulture));
paymentDetails.OrderTotal = new BasicAmountType(currency,orderTotal.ToString(CultureInfo.InvariantCulture));

request.SetExpressCheckoutRequestDetails = ecDetails;
}

第6步:与...



第7步:上述步骤将带您到达paypal成功转换。接下来,您需要通过Post方法通过另一个Paypal Authorize api函数调用授权真实的tansaction。该过程与上述过程相同。


I'm trying to offer a discount based on the purchase amount of the buyer using a paypal Add to Cart form. Basically I'm giving out for discount codes Disc1, Disc2, Disc3, Disc4, which will discount $5, $10, $20, $50. But each can work only if the purchase amount exceeds the $25, $50, $100, $250 respectively.

I'm trying to do this by calling a Javascript file which will apply the discount if the minimum price conditions are met.

The PROBLEM is that the form is for multiple items. So the variable for "amount" is not there, but there's different amounts for each option, so option_amount0, option_amount1, option_amount2.... etc. I can make the code work if there was one "amount", but not like here with multiple items/prices.

The HTML code looks like this:

    <head>
<script language="JavaScript" type="text/javascript" src="coupon.js"></script>
</head>
        <form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="business" value="email@email.com">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="item_name" value="Products">
    <input type="hidden" name="button_subtype" value="">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="undefined_quantity" value="1">
    <input type="hidden" name="rm" value="1">
    <input type="hidden" name="return" value="www.website.com">
    <input type="hidden" name="cancel_return" value="www.website.com">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="tax_rate" value="0.000">
    <input type="hidden" name="shipping" value="0.00">
    <input type="hidden" name="add" value="1">
    <input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
    <table>
    <tr><td><br /><h4>
    <center><input type="hidden" name="on0" value="Products">Choose a Product</center></h4></td></tr><tr><td><center>
    <select name="os0" style="width: 230px"></center>
        <option value="item1">Product 1 : $15</option>
            <option value="item2">Product 2 : $25</option>
        <option value="item3">Product 3 : $75</option>
        <option value="item4">Product 4 : $150</option>
        <option value="item5">Product 5 : $300</option>

    </select> </td></tr>
    </table>
    <input type="hidden" name="currency_code" value="USD">

    <input type="hidden" name="option_select0" value="item1">
    <input type="hidden" name="option_amount0" value="15.00">
    <input type="hidden" name="option_select1" value="item2">
    <input type="hidden" name="option_amount1" value="25.00">
    <input type="hidden" name="option_select2" value="item3">
    <input type="hidden" name="option_amount2" value="75.00">
    <input type="hidden" name="option_select3" value="item4">
    <input type="hidden" name="option_amount3" value="150.00">
    <input type="hidden" name="option_select4" value="item4">
    <input type="hidden" name="option_amount4" value="300.00">
    <input type="hidden" name="option_index" value="0">


    <input type="hidden" name="discount_amount">

    <br />
    <!--  Enter Coupon  --> 
    <center>Coupon Code:</span> <br />
    <input type="text" name="text1" /> </center>
    <br />
    <!--  End Coupon  --> 

    <input type="image" src="images/btn_cart.gif" border="0" onclick=CalculateOrder(this.form) name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="images/btn_cart.gif" width="1" height="1">
    </form>

The Javascript file is:

var coup1="Disc1";
var coup2="Disc2";
var coup3="Disc3";
var coup4="Disc4";



function CalculateOrder(form) {

if (form.text1.value == coup1 && ((form.option_amount.value>=25)))

{

form.discount_amount.value = "5";

}

if (form.text1.value == coup2 && ((form.option_amount.value>=50)))

{

form.discount_amount.value = "10";

}



if (form.text1.value == coup3 && ((form.option_amount.value>=100)))

{

form.discount_amount.value = "20";

}


if (form.text1.value == coup4) && ((form.option_amount.value>=250)))

{

form.discount_amount.value = "50";

}

}

How can I make the script account for the option_amount from the HTML form? Any help would be greatly appreciated!

解决方案

I am using PayPalMerchantSDK for the cart integration.

For your answer, I take this scenario as I need to send the basket to paypal with express checkout button. Also my basket has a discount voucher that can apply for the total amount. I am using Asp.Net MVC solutions

Please follow the code and instructions for the paypal payment integration.

Step1 : Download and Refer the PayPal_Merchant_SDK.dll

Step2 : Add the required setting to your web.config file for the PayPal_Merchant_SDK Servicess

Step 3: In your basket controller Payment action add the following code

    [HttpPost]
    public ActionResult Payment()
    {
        var basketForPayment = GetBasket();
        if (basketForPayment.Order == null || basketForPayment.OrderItem.Count <= 0 || basketForPayment.Order.DVEcomOrderStatus.ID != (int)DvEcomOrderStatusEnum.Initiated) { return View("basket-empty", new DvClientViewModel(UrlBasketEmptyPage, Languages.English)); }


        //Paypal Expresscheckout Integration===============================

        // Step 1: Create the paypal request object
        var request = new SetExpressCheckoutRequestType();
        PopulatePaypalRequestObject(request, basketForPayment);

        // Step 2: Invoke the API
        SetExpressCheckoutReq getTockenWrapper = new SetExpressCheckoutReq();
        getTockenWrapper.SetExpressCheckoutRequest = request;
        PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
        SetExpressCheckoutResponseType setEcResponse = service.SetExpressCheckout(getTockenWrapper);

        // Step 3: Check for API return status and get the payment tocken
        HttpContext currContext = System.Web.HttpContext.Current;
        currContext.Items.Add("paymentDetails", request.SetExpressCheckoutRequestDetails.PaymentDetails);
        var currResponseContext = SetPayPalKeyResponseObjects(service, setEcResponse);

        var responseobject = (Dictionary<string, string>) currResponseContext.Items["Response_keyResponseObject"];
        if (responseobject["API Status"] != "SUCCESS")
        {
            return View("Invalid-basket", new DvClientViewModel(UrlBasketEmptyPage, Languages.English));
        }

        //Step 4: Make Payment with the tocken
        var tocken = responseobject["EC token"];
        string queryString = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout";
        if(!string.IsNullOrEmpty(tocken))
        {

            //Update Order with the transaction token
            _orderRepository.UpdateOrder(model.Order.OrderNumber, tocken);

            queryString += string.Format("&token={0}", tocken);
            Response.Redirect(queryString);
        }

        return RedirectToAction("Payment");
    }

Step 4: Your Payment response action

    public ActionResult PaymentResponse()
    {
        // If we have a SECURE_SECRET then validate the incoming data using the MD5 hash
        //included in the incoming data
        if (Request.QueryString["token"].Length > 0 && Request.QueryString["PayerID"].Length > 0 )
        {
            var token = Request.QueryString["token"];
            var payerId = Request.QueryString["PayerID"];
            var order = _orderRepository.GetOrderTransaction(token);

            if(order !=null)
            {
                //Update Order with the transaction token
                _orderRepository.UpdateOrderSuccess(order.OrderNumber, token, payerId);
            }

            PaymentResponseClearSessionAndCookie();
            Response.Redirect("/");

        }

        return View("Invalid-basket", new DvClientViewModel(UrlBasketEmptyPage, Languages.English));

    }

Step 5: Prepare the basket for paypal

   private void PopulatePaypalRequestObject(SetExpressCheckoutRequestType request, DvEcomOrderViewModel basket)
    {
        var ecDetails = new SetExpressCheckoutRequestDetailsType();
        ecDetails.ReturnURL = ConfigurationManager.AppSettings["PayPalReturnUrl"];            ecDetails.CancelURL = ConfigurationManager.AppSettings["PayPalCancelUrl"];            ecDetails.BuyerEmail = basket.Order.CustomerEmailAddress;

        //Fix for release
        ecDetails.AddressOverride = "0";
        ecDetails.NoShipping = "1";

        /* Populate payment requestDetails. 
         * SetExpressCheckout allows parallel payments of upto 10 payments. 
         * This samples shows just one payment.
         */
        var paymentDetails = new PaymentDetailsType();
        ecDetails.PaymentDetails.Add(paymentDetails);
        double orderTotal = 0.0;
        double itemTotal = 0.0;
        var currency = (CurrencyCodeType)
            Enum.Parse(typeof(CurrencyCodeType), ConfigurationManager.AppSettings["PayPalCurrency"]);


        paymentDetails.OrderTotal = new BasicAmountType(currency, orderTotal.ToString(CultureInfo.InvariantCulture));
        orderTotal += Double.Parse(basket.Order.SubTotal.ToString(CultureInfo.InvariantCulture)); // Subtotal

        paymentDetails.ShippingTotal = new BasicAmountType(currency, basket.Order.DeliveryAmount.ToString(CultureInfo.InvariantCulture)); // Add delivery charge
        orderTotal += Double.Parse(basket.Order.DeliveryAmount.ToString(CultureInfo.InvariantCulture));

        paymentDetails.TaxTotal = new BasicAmountType(currency, basket.Order.VAT.ToString(CultureInfo.InvariantCulture)); //Add Vat Tax
        orderTotal += Double.Parse(basket.Order.VAT.ToString(CultureInfo.InvariantCulture));

        //paymentDetails.ShippingDiscount = new BasicAmountType(currency, basket.Order.DiscountAmount.ToString(CultureInfo.InvariantCulture)); // Subtract discount
        orderTotal -= Double.Parse(basket.Order.DiscountAmount.ToString(CultureInfo.InvariantCulture));


        paymentDetails.OrderDescription = string.Format("Payment for the basket order {0}", basket.Order.OrderNumber);

        paymentDetails.PaymentAction = (PaymentActionCodeType)
            Enum.Parse(typeof(PaymentActionCodeType), "SALE");


        AddressType shipAddress = new AddressType();
        shipAddress.Name = string.Format("{0} {1}", basket.Order.DeliveryFirstName, basket.Order.DeliverySurname);
        shipAddress.Street1 = basket.Order.BillingAddress1;
        shipAddress.Street2 = basket.Order.BillingAddress2 ?? "-";
        shipAddress.CityName = basket.Order.DeliveryTown ?? "-";
        shipAddress.StateOrProvince = basket.Order.DeliveryCounty;
        shipAddress.Country = (CountryCodeType)
            Enum.Parse(typeof(CountryCodeType), "GB");
        shipAddress.PostalCode = basket.Order.DeliveryPostcode;

        //Fix for release
        shipAddress.Phone = basket.Order.DeliveryTelePhone;

        ecDetails.PaymentDetails[0].ShipToAddress = shipAddress;


        // Each payment can include requestDetails about multiple items
        // This example shows just one payment item

        //ApplyDiscount
        if (basket.Order.DiscountAmount > 0)
        {
            decimal disAmt = basket.Order.DiscountAmount -
                             (basket.Order.DiscountAmount + basket.Order.DiscountAmount);
            PaymentDetailsItemType discount = new PaymentDetailsItemType();
            discount.Amount = new BasicAmountType(currency, disAmt.ToString(CultureInfo.InvariantCulture));
            discount.Description = "Discount Applied";
            discount.Name = "Voucher Code";
            paymentDetails.PaymentDetailsItem.Add(discount);
        }

        var itemDetails = new PaymentDetailsItemType();
        foreach (var item in basket.OrderItem)
        {                
            itemDetails.Name = item.ProductName;
            itemDetails.Amount = new BasicAmountType(currency, item.UnitPrice.ToString(CultureInfo.InvariantCulture));
            itemDetails.Quantity = Int32.Parse(item.Quantity.ToString(CultureInfo.InvariantCulture));
            itemDetails.ItemCategory = (ItemCategoryType)
            Enum.Parse(typeof(ItemCategoryType), "0");
            itemTotal += Double.Parse(item.UnitPrice.ToString(CultureInfo.InvariantCulture)) * itemDetails.Quantity.Value;

            itemDetails.Tax = new BasicAmountType(currency, item.VAT.ToString(CultureInfo.InvariantCulture));

            itemDetails.Description = item.ProductName;


            paymentDetails.PaymentDetailsItem.Add(itemDetails);
        }

        itemTotal -= Double.Parse(basket.Order.DiscountAmount.ToString(CultureInfo.InvariantCulture));
        paymentDetails.ItemTotal = new BasicAmountType(currency, itemTotal.ToString(CultureInfo.InvariantCulture));
        paymentDetails.OrderTotal = new BasicAmountType(currency, orderTotal.ToString(CultureInfo.InvariantCulture));

        request.SetExpressCheckoutRequestDetails = ecDetails;
    }

Step 6: Nothing more for you to start with...

Step 7 : The above steps will take you up to the paypal successfull transation. Next you need to authorise the real tansaction through another Paypal Authorise api function call through a Post method. The process is same as the above procedure.

这篇关于贝宝添加到购物车多个项目形式的折扣的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆