PayPal amount_x in IPN? - paypal

What's variable name for amount_x (item price) that is submited back from PayPals IPN?
Im searching everywhere but cant find the name of this item price variable in IPN?!
I can get it like:
$_POST['mc_gross_'.$i] / $_POST['quantity'.$i]
But I'm not sure because of rounding, etc.

$_POST['mc_gross'] is the total amount for the payment. Are you wanting individual item prices?

Related

Magento 1 create partial invoice for specific amount and not products

For a Magento order, after the order has been placed and a Payflow payment has been authorized, I want to be able to add a charge to the order. I could capture a different amount from the one authorized but this brings in the limitation issue because for Paypal amount captured can only be 15% above/below the amount authorized. In order to overcome this issue, I want to allow the user to be able to pay separately for the remaining charge. However, when the user tries to pay for the rest using the Payflow credit card again, a full invoice is created which results in the cancellation of the current order and creation of new order with order id xxx-1.
What I want is to have multiple invoices for the same order and I believe this can be done usig partial invoices like so:
if($order->canInvoice()) {
$invoiceId = Mage::getModel('sales/order_invoice_api')
->create($order->getIncrementId(), $itemsarray ,'your_comment' ,1,1);
}
But how do I create a partial invoice for a given price that is not related to any items?
how do I create a partial invoice for a given price that is not related to any items?
Specify your own new $itemsarray replacement, that contains a single line item that describes the charge for a given price

show facebook product price in local currency

I have some Items in my game that can be bought.
I need to show the price in local currency BEFORE user click "buy".
It is easy, when the default price is in USD,
so that I call
FB.api('/me/?fields=currency')
and as an response I get
user_currency
usd_exchange_inverse
With that, local price is:
PRICE_IN_USD * usd_exchange_inverse.
But what if default price is in EURO?
It seems that I need to get exchange rate from EURO to LOCAL CURRENCY.
But how?
thanks

Recurring payments: how to specify an initial payment TAX value different than the subsequent cycles?

If I do a request with the INITAMT equal to the recurring payment amount, it works.
But if I try to bill a different INITAMT (and so different TAX), I get this error:
Tax calculation mismatch. The tax amount for the regular non-trial billing period is different than the sum of the tax for each item in the cart.
My actual request:
I have an initial payment of 4.84€ including 0.84€ of VAT tax.
The next month the amount to bill should be 25.09€ (including 6.09€ VAT).
The request I send is basically this:
Method: CreateRecurringPaymentsProfile
"CURRENCYCODE":"EUR",
"INITAMT":4.84,
"TAXAMT":0.84,
"DESC":"Subscription",
"BILLINGPERIOD":"Month",
"BILLINGFREQUENCY":1,
"AMT":29,
"L_PAYMENTREQUEST_0_ITEMCATEGORY0":"Digital",
"L_PAYMENTREQUEST_0_NAME0":"Subscription",
"L_PAYMENTREQUEST_0_AMT0":29,
"L_PAYMENTREQUEST_0_TAXAMT0":6.09,
"L_PAYMENTREQUEST_0_QTY0":1
"PROFILEREFERENCE":"51a1f8f4732baf580a000031",
"PAYMENTREQUEST_0_INVNUM":"51a1f8f4732baf580a000031",
"INVNUM":"51a1f8f4732baf580a000031",
"PROFILESTARTDATE":"2013-06-26T11:59:12+0000",
And the response:
"TIMESTAMP":"2013-05-27T10:55:46Z",
"CORRELATIONID":"969d07e2cef8a",
"ACK":"Failure",
"VERSION":"74",
"BUILD":"5908853",
"L_ERRORCODE0":"10004",
"L_SHORTMESSAGE0":"Tax calculation mismatch.",
"L_LONGMESSAGE0":"Tax calculation mismatch. The tax amount for the regular non-trial billing period is different than the sum of the tax for each item in the cart.",
"L_SEVERITYCODE0":"Error"
I'd like to do this with the INITAMT value, so that the user can see the two purchases as correlated in the Paypal private area (ie: a subscription with an inital payment).
Otherwise I'll have to do a separate DoExpressCheckout for the initial payment.
What's happening is that you cannot (I believe) set a tax amount for the Initial Amount.
The TAXAMT is for the recurring payment, not the Initial Amount.
Your statement is saying "Billing 29€ with a tax of 0.84€".
However your item list says the tax should be 6.09€
Change your TAXAMT to 6.09€ and it should be fine.

How to add dynamic discount amount for one coupon in Magento

How to set dynamic discount amount if an coupon is applied.
For this i have created a shopping cart price rule and send this promo coupon to some customers and when they purchase products from my site and applied this coupon every customers get different discount amount based on the products in their shopping cart so how i can set this dynamic discount amount ?
I have already make some research on salesrule/rule module but getting confused so please help me...
Just for some your knowledge or someone needy finally i have found solution for my question for dynamic discount amount.
to achieve this you need to change in two methods first one is process(Mage_Sales_Model_Quote_Item_Abstract $item) under Mage_SalesRule_Model_Validator class in which you need to change the rule discount amount and set it to any dynamic calculated value like
$rule->setDiscountAmount($dynamicDiscountAmount);
and in the collect method just update the discount amount for display purpose in totals block
$address->setDiscountAmount(-$discountAmount);
$address->setBaseDiscountAmount(-$discountAmount);

Paypal IPN using PHP to get customized Quantity and Amount

I have downloaded the sample paypal IPN script using php and customised with the email for the buyout option and it has also some hidden paramaters such as amount, quantity,return_url, notify_url like this. My main idea is to do the buyout option for the product purchase in my website.The current calculation for the product purchase is as follows:
Item Price:$20
Quantity :10
Total amount $200
I need the calculation to some different way as our site have some static set of quantities and prices, so our point of calculation is as follows:
Item Price:$20
Quantity :10
Total amount:$20
So, the total amount needs to be the same for the given number of quantities.The IPN configuration doesn't allow me to change the quantity field by this way, please suggest some ideas to overcome this issue.
The item price is price per item, the quantity is of course multiplied by the item price. Your second example should have $2 as the --Item-- price. If you want to sell "10 items for $20", I think you will need to make a new item for that combo and just but the actual quantity in a custom field.
If you want to use the same item and paypal's quantity field, I think you need to look into calculating a discount and making that part of the parameters (discount_amount_cart or discount_amount_X for item X I think).