This article is written to illustrate how to setup Paypal Standard Payments with IPN Notification in TomatoCart.
First, sign up for a Paypal Developer Account. Then under Test Accounts on the left create one buyer and one seller/premier (store) test account. The buyer account should have a fake credit card added to it and some money in the fake Paypal account.
Note: emails sent from the PayPal Sandbox testing environment don’t actually go to the designated email addresses. The “Test Email” link shows you all the messages that were sent and received by the test e-mail addresses.
Turning On IPN in PayPal
Go back to your Paypal Developer Account and login if necessary. Click on to “Test Accounts”: Choose your “seller account” (this should be a premier account) Click the button to “Enter Sandbox Test Site” This will log you in as that user.
You need to go to Profile and turn on IPN (My Account>Profile)
Please just leave the Instant Payment Notification(IPN) URL blank because TomatoCart will pass the notify_url thru the API to Paypal and the notify_url parameter overrides the Paypal account IPN url.
Disable HTTP Password Protection
Warning: Any HTTP password-protection on your website must be disabled in order for IPN to work. Disable the password protection in your .htaccess file to allow the IPN response to come through to your store from PayPal.
Configure Auto Return in PayPal
Go to Website Payments under Profile on the PayPal website and turn on the Auto Return. It isn’t necessary to set the Return Url. Same comment as for the notify_url, TomatoCart will pass thru the API to Paypal the return url. The paypal return parameter overrides the Paypal account auto return url.
Observe that in PayPal, Auto Return is not the same as IPN (Instant Payment Notification). IPN is what PayPal uses to tell your store that the payment has gone through. Auto Return is the URL that PayPal sends your customer back to at your store after they have paid on PayPal’s website.
The Paypal Identity Token
You don’t need to enable Payments Data Transfer in your Website Payment Preferences to integrate TomatoCart with Paypal Standard Payments. If you do this anyway, you will get a so-called “identity token” from Paypal. This token isn’t used in the TomatoCart/Paypal integration and you should ignore it.
Testing The TomatoCart/Paypal Integration
Before you start testing your integration using the Paypal Sandbox, ensure that you are logged in to your Paypal Developer Account.
For your test orders, it may be convenient to use the same postal address that Paypal made up for your test buyer account. To pay for your test orders, you can log in to the test Paypal account and pay the TomatoCart order from the balance. You may also want to test using the fake credit card number that you have been given for the test Paypal account. Use any CVC code, it isn’t verified in the sandbox.
Automatically Update The Order Status by IPN
Now when you complete an order, a Sales Order will be created with the Preparing Status. This order status is the default status set by TomatoCart when the user make a payment with paypal standard. If you check your Orders in TomatoCart admin panel before submitting the PayPal payment, you will see this order status as follows:
But then, when you complete the PayPal Payment and are returned to the Checkout Success page on TomatoCart, if the IPN from paypal haven’t been sent to your notify url, the Order should move to Processing with a comment – Paypal Processing Transactions.
But, if the IPN notification from paypal have already been sent to your notify url before you are returned to the checkout success page, the Processing order status will not be set. In this case, if the IPN from paypal tell the server the payment is successful, the order status will move to Paid and you could see the information as follows:
Otherwise, if the payment is failed, the order status will still be Preparing. And the Order history does display a line indicating “PayPal IPN Invalid”, then this means that PayPal indicated to TomatoCart that the payment’s status was still pending (in this case, the PayPal IPN POST data field payment_status=”Pending”). Check to make sure that Payment Review is turned off in your seller settings on the PayPal website. In the PayPal Developer sandbox, this setting can be found to the right of your account listed on the Test Accounts page.
So, this way you should know whether the payment was successfully made. If the order status is Processing, it means that the IPN from PayPal haven’t been sent to your notify url successfully result in no changes happened. If the order status is Preparing and no status history in it, it means that the user was redirected to the paypal to pay but he didn’t pay it.
Setting up PayPal in TomatoCart
- Set Enable PayPal Website Payments Standard to True
- In PayPal E-Mail Address, put the address you have used to set up your PayPal account
- Set Payment Zone to none except that you want this payment method only available for that zone.
- Set Processing Order Status to Processing to intercept the customer is returned to the Checkout Complete page from papal
- Set PayPal Acknowledged Orders Status to Paid
- Set the Gateway Server to Sandbox while testing but remember to set it to live when testing is over
- set Transfer Cart Line Items to line so that all the item information will displayed on the paypal as in the shipping cart
- Set Transaction method to Sale
- Set Page Style to PayPal
- paypal – use the PayPal page style
- primary – use the page style that you marked as primary in your account profile
- page_style_name – use the custom payment page style from your account profile that has the specified name
- The default is primary if you added a custom payment page style to your account profile. Otherwise, the default is paypal.
- Set the Debug E-Mail Address to the email address you want emails from PayPal to go to about orders that are not completed or any problems with payment NB. It should not be the same email address you use for your PayPal account
- Set the sort order of display to where you want the PayPal option to come in your payment options list in the shopping cart. Low numbers come first in the list but 0 comes at the end so be careful what you choose
IPN Troubleshooting Tips
IPN failures fall into three categories: not receiving any IPN messages from PayPal, receiving some but not all IPN messages, and receivingINVALID messages from PayPal after responding to a message.
If you do not receive any IPN messages from PayPal
*Check the IPN History page on PayPal. It tells you whether PayPal sent the IPN message and whether your listener responded to it. It may also provide information about the status of the server on which your listener is running. If necessary, from this page you can also request that PayPal resend the IPN message.
*Check that the path to your IPN listener is correct and you are using that path correctly in your IPN notification URL; for example, the file path is often similar to, but not the same as, the URL.
*Verify that your firewall settings are not blocking HTTP POST messages from PayPal.
*If the logs for your web server are available, check the logs to confirm that messages are being sent to your web server and check for any errors that may have occurred.
If you receive some messages but not others
*Check that the account is valid and confirmed; for example, if you send money to an unconfirmed account, PayPal does not send an IPN message.