File seller script? I need a Webshop/Paypal payment script->

Discussion in 'PHP' started by -ShAdOwBoY-, Aug 16, 2009.

  1. #1
    Someone knows about a free webshop script?
    im starting a online business for my scripts and dont know about a file seller script.

    Example of a site i like to buy/download is:

    www.rpgbunny.com

    Like that system. And it must have paypal payment with download link to buyers mail after transacton automaticly.

    Hope someone answer me.
    Im in a hurry getting my portal up.. Only miss a file seller section.

    Contact me!

    stukeposen@hotmail.com
     
    -ShAdOwBoY-, Aug 16, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you got most of the system setup already (ie: checking out and paying to paypal but not the rest) you can simply use Paypal's IPN example script to set the download (IPN = Instant Payment Notification) , the way it works, if you provide a notify_url= in the payment form, it will send the payment notification to that URL, upon receiving the script will message paypal back to verify that the transaction is real, and if its "Completed" you can then update the database for whatever user made the purchase.

    An example of a paypal class can be found here:

    http://www.weberdev.com/get_example-4168.html

    Except I Don't bother with a class and do this (I snipped out most of my insertion commands):

    say this is in verify.php (in your paypal form you would need to add notify_url=http://yourdomain.com/verify.php or something like that)
    
    <?
    	function verify()
    	{
    		$verify = false;
    		$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);
    		
    		if(!$fp)
    			return false; // http error
    		
    		fputs ($fp, $header . $req);
    		while (!feof($fp)) {
    			$res = fgets ($fp, 1024);
    			if (strcmp ($res, "VERIFIED") == 0) {
    				$verify = true;
    				break;
    			}
    			else if (strcmp ($res, "INVALID") == 0) {
    				break;
    			}
    		}
    		fclose ($fp);
    		return $verify; // false by default unless true due to verification
    	}
    	
    	
    	function insert_data()
    	{
    		global $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'];
    		$name = $_POST['first_name']." ".$_POST['last_name'];
    		$contact = $_POST['option_selection2'];
    		
                    /* you can setup a database or whatever else here to store the information */
    		
    		// 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
    	}
    
    	$data = "";
    	foreach ($_POST as $key => $value) {
    		$value = urlencode(stripslashes($value));
    		$data .= "\n$key=$value";
    	}
    
    	$verify = verify();
    	/* The blanked out part is an extra layer of security that the payment is only valid
    	  if it was sent to your own merchant ID as opposed to someone else paying themselves
    	  and using your url as a notify url */
    	if($_POST['receiver_id'] == "BLANKED-OUT")
    	{
    		if($_POST['mc_currency'] == "USD")
    		{
    			if($verify) 
    				insert_data();
    			else
    				mail("your@email.com", "IPN Notice", "Could not Verify");
    			/* If paypal said the transaction was valid, plus it was in your currency, then insert the data
    			  otherwise you can somehow make it warn you that a bad attempt was made, thus helping you
    			  track down the person's account the payment was intended for */
    		}
    		else
    		{
    			if($verify)
    				$add = " and was verified as an actual transaction.";
    
    			mail("info@karlblessing.com", "IPN Notice", "A Payment for Transaction ".$_POST["txn_id"]." was not in USD currency".$add." \n ".$data);
    			/* The idea here is that if you receive payment in a different currency, you can log the transaction for manual inspection */
    		}
    	}
    ?>
    
    PHP:
     
    kblessinggr, Aug 16, 2009 IP
  3. -ShAdOwBoY-

    -ShAdOwBoY- Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thats not what im after.. i know about that you wrote, but looking for similiar complete shop script as www.rpgbunny.com

    But thanx anyway for reply! :D
     
    -ShAdOwBoY-, Aug 16, 2009 IP
  4. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I don't know of any free ecommerce scripts that worth a look, cuz even zencart has horror stories behind it. The best 'paid' script I've messed with on several occasions was x-cart, and its also very easy to customize the design which is based on smarty (well easy for me anyways), supports several shipping modules as well as several payment gateways including paypal and authorize.net

    Sometimes you can end up wasting more money with your time trying to find a free solution than if you just went with the paid solution, especially if you're trying to run a business.
     
    kblessinggr, Aug 16, 2009 IP
  5. -ShAdOwBoY-

    -ShAdOwBoY- Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thats what im talking about =) Thanx for reply!:)
     
    -ShAdOwBoY-, Aug 17, 2009 IP