Wednesday, March 17, 2010

Welcome To Devils Workshop!!!

Welcome To Devils Workshop!!!


How to use PayPal Instant Payment Notification for e-commerce Website?

Posted: 17 Mar 2010 07:30 AM PDT


In this part, we are going to learn about PayPal Instant Payment Notification (IPN).

IPN is a message service that notifies you of events related to PayPal transactions. You can use IPN to automate back-office and administrative functions. As the name says Instant Payment Notification, it really is instant. The moment a customer buys a product from your website using PayPal, IPN reaches your server within few seconds.

The process is shown in the following image (Copied from PayPal)

When a customer buys your product, PayPal sends the transaction detail to the IPN URL provided by you.

Lets write a code to handle IPN

        $req = 'cmd=_notify-validate';         //Collect the variables sent by PayPal         foreach ($_POST as $key => $value) {             $value = urlencode(stripslashes($value));             $req .= "&$key=$value";         }          //Send them back to PayPal to verify whether they are authentic or not         $paypal_action = 'https://www.paypal.com/cgi-bin/webscr';         //For PayPal Sandbox: $paypal_action = 'https://www.sandbox.paypal.com/cgi-bin/webscr';         $ch = curl_init($paypal_action);         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);         curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);         curl_setopt($ch, CURLOPT_POST, 1);         curl_setopt($ch, CURLOPT_POSTFIELDS, $req);         $result = curl_exec($ch);         curl_close($ch);          //If PayPal verified the posted data         if (strcmp ($result, "VERIFIED") == 0) {             $transaction_id = $_POST['txn_id'];             $payment_status = $_POST['payment_status'];             $item_name = $_POST['item_name'];             $amount = $_POST['mc_gross'];             $quantity = $_POST['quantity'];             $fee_deducted = $_POST['mc_fee'];             $payer_email = $_POST['payer_email'];             $payment_date = $_POST['payment_date'];              //Check the payment status             switch($payment_status) {                 case 'Processed':                     //Processed and Completed are almost same. Perform the action for successful payment.                     break;                  case 'Completed':                     //Perform the action for successful payment.                     break;                  case 'Pending':                      //Perform the action for pending payment status.                     break;                  default:                     break;              }         }         else {             //Perform the action for invalid IPN.         }

Lets see what we have done so far.

PayPal sends the transaction details to our server. To check whether, PayPal sent this data, we need to send the data back to PayPal. If the data was sent by PayPal, it will display “VERIFIED”.

  • Line # 1-6: To send data back to PayPal, we will first collect the variables posted to our server. We need to add ‘cmd=_notify-validate’ to these variables to tell PayPal to validate the data provided.
  • Line # 8-17: We will use CURL to send data back to PayPal. We will collect the information displayed by the PayPal in $result.
  • Line # 20: We will check whether the posted data was valid or not.
  • Line # 21-28: If the data is valid, then we will stored the sent data in variables. Few examples of the variables are:
    • txn_id : This is the transaction id of the transaction made. It is unique for every transaction.
    • item_name : This is the product name.
    • mc_gross: Full amount of the customer’s payment, before transaction fee is subtracted.
    • mc_fee: Transaction fee which is deducted for the transaction.
    • payment_status: The payment status such as Processed, Completed, Pending, Failed, etc.
    • payer_email: Email address of the payer.
    • payment_date: Date on which payment was made.

    For more information on variables, refer PayPal IPN and PDT Variables

  • Line # 31-47: Depending on the payment status, perform the necessary action.

By using IPN, you can maintain inventory, transaction logs and automate so many other things.

For more information on PayPal IPN, you can refer the following link:

DW Anniversary offer: Grab .com domain for 6$

This Post How to use PayPal Instant Payment Notification for e-commerce Website? is Published on Devils Workshop .


Related posts:

Top 5 Flickr Upload Tools

Posted: 17 Mar 2010 01:56 AM PDT


Flickr is one of the best online photo management and sharing application in the world. It provides you with an account where you can store your images, from here you can manage and share these images.

To be in brief Flickr is nothing but a Online Photo Sharing Community where you can share your photos or else you can store them as private. Flickr came with a caption “Show off you favorite Photos and Videos to the World”.

I have provided the list of Flickr tools for uploading your pictures into the Flickr. Lets check them out.

  1. Flidget
  2. FlickrUploadr
  3. jUploadr
  4. Flickr Importr
  5. Photo Upload

Flidget : Its a simple widget to upload images into the Flickr. It is a simple dashboard.

FlickrUploadr : Flickr Uploading tool that works on the Windows and Mac OS. But few people have created the private tool that works on the Linux.

jUploadr : It is a cross platform, cross site photo uploader. It is compatible with Windows, Linux and Mac OS to upload photos on Flickr and Zoomr.

Flickr Importr : It is a simple photo uploader which is compatible of Windows OS used to upload images to Flickr and will automatically adds them to groups and sets.

Photo Upload : It is a third party program that allows us to upload our photos into Flickr and also provides the mapping for your photos according to their names.

DW Anniversary offer: Grab .com domain for 6$

This Post Top 5 Flickr Upload Tools is Published on Devils Workshop .


Related posts:

Microsoft finally takes browsers seriously with Internet Explorer 9

Posted: 17 Mar 2010 01:06 AM PDT


Last year Microsoft launched its browser Internet Explorer 8; it received more brickbats than flowers. Let us face it, it did not consolidate Internet Explorer’s browser market share and not did perform better than the latest versions of Firefox and Chrome.

Now Internet Explorer 9 is out and will have some interesting innovations and I thought I should try it out and see how good it really is.

About Internet Explorer 9

  • There are many changes expected with IE 9, and one of them is to make it safer and more compliant to the dominating web technologies in present day. For this reason IE 9 will not work on Windows XP. This will have a double fall out as many customers with XP will one more reason to upgrade to Windows 7.
  • I took a peek at it’s testing environment for IE 9 and found it much faster than IE8. Internet Explorer seemed to be no where in the league as far as speed was concerned but with IE9 they seem to want to deliver that.
  • IE 9 will be highly compliant to HTML 5 technology and that is apparent considering it is aimed at scoring high on tests carried on browser with respect to HTML 5 technology. One of the main criteria it will face will be the Acid3 test which Chrome. It did not do as well as Chrome is doing now but remember IE9 is still in early development mode.
  • In doing a bit of exploring it seems to have some novel graphics features which will allow easy text zooming and image exploring. On early usage of Image exploring it looked like a similar version of CoolIris add-on with Chrome.

I will be writing a detailed post on Internet Explorer 9 version’s platform preview soon which allows you a peek at IE9 and some of it’s feature.

In the mean time you can visit their test drive page for IE9 and drop in your comments here with what you think IE 9 needs to address if it has to compete against browsers like Firefox and Chorme when it comes to performance.

DW Anniversary offer: Grab .com domain for 6$

This Post Microsoft finally takes browsers seriously with Internet Explorer 9 is Published on Devils Workshop .


Related posts:

Twitter will become omnipresent on the web with @anywhere

Posted: 16 Mar 2010 09:30 PM PDT


Twitter has decided to grow its presence even more than before. For the moment we go to You Tube to look at clips be like and share with with short URLs on Twitter. When we visit a web-page we need to share that link on our Twitter accounts through Tweetmeme or actually copy paste it with some Twitter App.

Now with Twitter @anywhere we will be able to Tweet about links from that page itself.

About @anywhere

  • According to Twitter blog, this will allow webmasters to allow visitors to share things on Twitter without requiring to visit Twitter applications.
  • This will not be a Twitter API but a few lines of JavaScript which will allow Twitter to be tied to the websites in the image above.
  • This will allow websites to allow visitors to interact using Twitter in many new ways. Example in the future if DW has enabled this @anywhere concept on our blog you will be able to follow me on twitter without needing to leave the page you are reading. :-)

What do you think about this new feature that Twitter will roll out? I think Twitter will make itself omnipresent all over the internet and that seems like good news.

Do drop in your comments to tell me what do you think such innovations will lead to?

DW Anniversary offer: Grab .com domain for 6$

This Post Twitter will become omnipresent on the web with @anywhere is Published on Devils Workshop .


Related posts:

0 comments: