Spring: Paypal Payment on new currencies results to PENDING capture status - spring-boot

I think this is not a code problem since my application can successfully pay and process payments using my account currencies (usd/php/hkd).
Since there was a new requirement to support some currencies (sgd, eur, jpy, etc), I added these currencies Account Settings > Money, banks, and cards.
Btw, I am using paypal order and payment version 2 on spring.
The application was able to pass the currency and value of the transaction (like what I do normally with USD/EUR/PHP).. It was able to create order object, authorized approved payment... but it the capture authorized payment is always stucked at PENDING.
I still need to check on my test paypal account and either Accept/Reject received payment.
However, my application is only checking for COMPLETED capture status for it to considered or mark it as successful payment.
I also tried the configuration on my test paypal account (Account Settings > Payment Preferences > Block Payments).
Tried selecting Yes, accept and convert them to... and Ask me whether to accept or deny each individual payment but the capture status is still PENDING.
Is there a way to proceed with the capture payment and have the status to COMPLETED? Even with payments of different currencies? It would be OK if the payment received will be stored on that currency or have it converted to my default currency (like USD, etc).
What I want is the capture status to proceed to COMPLETED without manually accepting/rejecting payments with other currency (newly added currencies).
Again, I think this is not a coding issue... more of a configuration issue.. but I am not sure which configuration and where to set. I am pretty new with paypal development.
By the way, I based my changes on my paypal account with this link:
Payment Receiving Preferences
TIA

This is standard PayPal behavior. If you accept the first payment in a new currency in a way that opens a balance in such a currency, future payments won't need to be manually accepted. You can also manually open $0 balances in the Money management section, https://www.paypal.com/businessmanage/account/money
The setting in Account Settings > Payment Preferences > Block Payments that you mention to convert non-balance currency transactions to your primary balance will only apply automatically to future payments. Their status should then not be 'PENDING' due to any currency issue.
(If you find that all payments are PENDING, even your primary balance ones, then the pending reason (as stated in the API response) is likely "authorization" -- meaning you created an authorization with intent:AUTHORIZE but haven't captured it yet. Change to intent:CAPTURE to capture immediately.)

Related

Joomla AEC issue with Paypal, possibly IPN

I installed the Joomla AEC Version 1.0, Revision 5149.
I have set up plans and everything in this matter, if user clicks on the create an account system will ask user to select the plan. Then user clicks on buy now, she goes through Paypal, Purchase get made (Subscription with 3 days free trial) then user get redirected back to the site which all works fine.
My problem is user will see the message that says "Thank you for your registration. Our system will now await your payment. You will receive an e-mail once our system has processed your request. ". site will never get the clearance from Paypal. I havent put any custom custom URL or anything like that.
Also site is in the staging. so the URL starts with http://staging.domainanme.com
Not sure if this will cause an issue.
Thanks
With AEC it is quite simple with a Paypal Subscriptions processor. You just need to put in the email address of your account at:
Processors -> Paypal Subscritions -> Business ID
Not sure if that will be the same with 1.0 as this is based on 1.2.
If you have a valid account that's all you need. Of course make sure you have assigned the processor to your plan.
So if this all checks out one other thing you can try. If you were using the paypal account before with some other domain then switch to staging.domainname.com then you might want to try adding the Alternate IPN Notification Domain. Find this at:
Processors -> Paypal Subscritions ->Alternate IPN Notification Domain
In here put exactly http://staging.domainname.com
UPDATE:
The problem is Paypal communication then. First remove the Alternate IPN Notification Domain setting in AEC that I suggested. That was just for testing.
Either Paypal email is not confirmed so the communication fails or the communication can't be established.
Assuming you are using Paypal Standard, go to Paypal and login. Check in this order:
Click on Profile. Does the email have "unconfirmed" beside the email? If it does then that's your problem.
Go to Profile -> My selling tools -> Instant payment notifications. Click update on the far right. Enable it and add a new notification url. It should look like: http://www.yoursite.com/index.php?option=com_acctexp&task=paypal_subscriptionnotification
Just another thought. Paypal doesn't enable Paypal subscriptions when you sign up for Paypal Standard. I can't remember exactly when/how that was done but I remember that a separate step was needed. That could also be the cause of this issue.

Magento + Paypal - order status stuck at "Payment review"

I am currently testing the PayPal functionality. I added all the appropriate config information, and the purchase is working perfectly.
Going into the admin panel, all the orders have "Payment review" status (they were made either today or yesterday).
My question is - is it normal to last this long ? If it is, how am I supposed to properly test. If it's not, can anyone give me any tips on how to debug this issue ?
Any information on how the process goes from this point on would be highly appreciated. Anticipated thanks.
Check the PayPal account that you made the purchases on. Do they show completed in there, or do they say pending? If they show completed, it may be possible you did not receive the IPN to update your cart. If they show under review in your test sandbox account, you may have payment review turned on. You could need to go into the details of the transaction within your test sandbox account and manually accept the payment. You can also turn payment review off if it is on. You just need to log into your developer account at developer.paypal.com, click on test accounts. You then should see a column for payment review. If it is enabled, you will just need to toggle it from here.
Since this is quite popular with Google I will add my solution here as well:
I had noticed that many payments would still have the "Payment review" status even after I disabled payment review in my sandbox account.
Turns out that if a payment is made in another than the sandbox account's default currency, it is automatically put into the "Review" status.
To turn this feature off, log into your sandbox account under https://www.sandbox.paypal.com and go to Profile -> More Options -> Payment Receiving Preferences. There you can change the setting for "Allow payments sent to me in a currency I do not hold" to auto-accept such payments.
My problem was transaction status said "Paid" in merchant test (Sandbox) account but IPN response I received had payment status "Pending".
For a new user like me, it was hard to find out how to accept a payment manually when "payment review" is turned on. It took hours for me.
To make it easier for others,
Go to transaction detail -> Click on "More Information" link. Go to bottom of the page. Here you will find "Accept" link just above "Return to My Account" button. Click on "Accept" link and transaction status will change to "Complete".
After that I received IPN response with payment status "Completed"
I hope this helps someone.
This query solved it for me in case of Amazon Sandbox orders which left opened transactions. These popped up in the error log with
The OrderReferenceId XYZ is invalid
each time with Magento's cron scheduler. Basically the same as for Paypal and all other external payment methods which have a sandbox mode:
UPDATE `sales_payment_transaction`
SET `is_closed`=1
WHERE 'S02-XXXXXXX-XXXXXXX' IN (txn_id, parent_txn_id);

How to stop magento from setting Payment-Status to "Completed" when Payment comes in via PayPal

Is there a way to stop magento setting the status of an order to "completed" after the payment comes in via PayPal?
The Problem is that I want do send an invoice when I start with the service, which is not possible when someone pays it before.
Thanks!
If I understand your problem right, try next:
In Magento PayPal settings, find field "Payment Action", and set it to "Authorization"
This mean:
payments are only authorized at the side of the PayPal system and only
an order is created in the backend of your store. The store
administrator needs log to on to the merchant account on the PayPal
site and capture the transaction.
So after order placed and user have paid transaction, status in your shop will stay at "Pending" or "Processing". After that you can generate invoice and send it to customer, and then go to your PayPal and finalize order.
Source here: http://www.magentocommerce.com/knowledge-base/entry/setting-up-paypal-for-your-magento-store/

How do I turn off PayPal IPN in Magento?

When people make a successful payment with PAyPal in my Magento webshop it automatically creates an invoice with unique invoice number. For bookkeeping reasons, I have to disable it.
I've been searching for a few weeks now but I still haven't found the solution for this problem. What I know so far is that this is caused by IPN. The problem is I don't know how to turn this off without damaging my shop or paypal payments.
Some more specs:
- Version: Magento 1.6.2.0
- Standard paypal
Files containing IPN:
www/app/code/core/Mage/Paypal/controllers
"Turning it Off" is sort of vague, but there's no configuration setting on the Magento side that will allow you to accept PayPal standard payments using the IPN system but not create invoices. You're looking at writing custom code to do this. Here are some starting points.
PayPal IPN works with a callback URL. That is, once PayPal has processed a payment, it fetches a specific URL from Magento with a specific set of data in the post field. Then, based on this information, appropriate action is taken (an invoice is created, a credit is issued, etc.). So the quickest way to achieve your goal would be to change the IPN URL in your PayPal configuration. This means PayPal is still notifying a URL, but not the Magento URL, and an invoice never gets created.
If that doesn't work or has unacceptable side effects, here's the code points you're interested in. Assuming you're using a standard Magento PayPal setup with an IPN URL configured at
http://yourstore.example.com/paypal/ipn/
Magento will handles this request with the indexAction method in
#File: app/code/core/Mage/Paypal/controllers/IpnController.php
public function indexAction()
{
if (!$this->getRequest()->isPost()) {
return;
}
try {
$data = $this->getRequest()->getPost();
Mage::getModel('paypal/ipn')->processIpnRequest($data, new Varien_Http_Adapter_Curl());
} catch (Exception $e) {
Mage::logException($e);
}
}
The business logic for this method (including your invoice creation) starts in the paypal/ipn model. In a standard system this resolves to the class at
#File: app/code/core/Mage/Paypal/Model/Ipn.php
class Mage_Paypal_Model_Ipn
{
....
}
Trace the code from here to find the method you'll want to rewrite and implement your desired functionality changes (not creating an invoice). Your best bet will be setting up a PayPal developer sandbox account so you can repeatedly hit the URL until you've traced your code to the right spot.
Good luck!
instead of hacking your core Magento files, just turn off IPN within PayPal.
By default, there are three states for PayPal IPN:
On
Off
Disabled
The first option will let you specify an IPN URL within your PayPal Profile, and you'll have access to 'IPN History' under the 'History' tab. All IPN data for your account will be sent to the URL you specified, unless you override it with notify_url / NOTFIFYURL on a per-transaction basis.
The second option will turn IPN off on your account, but you can still use it by setting notify_url / NOTIFYURL on a per-transaction basis. This is what Magento uses.
The third option will stop generating IPN messages for your account, even if your shopping cart (Magento, in this case) specifically asks for IPN messages by sending notify_url / NOTIFYURL. No IPN messages will be delivered whatsoever.
To set IPN to 'Disabled', first set it to 'On' in your PayPal account and provde a URL to an IPN address (though this can be any address, just enter http://www.google.com/ for example).
Once enabled, look for the option stating 'Stop receiving IPN messages (Disable)'. Use this to disable IPN altogether.
Source:-https://lastdropofink.co.uk/tools/magento/magento-paypal-ipn/
If I got you right, you should change Payment Action to Authorization for your paypal payment method. See more info there:
http://www.magentocommerce.com/knowledge-base/entry/setting-up-paypal-for-your-magento-store#1.1
Or, instead of hacking your core Magento files, just turn off IPN within PayPal.
By default, there are three states for PayPal IPN:
On
Off
Disabled
The first option will let you specify an IPN URL within your PayPal Profile, and you'll have access to 'IPN History' under the 'History' tab. All IPN data for your account will be sent to the URL you specified, unless you override it with notify_url / NOTFIFYURL on a per-transaction basis.
The second option will turn IPN off on your account, but you can still use it by setting notify_url / NOTIFYURL on a per-transaction basis. This is what Magento uses.
The third option will stop generating IPN messages for your account, even if your shopping cart (Magento, in this case) specifically asks for IPN messages by sending notify_url / NOTIFYURL. No IPN messages will be delivered whatsoever.
To set IPN to 'Disabled', first set it to 'On' in your PayPal account and provde a URL to an IPN address (though this can be any address, just enter http://www.google.com/ for example).
Once enabled, look for the option stating 'Stop receiving IPN messages (Disable)'. Use this to disable IPN altogether.
What I’ve been really surprised by over the past few weeks is the number of sites that don’t actually have this turned on and it’s just not limited to self-builds even the really expensive Magento builds are missing this out this as a step.
Turning on the PayPal Instant Payment Notification (IPN for short) is an excellent idea as means that when a customer pays for an item using PayPal then the payment information will be updated on the Magento order details in the administration panel.
It only takes a few moments to enable and I’ll show you how to enable IPN for your Magento site below. This will mean that when you receive an order via PayPal Express for example, you can actually see the transaction details in Magento and if you’re using eSellerPro and have the eSellerPro Connector enabled for sales order processing, your order & payment details will match up automatically.
Setting this up won’t take more than a few moments and here are 6 simple steps to do this:
1 Login to PayPal
2 Hover on “Profile” and select “My Selling Preferences”
3 Halfway down the page, click on “Update” next to “Instant payment notifications”
Now enter the following details:
Notification URL – This is simply http://your-magento-store.com/paypal/ipn/ replacing “your-magento-store.com” with your website address. <= This is the part that normally trips everyone up as they’re not sure what to enter here.
IPN messages – Set this to “Receive IPN messages (Enabled)”
Press Save
That’s it job done.
To test whether IPN is working or not is dead simple, just make a test transaction through your website (you will need a secondary PayPal account for this) and a few minutes later, check on the order in your Magento admin panel has been updated with the PayPal transaction details.
To help you, I have put to images below, the image on the left has no IPN details, the image on the right does.

Magento - Capture online from code

often when customers complete and pay their order in our store, the order is set to processing but with the amount due still equal to the grand total and amount paid equal to zero. From the magento backend I can then create an invoice and capture the payment online, which solves this issue. Now I would like to do this automatically. Can anybody help me out with the coding?
I do succeed in creating the invoice, but I cannot find the right function to capture the payment.
I'm not sure which payment method you have enabled, but it seems that you have to update your settings, and as example I will use Authorize.net.
If you go to Admin -> System -> Configuration -> Payment Methods -> Authorize.net, you will see it's settings, and one of this settings is "Payment Action" with two options:
Authorize Only
Authorize and Capture
If the first option is selected, than Magento will not capture the order amount, but will check if there's enough funds on customer's Credit Card.
If the first option is selected, than Magento will check for available funds, and will capture order amount from customer's Credit Card.
PayPal has a similar options, and Here is the related forum topic.

Resources