CubeCartForums.org Documentation Area

CubeCartForums.org for CubeCart third-party documentation, modifications, skins and services
Permanent Link   Print This Page
Introduction CubeCart v3 CubeCart v4 CubeCart v5 Appendix Search

CubeCart Version 3 Documentation - Setting up PayPal Standard with IPN

Google Translate:

Setting up PayPal Standard with IPN

The easiest way to set up PayPal Standard with IPN is to control the payment process and parameters from the cart side, rather than configuring the details within the PayPal account. This enables multiple stores to use the same PayPal account, and still take advantage of IPN.

In the screenshot below, I have entered some demonstration information showing typical PayPal Standard with IPN configuration. The email address used there is the primary email address associated with your PayPal account.



Once you have entered your details, click on 'Edit Config'.

BEGIN: For CubeCart v3.0.17 and prior versions:

Next find the following file:

/modules/gateway/PayPal/transfer.inc.php

Edit it, and look for the text following the end of the PayPal form data around line 120, which looks like this:
if($module['method']=="std"){

$hiddenVars .="<input type='hidden' name='return' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&amp;oid=".base64_encode($cart_order_id)."' />\r\n
<input type='hidden' name='cancel_return' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&amp;f=1&amp;oid=".base64_encode($cart_order_id)."' />";

}
Add the following directly afterwards:
elseif($module['method']=="ipn"){

$hiddenVars .="<input type='hidden' name='return' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&amp;oid=".base64_encode($cart_order_id)."' />
<input type='hidden' name='cancel_return' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&amp;f=1&amp;oid=".base64_encode($cart_order_id)."' />
<input type='hidden' name='notify_url' value='".$GLOBALS['storeURL']."/modules/gateway/PayPal/ipn.php' />\r\n";

}

Save and upload. These new settings override PayPal account settings, enabling IPN and auto-return.

END: For CubeCart v3.0.17 and prior versions

PayPal Account Update

Log into PayPal, browse to 'Profile > Website Payment Preferences'.

Set Auto Return for Website Payments to On, entering a default return URL. The IPN part of the CubeCart gateway overrides this setting anyway, so you can enter any custom website address. If you are not sure what to use, use your store homepage... http://www.mydomain.com/index.php ... or 'https' depending on whether you're using SSL or not.

Set Payment Data Transfer to 'On'.

The payment process should now take the customer to PayPal, and after the transaction return successfully to the confirmation page updating the payment status on the order.

There is no need to follow the instructions on the dialog to enable IPN in your PayPal account, as this modification overrides the setting in your account.

These settings allow multiple stores to use the same PayPal account because any store specific information is passed with the transaction rather than preconfigured in your PayPal account. If the additional stores do not use a return address, the default one entered in the PayPal settings is used.

This should be enough to get CubeCart successfully working with IPN, and IPN can still be disabled through the gateway configuration if required.

Please post any feedback you might have on these instructions in the Documentation forum, as we want to ensure the instructions are as helpful and accurate as they can be.





Comments, Feedback, Suggestions and Documentation Submissions please post in the Documentation Chat Forum.