Payment Processing With Paypal
For now plaincart only accept online payment using Paypal. The reason is that they provide pretty extensive resource for developers. Paypal provide the developers with a "sandbox" that allow developers to test their payment module without any actual money transferred. Paypal provide many ways to accept money but the one used for this tutorial
is the Instant Payment Notification There are three files needed for using Paypal IPN and they are put in include/paypal/. The files are :
|
|
Here is what happen on each stage : 1. Checkout ConfirmationAfter rechecking the shipping and payment information on this page the customer click on the "Confim Order" button.
|
6. Thank You PageOnce you click the "Continue" button Paypal will redirect the customer back to the merchant site ( this site ). Since i'm not using a secure connection ( no https:// stuff ) there will be a warning message about you're being redirected to unsecure site. You can ignore it and just click on "Continue" and you will see the thankyou page. Here is the screenshot :
The thankyou page can only be accessed when an order id is found in the session. The order id is put in the session variable after you click the "Confirm" button on the checkout confirmation page. If no order id is found then the customer is sent directly to the shop main page. On this last step of checkout an email is sent to the shop admin notifying about the new order. This behaviour can be changed from the admin page on the shop configuration section. Here is the code for the thankyou page Source : success.php <?php // if no order id defined in the session $pageTitle = 'Checkout Completed Successfully'; // send notification email unset($_SESSION['orderId']); This is really an oversimplified thank you page. Normally an online shop also provide a link where the customer can check her order online or a notice that an order confirmation email has been sent ,etc. However i haven't made any of those so for now this is sufficient. There's a "hidden step" between step 4 and 5. The customer can't see it because it happen between Paypal server and the merchant server. On this "hidden step" these things happen :
We will take a deeper look at these on the next page |
|
|
|
|
Online Shop - Checkout Confirmation Page | PHP MySQL Shopping Cart Tutorial : Online Shop - Using Paypal | Online Shop - Handling Paypal IPN |
|
At long last i'm finally able to update this site. Now the shopping cart can handle payment through paypal. As always you have any critiques, questions, comments or problems about this tutorial please tell me. Click here to send your feedback. And if you like this tutorial please link to this site. It will really help a lot :-) |
My Experimental Lenses |
PHP MySQL Shopping Cart Tutorial
Copyright © 2005 - 2008 www.phpwebcommerce.com