Paypal expert

I need my order form at www.JointVentureDeals.com/order.htm simply integrated with my Authorize Net gateway account. I have all the fields in the form that I believe are correct.

Need ur assistance...
akiles99Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EMB01Commented:
I have integrated PayPal from the ground up... What's the specific question?
0
akiles99Author Commented:
I'm going to appear for paypal developer certification.Need to learn more about in parallel.

Can u guide me..?
0
EMB01Commented:
Depends on what you're trying to do - what's your specific question(s) regarding PayPal integration with PHP applications?
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

akiles99Author Commented:
Tell me how u integrate paypal with the php code?
0
EMB01Commented:
The easiest way to integrate PayPal with PHP is to use the PayPal IPN:
https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside
0
akiles99Author Commented:
Also when i learning abt the paypal i heard of soap API...

Any idea about it?
0
akiles99Author Commented:
Can u explain this code...I'm new to coding..But can understand if u teach me...
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
 
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
 
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
 
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
 
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>

Open in new window

0
EMB01Commented:
Sure, I'll explain how this code works in the comments attached (it's mostly done for me already):

How PayPal's IPN works:
https://www.paypal.com/IntegrationCenter/ic_ipn.html

For-Loop definition and example:
http://www.tizag.com/phpT/forloop.php

I highly recommend reading the following book... I didn't know how to integrate PayPal before I read it either:
http://www.amazon.com/Professional-Web-APIs-PHP-Google/dp/0764589547

There's a section in there specifically on integration the IPN. You'll still have some questions, but you can always post them here for help.

About the SOAP API, I try not to use it because mostly everything I need can be done using the IPN. The IPN doesn't require any API credentials, either. So, you can use it with any PayPal account. Check this out for more information on the SOAP API:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_soap_PayPalSOAPAPIArchitecture
// read the post from PayPal system and add 'cmd'
// This part adds a field to the PayPal post which will be sent back (below) for security purposes (see above)
$req = 'cmd=_notify-validate';
 
// This part creates a for-loop (see above) from the POST data and adds the field from before ('cmd') for PayPal to validate.
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
 
// post back to PayPal system to validate
// This is the actual POST-back function as it appends the HEADER information to be sent. NOTE: You'll need to use a different socket when using PayPal's sandbox.
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
 
// assign posted variables to local variables
// This next part simply assigns the variables from the POST data.
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
 
if (!$fp) {
// HTTP ERROR
// This part throws an error if the socket could not be opened. Otherwise, if the socket was opened, the HEADER data is sent. 
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
// This part returns the result (whether PayPal verified the order or not).
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EMB01Commented:
P.S. The function above isn't exactly a for-loop, but it is good to know how to use one anyway. Here is documentation on the actual function used in the script:
http://us.php.net/foreach
0
akiles99Author Commented:
>>>I highly recommend reading the following book... I didn't know how to integrate PayPal before I read it either:

But u know some coding languages right?But i dont know any language.Jus starting my carreer.
0
EMB01Commented:
I knew very little, but PHP is quite easy for me now. Let me tell you, PHP (in my experience) is simply getting an understanding of how programming works (i.e. declaring variables, using functions, etc.), learning functions, and learning best programming practices. If you're beginning programming, I would also recommend this series of books (Visual Blueprint):
http://www.amazon.com/PHP-Blueprint-Creating-Server-Side-Content/dp/0764535617

That book will help you understand programming in general, and show you how PHP works at the same time.

Also, if you're just beginning; you probably don't want to just start out learning PHP. I think it would be wise to gain a solid understanding of HTML (if you havn't already). That way, you'll get to learn how programming works.

It took me a pretty long time before I was able to program my own applications. You may be better off taking a computer-programming class. All I did was read books...
0
akiles99Author Commented:
So u first want me to read HTML?Any good links for that...
0
EMB01Commented:
Of course, check this place out:
http://www.w3schools.com/html/DEFAULT.asp

Another good way to accomplish programming goals for beginners is to use pre-built tools, such as these from WebAssist:
http://www.webassist.com/
0
akiles99Author Commented:
U really helped a lot...

I will sure read the books u preferred.

I have a account to my company library where i have all the books u said.Jus now going thru the web API also i found a book same like this but that is development with API.

Anyway i first follow ur instructions.

1.Html
2.PHP
3.WebAPI

Right?
0
akiles99Author Commented:
Who is Expert?

Who shares and care for helping others and EMB01 is the one and best i have seen.

Thanks a lot:)
0
EMB01Commented:
Yes, I believe that's the best way to go about your education in this field. Remember, these are the goals to go after:
- Gain a solid understanding of general programming (via simple languages such as HTML, CSS, even BBCODE.
- Learn basic PHP syntax and use of variables, functions and operators (http://us2.php.net/manual/en/language.basic-syntax.php).
- Implement these programming practices to create custom applications using a web-based API (such as PayPal).
0
akiles99Author Commented:
Thanks i will sure follow this may be it takes some years But i will be reach u oneday with my improvement...

Also http://www.webassist.com/  which one i need to use?
0
EMB01Commented:
Well, I'm not sure you'll ever reach me! (just kidding!)

I recommend using WebAssist if you use Dreamweaver. They make extensions for Dreamweaver that will assist in development. For example, if you want a pre-built (but customizable) shopping cart that will integrate PayPal with Authorize.NET, check out this product:
http://www.webassist.com/professional/products/productdetails.asp?PID=123
0
akiles99Author Commented:
Ok Thanks....Its already late see u tomorrow on different thread:)

Good Night::)-
0
EMB01Commented:
Take it easy! I'm glad I could help. Goodluck and stick with it - it'll be hard at first (I'm self-educated) and you'll probably get lost a bit; but remember: You can do it!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
E-Commerce

From novice to tech pro — start learning today.