DeathStar Posted February 25, 2007 Share Posted February 25, 2007 Hi I have donations on my website and would like to know how people make scripts that automaticly credit users? ex. The site >> Paypal >> The Site (you got what you bought) Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/ Share on other sites More sharing options...
Jessica Posted February 25, 2007 Share Posted February 25, 2007 Using Paypal's IPN. You'll have to read their API Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193821 Share on other sites More sharing options...
DeathStar Posted February 25, 2007 Author Share Posted February 25, 2007 API? Please explain. Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193824 Share on other sites More sharing options...
superuser2 Posted February 25, 2007 Share Posted February 25, 2007 Ok, an API is an Application Programming Interface and it's a way for your code to interact with their's. Google it. Paypal has an API that let's your script interact with their's. Once again, google it, or go to Paypal and look for a "Developer's" section. Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193828 Share on other sites More sharing options...
Jessica Posted February 25, 2007 Share Posted February 25, 2007 Did you even think to look at Paypal's site before asking me to explain more? Or searching? You are supposed to try to figure the problem out by researching it before asking questions like that. http://www.google.com/search?q=define:+API https://www.paypal.com/IntegrationCenter/ic_home.html Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193829 Share on other sites More sharing options...
DeathStar Posted February 25, 2007 Author Share Posted February 25, 2007 I did :| what i meant is how would i use somethin g liek this in my code to make it work PHP 4.1 // 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 ('www.paypal.com', 80, $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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193831 Share on other sites More sharing options...
Jessica Posted February 25, 2007 Share Posted February 25, 2007 We can't tell that without seeing your code. This is really a third-party question too. Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193838 Share on other sites More sharing options...
DeathStar Posted February 25, 2007 Author Share Posted February 25, 2007 at this moment i only have a page with paypal buttons Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193839 Share on other sites More sharing options...
AndyB Posted February 25, 2007 Share Posted February 25, 2007 PayPal has reams of information about this. There's a paypal forum at www.paypaldev.org that should get you a fast answer to a specific problem, and you can always sign up for the PayPal sandbox (test environment) at https://developer.paypal.com Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193845 Share on other sites More sharing options...
DeathStar Posted February 25, 2007 Author Share Posted February 25, 2007 ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/40073-yet-another/#findComment-193846 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.