I'm using Paypal to process payments.
The subtotal (without taxes) for the purchase is 132.94$. My customers are in Canada and I need to multiply a tax percent to that subtotal in order to get the real total.
The tax percent is 1.14975, but Paypal doesn't accept a tax percent with more than two decimals, so it rounds it to 1.15.
Here's the code that I use to setup the payment :
// Not shown- create an ItemList, add Item's to it
// ...
$details = new Details;
$details->setSubtotal(132.94);
$details->setTax(1.14975);
$amount = new Amount;
$amount->setCurrency('CAD');
$amount->setTotal(152.88); // 132.94 * 1.15
$amount->setDetails($details);
// ...
// Not shown - create the transaction, try to create the payment
However, when I try to send the information to Paypal, I get this error :
Transaction amount details (subtotal, tax, shipping) must add up to specified amount total
I tried dumping out $amount to see what it contains, and here's what I see :
Why does it tell me that the details don't add up to the amount? Am I missing something here? If I multiply the subtotal by the tax, I get the total for the amount, they do match up.
Related
I am building my website by using woocommerce, but i faced the problem of calculating the total amount of the order.
There is a shipping method which is 15% additional fee of the order, and there is a coupon offers $10 discount.
But woocommerce seems like apply the coupon before calculate shipping fee.
For example, the order total amount is $100, the expected result should be (100*1.15) - 10 = 105, but when i tested in the checkout page, the total amount is (100-10) * 1.15 = 103.5.
May I know how to apply the coupon after calculate the shipping fee?
Thank you.
I want to calculate amount correctly in woocommerce, which is apply coupon after calculate the shipping fee.
In app/code/local/Mage/Tax/Model/Sales/Total/Quote/Subtotal.php,
_totalBaseCalculation has a function where it sets tax percent,
$item->setTaxPercent($rate).
However I wish to set tax percent to (rate +y(any number)).
When I do this, there is no change in quote item data in sales_flat_quote_item. Is tax percent inserted from somewhere else???
Simply set tax rates of your wish in Backend at
Sales->Tax->Manage Tax Rates
Right now, I am using GetOrders to launch all my orders to my database. Normally, it works fine. I can get the total amount(includes item price and tax) by using:
$totalAmount = $order->AmountPaid;
However, when I tried to import an International Order, the amount was wrong.
The thing is: I only charged him $102.90, but the amount here gives me $157.62
Does anyone know how can I get the total price, which under the "Total" column, in eBay? What kind of value I need to use? Or maybe how to calculate the price for international order?
There few fields related to order price
OrderArray.Order.AmountPaid
This value indicates the total amount of the order. This amount includes the sale price of each line item, shipping and handling charges, shipping insurance (if offered and selected by the buyer), additional services, and any applied sales tax. This value is returned after the buyer has completed checkout (the CheckoutStatus.Status output field reads 'Complete').
OrderArray.Order.Total
The Total amount equals the Subtotal value plus the shipping/handling, shipping insurance, and sales tax costs.
OrderArray.Order.Subtotal
The subtotal amount for the order is the total cost of all order line items. This value does not include any shipping/handling, shipping insurance, or sales tax costs.
I would suggest you try Order.Total for receive price of the order.
I have integrate paypal express checkout in our website. as i know and get information from paypal documentation.
Need to set Amount parameter in request input and paypal deduct fee based on amount, but i want paypal add fee additional on amount.
Example :
Product amount : $100.00;
Paypal deduct fee 2.9% on $100.00 but i want add aditional 2.9% on main amount, like :
Amount = 100.00
Fee = 2.9%
Than Total amount is = $100.00 + 2.9% = $102.90
means i want paypal automatically set his fee on checkout page and charge to user.
Can anyone help me.
Thanks in Advance.
If you want to add that fee on to your order you'll need to do so prior to sending the user to PayPal, or you could also do it on your review page after the user is returned from PayPal.
Most people just add this to their cart as a "handling fee" or whatever you want to call it. If you want to be more accurate you should use the 2.9% + .30 formula.
I'm trying to figure out how to calculate the shipping refund on orders where some of the items are being refunded. Currently, in the credit memo screen, the amount in the input field is the total amount paid for shipping. When you adjust the quantity of items being refunded, and hit update, the shipping refunded amounts stays the same. I'd like to adjust it to be the portion of shipping that is related to the items being refunded.
As a calculation, I was thinking this would be:
total shipping cost - new calculation of shipping for items not being refunded = shipping cost of items being refunded.
I can see that the calculation for shipping is done in this class:
Mage_Sales_Model_Order_Creditmemo_Total_Shipping
However, I am having trouble figuring out how I would rerun the shipping calculation for the credit memo items.
Anyone have any thoughts on how I might be able to accomplish this?