views:

308

answers:

3

I am trying to figure this site out http://integrationwizard.x.com/ecpaypal/code.php to integration the payment system into my site but i am really confused on how to get it to work.

the site im doing this for is http://alldaywhite.com/

this is what i did if you enter some information on the first page the second page will be the payment page.

no clue on what to include where because those are the two pages ill be using. the confirmation page is where the user will be redirected if the payment is sucessful.

can someone help me on this. thanks

A: 

I believe that you will find the launch page for paypal integration to be of use to you. I am assuming that you are a developer with a thorough understanding of HTML.

Glenn
yes, im a developer and have memorized html lol. im doing this in php
+1  A: 

There are three steps (on your end) to processing a transaction

  1. initiating the transaction
  2. redirecting to the paypal page
  3. checking the transaction result on the merchantReturnURL

Recently I've integrated Paypal, iDEAL, IcePay and Saferpay into our CMS and I'm just getting started on bukckaroo. In my experience, wizards don't work for any kind of custom situation.

I can't recommend writing your own code enough (ofcourse using whatever API the provider offers) wizards that generate code to be used in a website they know nothing about don't sound any kind of trustworthy to me.

Get the Paypal API documentation and make sure you understand the internals before writing any code to handle it. Paypal's php example code is exceptionally good to learn off, but not to use. They also have excellent developer support via community.

Kris
A: 

I think what you're looking for here is IPN integration(https://www.paypal.com/ipn) allowing the paypal servers to report back to your site automatically. You basically have to log into paypal and tell it where on your server to send the data.

This code example was taken from the paypal site for PHP. You need to host this on your server and point paypal to it. From this you can get every last tiny bit of data autmaticaly from a transaction. You can then use php to insert it into a database or do whatever other billing or reporting tasks you need.:

// 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);
}
?>
Travis