Magento PayPal module events - events

I recently set up some automatic scripts to help me manage incoming orders for a Magento store by using observers and Magento events. My problem is dealing with the question when exactly an order is placed and saved in the system depending on the selected payment type.
For example: if someone simply choses prepayment, the order is saved immediately and the customer is automatically forwarded to a success page - so no problems so far.
If a customer pays via Paypal, the whole situation is completely different. After being redirected to PayPal, logging into the account and confirming the payment, the customer is not redirected to the Magento store. He can click on a link to return there which will also forward him to the success page but surely not everybody will do that and the problem is that the observer event I use only executes code if the user lands on that page. (The event I am working with is "checkout_Onepage_Controller_Success_Action").
Therefore I need to know from where Magento gets the information whether a PayPal payment was successful, has been cancelled or whatever. I looked through some of the PayPal controller files under /app/code/core/Mage/Paypal/controllers/ and the only thing that looked close to a possible solution was the function successAction() in StandardController.php. However, this function also seems to be triggered only when a customer choses to return to the Magento store so it doesn't help me.
Does anybody have some experience with that issue?

I figured out a way to work around the problem:
Appearently there are no events in Magento which correspond with incoming payments on PayPal. A possible solution might be to provide a IPN URL which triggers a script as soon as the payment is confirmed but I managed to redirect the customer to my store so I did not have to do that.
In the profile settings of the PayPal account under "website settings", there is an option called "automatic redirect". If this option is enabled and a URL is entered, the customer will automatically be forwarded to that URL. At first I thought this would not help me because as I said there are multiple web shops involved which all would have their own individual return URL and you can't specify more than one. However, if a return URL is passed over when contacting PayPal, it will override the one that is specified within the profile settings and since the Magento module does that by default, I just had to enter a random URL in the textfield and enable the option, now the customers are redirected back to my shop when they place an order and pay via PayPal.

Related

payment module not working in magento

I have a magento store, and it's payment module is not working. I can add my shipping method, but after submitting shipping method,
it won't proceed to payment mode,
I have enabled cash on delivery. and
I have an amazon payment extension also. When I checked in console,
there shows some error, That is client ID is invalid in amazon, But
the extension is disabled
, still it causing problem, i think so,
But
Checkout with Multiple Addresses is working without any problem.
Can any one please help me, this is my website link please check
You took the client ID that was given to you by wizard. I ran into the same problem.
Go to your Amazon SellerCenter Account.
Then from Top right drop-down list select Login with Amazon.
From right side select the Application you want the information for.
Under Web Settings take the Client ID.

Redirect to Paypal after completing all steps of Checkout

I am using PayPal as payment method on my store in Magento.When i select PayPal as payment method it redirects me to PayPal login page at the same time but i want to redirect on that page after completing all steps of checkout.
How can i do this?
Is there any admin settings or I have to customize the code for this?
Please help.
Paypal Express Checkout is a checkout method (and not a payment method) and goes for authorisation to paypal website, get's the authorisation and user billing details and redirects you back to finish the checkout in paypal express checkout page.
This is how it works, you can set the action to be "sale" instead of "authorisation" but it will still redirect you back to Paypal express Checkout page in Magento to finish the order placement.
PayPal Express is designed to work this way (redirect to Paypal, then redirect to your website again). One reason is for example, that your business terms etc. must be shown to the customer before he finally agrees to buy.
There is - of course - another possibility: You could use Website Payments Standard. The customer will be redirected to PayPal after he confirmed your business terms and pays there.
Bad about this: Payments Standard is an "old standard" and "redirects most of the time"; we see several cases where the payment is confirmed by the customer, but the IPN won't show in Magento backend.
Brief Idea :
Sale: – If one uses payment action as Sale in PayPal online payment, the amount will be automatically credited to merchant account when the order is placed successfully.
If one sets PayPal payment action as Sale, the order is invoiced automatically when the order is placed.
Authorization: – The amount is not automatically credited to merchant account when order is placed successfully. For crediting amount to merchant account, the merchant should login to PayPal account and should approve the transaction.
PayPal Express:
User gets redirected to PayPal directly after the payment method has been chosen (and obviously before the order has been completed).
They return to the site to complete the order after authorizing payment with PayPal.
Uses the getCheckoutRedirectUrl() method which gets called in the savePayment() action of Mage_Checkout_OnepageController. So you get redirected before the order is completed as described above.
PayPal Standard:
User goes through entire checkout process and completes the order on site. They then get redirected to PayPal to sort out payment.
They do not need to come back to the site to complete the order as it has already been completed before redirecting to PayPal.
Uses the getOrderPlaceRedirectUrl() which gets called in the saveOrder() method of Mage_Checkout_Model_Type_Onepage
This is why you see the empty basket if you return to the site regardless of whether you pay at PayPal or not – the quote has already been converted to an order.
So in this sense PayPal express is essentially checkout method and PayPal standard is a payment method.
See additional information from Magento knowledge base :
http://www.magentocommerce.com/knowledge-base/entry/getting-started-with-paypal-express-checkout-for-magento-community
http://www.magentocommerce.com/knowledge-base/entry/paypal-express-checkout-workflow-for-magento-community
http://www.magentocommerce.com/knowledge-base/entry/setting-up-paypal-express-checkout-for-magento-community

PayPal Express not giving option for Check out as Guest, even if it is active (PayPal Paying Guest option to YES)

I had some problems with paypal settings in Magento 1.7.0.2 The problem is this: I am using using paypal express (I have my account created and verified Paypal Company) active PayPal Paying Guest option to YES, but when a user in my shop will complete your purchase and pay with Paypal will be the option PayPal API perfect, but does not show me the option to pay without paypal account and VERIFY ALL settings in Magento Admin Panel and \\"seem to be fine. \\"Try making a new store to rule out any configuration already had my store \\"old\\", that might not let me do my Enable PayPal Guest Checkout, but still have the same problem. I look forward to your help to solve the problem, since I have no idea what else to do on my page. thanks
This is all based on browser cookies. If you cleared your browser cookies and then try again prior to logging in to any PayPal account you should see the option for Guest Checkout more prominently displayed.
If you want to force this regardless of browser cookies you can set the following parameters in your SetExpressCheckoutRequest.
SOLUTIONTYPE=Sole
LANDINGPAGE=Billing
That will force the full credit card form to be displayed by default along with the option to login and pay with PayPal.
For Magento if it's not doing this for you by default you'll need to create a module to extend the core Express Checkout module so that you can add those parameters accordingly.

in Magento, How to make a payment method that sends POST variables to an external url?

I need to make a custom payment method that gets some variables from the customer’s order and sends them as POST variables to an external url.
The variables I need to get from Magento are the total amount, the order number and the products description. Those variables are sent to a url of a third party gateway, where the credit card information is asked in a secure way, and when the transaction is completed, they return the user to my magento site.
I’ve searched for information and tutorials but I still feel a little confused, I’m practically new to programming in magento, so i would really appreciate it if someone could give an step-by-step explanation, or at least a link to a tutorial
Thanks
This is how Paypal works, so the included module for that would be a good starting point but basically:
you have a method on your Payment class that tells Magento that the method is suitable for the order (this lets you use different methods for different order-totals, or currencies etc. but you can just return 'true')
if there are any bits of information you need to capture that Magento otherwise won't, you setup a template/block for your Form, and this is shown when the customer selects your method (Paypal doesn't have such a form)
you implement an 'authorize' method that does any processing of the order details
you implement a getRedirectUrl method that returns a URL for magento to redirect the user too. If you do need to post to your gateway, then your redirect will be to a local URL (/redirect.php say) and here you'll have a form with hidden fields and some javascript that will automatically submit it (you can stick a loading-gif too if you like) which will take the user to the gateway.*
if you provide a URL to the gateway to send the customer back to (you normally do...) then you're going to need a page there too, which does any order-cleanup/validating, before redirecting the customer to the checkout confirmation page
(* you could do this as a controller and template within magento if you want (it's a bit tidier), but explaining how to do it that way will take a bit more time than I have)
Here is a good starting point on creating a custom Magento payment extension for an external gateway.

Magento Paypal Express having issues with Downloadable Products

Just like to send a thanks out in advance for the help.
I have successfully setup a downloadable product with the option of filling out the URL in the Downloadable Information section. I have also successfully integrated the Paypal Express payment option. I can also successfully add the product to my cart, checkout and pay through Paypal Express from the link on my cart. I also am receiving the order email successfully. The problem comes once the download link is clicked, Magento tries to process and download but re-directs to the account login screen.
Here are a few notes:
Guest checkout for downloadable products is enabled.
System->Configuration->Catalog->Downloadable Product Information-> Order Item Status - Set to Pending (I am thinking this is the problem due to the fact that I can't change it to Complete) If you agree, please advise on the best way to accomplish this.
All orders are showing as Complete and PayPal is successfully capturing the monies.
Again, thanks in advance.
Set the Order Item Status to enable Downloads to Invoiced and this fixed the issue for me
There appears to be a bug with Magento 1.4.x that does not allow user account registration at the checkout process. You can select register, walk through the checkout, and you'll get paid and it will all look successful and everything, but Magento will fail to create the customer account, thus making it impossible for the users to download their product.
It totally sucks. I have a store that is useless until I can figure out how to get this fixed, as I only use the express checkout method, and all my products are downloadable.

Resources