Configuring PayPal Multi-Account IPN for Magento 1.7.2 Multistore
Setting up multiple PayPal accounts for a Magento multistore can be a common requirement for e-commerce businesses. If you’re running Magento 1.7.2 in multi-store mode and want to use different PayPal accounts for each site, you might face challenges configuring the IPN (Instant Payment Notification) settings.
Understanding the Default Configuration Issue
By default, Magento stores its configuration, including payment methods like PayPal, under app/code/core/Mage/Core/etc/config.xml. This single file holds the system-wide settings for all your stores.
The issue arises when you try to configure the PayPal IPN separately for each store. Since the configuration is centralized in this file, you cannot set different IPN URLs for multiple sites without modifying core code or overriding the default configuration.
Configuring PayPal IPN for Multiple Stores
To overcome this limitation, we’ll need to create separate payment method instances for each store and configure them accordingly. Here’s a step-by-step guide:
-
Create a new extension: Start by creating a new extension under
app/code/local/.mkdir app/code/local/My Extension -
Override the PayPal model: Copy the core
Paypal.phpmodel fromapp/code/core/Mage/Paypal/Model/to your new extension folder.cp -r app/code/core/Mage/Paypal/Model/Paypal.php app/code/local/My/Extension/Model/ -
Modify the PayPal model: Open the copied
Paypal.phpfile and add a new method to fetch the store-specific configuration values:public function getStoreConfig($path) { return Mage::getStoreConfig('payment/paypal/' . $this->getCode() . '/' . $path); } -
Create separate payment method configurations: For each of your stores, navigate to the Magento admin panel and go to System > Configuration > Payment Methods. Click on “Add New Payment Method”.
-
Configure the PayPal settings for each store: Fill in the required details such as Title, * Merchant Email ID*, Paypal API Username/ Password/Password2/Endpoint, etc.
Ensure you use a different set of credentials (API username, password, etc.) for each store corresponding to your separate PayPal accounts.
-
Set up IPN URLs: In the “Payment Method” section for each store, scroll down to find the “Instant Payment Notification” settings. You can now specify unique IPN notification URLs for each store:
http://your-first-store-url.com/paypal/ipnand
http://your-second-store-url.com/paypal/ipn -
Configure the IPN listener: Create a new file
Paypal.phpunderapp/code/local/My/Extension/Model/to handle the incoming IPN notifications. -
Test the setup: Place a test order on each of your stores and verify that the correct PayPal account is charged and the IPN notification is sent to the appropriate URL.
Conclusion
Configuring multiple PayPal accounts for a Magento multistore requires careful implementation, as the default configuration system does not support per-store payment method settings directly. By following this approachâcreating a custom extension and overriding the core PayPal modelâyou can successfully set up different PayPal IPN URLs for each of your stores.
Remember to keep your Magento installation secure by applying all relevant security patches and following best practices for extensions development. If you encounter any issues or need further assistance, feel free to reach out to our team at Laravel Company.
With this setup complete, you can now leverage the benefits of using multiple PayPal accounts for your Magento multistore without compromising security or functionality.
Happy coding!