Paypal payment process integration with automated function

Firs of all excuse me for my English, is not my native language.

Disclaimer: I don’t recommend anyone to use the files i give in this tutorial in a production server, I’m no responsible of any lost, hack, liability or any other thing that happen for the use of this files.

The purpose of this tutorial is to guide people in the payment process integration with Paypal, but you need to study a little to make great things happen.

Requirements:
– Paypal account (you at least must know how to use it)
– Web Server with PHP (no free host, unless you find a great free PHP host with cURL built in, try to find at least a shared host. Note that is for testing purposes, i recommend you for real environment your own VPS, AWS and so on)

Where going to use the Instant Payment Notification (IPN) service from paypal.

Short description: Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, tracking customers, and providing status and other information related to a transaction.

For use this service we’re going to need 4 files:
– The listener (ipn.php)
– A certify (cacert.pem)
– A pay form (payform.php)
– The check items file (itemcheck.php)

The listener will receive the Paypal transactions and if the transaction is ok it will create a file in your server inside a folder called “pays” with the id of the player.

The certify as always, you need a key for transactions.

The pay form is where you copy your html from your paypay account.

The check items file is the one that finds if the user already pay for the weapon and if so, show to the player. You can find a capx file with an ajax query to this file.

You can download all those files here:

Put all the files in your server for example:

http://www.example.com/paypal/ipn.php
http://www.example.com/paypal/cacert.php
http://www.example.com/paypal/payform.php
http://www.example.com/paypal/itemcheck.php

You can put where you want but remember that path because we need for the next step.

Now we need to enable the service in our account so you need to log in to your Paypal account, then you land in My Account tab, under the same tab we need to go on the Profile link:

Then go on the link Instant Payment Notification Preferences:

Set the settings for our IPN:

Now we must fill the Notification URL field with the URL where we place the listener (ipn.php), then select the Receive IPN messages (Enabled) option to get the notifications when someone makes a payment and Save.

Now you should see you current settings, in my case I use one of my testing domains  so this is how my settings looks like:

Now that all is up, every payment we receive will be listened by our listener (ipn.php), currently supported payments are eCheck, Express Checkout, Cart Checkout, Web Accept, Refunds, eBay Checkout and Reversal.

So lets create a payment button under the merchant services tab:

When you finish your button copy the code that paypal generates:

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s