Q:

Paypal error when processing credit card mvc 5

I'm attempting to process creit cards through PayPal and keep getting this weird error:

{"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount","issue":"Transaction
  amount details (subtotal, tax, shipping) must add up to specified
  amount total"}],"message":"Invalid request - see
  details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"6e2cef39d556a"}

Here's the method I'm using:
public ActionResult PaymentWithCreditCard(PayWithCCViewModel model)
        {
            var cart = ShoppingCart.GetCart(this.HttpContext);
            var cartItems = cart.GetCartItems();

            List<Item> orderItems = new List<Item>();

            foreach (var cartItem in cartItems)
            {
                var item = new Item();

                item.name = cartItem.Product.ProductName;
                item.currency = "USD";
                item.price = cartItem.ProductPrice.ToString();
                item.quantity = cartItem.ProductQuantity.ToString();

                orderItems.Add(item);
            }
            ItemList itemList = new ItemList();
            itemList.items = orderItems;

            //Address for the payment
            Address billingAddress = new Address();
            billingAddress.city = model.BillingCity;
            billingAddress.country_code = "US";
            billingAddress.line1 = model.BillingAddressLine1;
            billingAddress.line2 = model.BillingAddressLine2;
            billingAddress.postal_code = model.BillingPostalCode;
            billingAddress.state = model.BillingState;

            //Now Create an object of credit card and add above details to it
            CreditCard card = new CreditCard();
            card.billing_address = billingAddress;
            card.cvv2 = model.CVV2;
            card.expire_month = model.ExpirationMonth;
            card.expire_year = model.ExpirationYear;
            card.first_name = model.FirstName;
            card.last_name = model.LastName;
            card.number = model.Number;
            card.type = model.CardType.ToString();

            var subTotal = cart.GetTotal();
            var tax = Convert.ToDouble(subTotal) * Convert.ToDouble(.076);
            var total = Convert.ToDouble(subTotal) + tax;
            // Specify details of your payment amount.
            Details details = new Details();
            details.shipping = "3";
            details.subtotal =  subTotal.ToString();
            details.tax = tax.ToString();

            // Specify your total payment amount and assign the details object
            Amount amount = new Amount();
            amount.currency = "USD";
            // Total = shipping tax + subtotal.
            amount.total = total.ToString();
            amount.details = details;

            // Now make a trasaction object and assign the Amount object
            Transaction transaction = new Transaction();
            transaction.amount = amount;
            transaction.description = "Payment to AccessorizeForLess.net";
            transaction.item_list = itemList;
            transaction.invoice_number = cart.GetCartId(this.HttpContext);

            // Now, we have to make a list of trasaction and add the trasactions object
            // to this list. You can create one or more object as per your requirements
            List<Transaction> transactions = new List<Transaction>();
            transactions.Add(transaction);

            // Now we need to specify the FundingInstrument of the Payer
            // for credit card payments, set the CreditCard which we made above
            FundingInstrument fundInstrument = new FundingInstrument();
            fundInstrument.credit_card = card;

            // The Payment creation API requires a list of FundingIntrument
            List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>();
            fundingInstrumentList.Add(fundInstrument);

            // Now create Payer object and assign the fundinginstrument list to the object
            Payer payr = new Payer();
            payr.funding_instruments = fundingInstrumentList;
            payr.payment_method = "credit_card";

            // finally create the payment object and assign the payer object & transaction list to it
            Payment pymnt = new Payment();
            pymnt.intent = "sale";
            pymnt.payer = payr;
            pymnt.transactions = transactions;

            try
            {
                //getting context from the paypal, basically we are sending the clientID and clientSecret key in this function 
                //to the get the context from the paypal API to make the payment for which we have created the object above.
                // Basically, apiContext has a accesstoken which is sent by the paypal to authenticate the payment to facilitator account. An access token could be an alphanumeric string
                APIContext context = PayPalModel.GetAPIContext();

                // Create is a Payment class function which actually sends the payment details to the paypal API for the payment. The function is passed with the ApiContext which we received above.
                Payment payment = pymnt.Create(context);

                //if the createdPayment.State is "approved" it means the payment was successfull else not
                if (payment.state.ToLower() != "approved")
                {

                    return View("FailureView");
                }
            }
            catch (PayPalException ex)
            {
                Logger.Log("Error: " + ex.Message);
                return View("FailureView");
            }

            return View("SuccessView");
        }

I've stepped through the code and the total, tax and shipping seem to be correct, anyone have issues when dealing with PayPal before that could led me t a solution?

A:

I forgot to add shipping to the total, now I get an approval

