Jump to content

Aktive merchant / PayPal help


driz

Recommended Posts

Hi, I am building a PHP-based form that grabs a persons contact details and asks them a question, depending on the answer they choose they can either purchase a product or they will be told they don't qualify and a sales person will be in touch. I have managed get all of this working, but now need to do the payment part. Their is only one product and the user has no options all they do is pay a fixed price and job done!I have been told to look at Aktive Merchant: http://github.com/akDeveloper/Aktive-Merchant to handle this. But their seems little documentation and I could do with some help setting this up. I will be using PayPal for the payment system. Some of the things that are confusing me are will a user have to re-enter all their address details (will they even be sent to the paypal site) don't quite get how this code works, but essentially all I want is for a quick easy way to grab the payment details from a user and send them a confirmation email.The code for the form is as follows:

<!DOCTYPE html><html lang="en">	<head>		<meta http-equiv="content-type" content="text/html; charset=utf-8">		<meta name="viewport" content="width=1024">		<title>Buy</title>		<script src="jquery.min.js"></script>		<script src="jquery.validate.min.js"></script>		<script src="jquery.functions.js"></script>		<style>		html,		input		{			font: 12px Arial, sans-serif;		}		body		{			width: 980px; margin: 30px auto;		}		label.error {			float: right;		}				ul		{			list-style: none;		}		ul.radio input, ul.radio label {			 cursor: pointer;		}		label		{			display: block;		}		span.name		{			display: block; float: left;		}		span.name label		{			display: block; font-size: 11px;		}				li		{			clear: both;		}				</style>	</head>		<body>			<?php				if(isset($_POST['continue']))				{						// Send info to email address						$to = "talk2driz@gmail.com";			$subject = "SolidCAM Xpress";									$firstname = $_POST['firstname'];			$lastname = $_POST['lastname'];			$email = $_POST['email'];			$phone = $_POST['phone'];			$organisation = $_POST['organisation'];						$address1 = $_POST['address1'];			$address2 = $_POST['address2'];			$address3 = $_POST['address3'];			$postcode = $_POST['postcode'];						$solidworks = $_POST['solidworks'];						if($solidworks == 'No')			{				$reseller = 'None';			}			else			{					$reseller = $_POST['reseller'];				}						// message			$message = "			<html>			<head>			  <title>SolidCAM Xpress</title>			</head>			<body>				<p>The following customer has attempted to purhase SolidCAM Xpress</p>			  <table>				<tr>				  <th>Name</th>				  <td>$firstname $lastname</td>				</tr>				<tr>				  <th>Email</th>				  <td>$email</td>				</tr>				<tr>				  <th>Phone</th>				  <td>$phone</td>				</tr>				<tr>				  <th>Organisation</th>				  <td>$organisation</td>				</tr>				<tr>				  <th>Address Line 1</th>				  <td>$address1</td>				</tr>				<tr>				  <th>Address Line 2</th>				  <td>$address2</td>				</tr>				<tr>				  <th>Address Line 3</th>				  <td>$address3</td>				</tr>				<tr>				  <th>Post code</th>				  <td>$postcode</td>				</tr>				<tr>				  <th>Reseller</th>				  <td>$reseller</td>				</tr>			  </table>			</body>			</html>			";						// To send HTML mail, the Content-type header must be set			$headers  = 'MIME-Version: 1.0' . "\r\n";			$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";						// Additional headers			$headers .= 'Reply-To: SolidCAM UK <info@solidcamuk.com>' . "\r\n";			$headers .= 'From: SolidCAM UK <info@solidcamuk.com>';						// Mail it			mail($to, $subject, $message, $headers);						// run the reseller check function			ResellerCheck();				}				else				{				?>				<form id="BuyForm" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">				<fieldset>				<legend>About you</legend>								<ul>					<li>						<label>Name</label>						<span class="name">							<input type="text" id="firstname" name="firstname" />							<label for="firstname">First name <em>*</em></label>						</span>						<span class="name">							<input type="text" id="lastname" name="lastname" />							<label for="lastname">Last name <em>*</em></label>						</span>					</li>					<li>						<label for="email">Email <em>*</em></label>						<input type="text" id="email" name="email" />					</li>					<li>						<label for="phone">Phone <em>*</em></label>						<input type="text" id="phone" name="phone" />					</li>					<li>						<label for="organisation">Organisation <em>*</em></label>						<input type="text" id="organisation" name="organisation" />					</li>					<li>						<label for="address1">Address Line 1 <em>*</em></label>						<input type="text" id="address1" name="address1" />					</li>					<li>						<label for="address2">Address Line 2 <em>*</em></label>						<input type="text" id="address2" name="address2" />					</li>					<li>						<label for="address3">Address Line 3</label>						<input type="text" id="address3" name="address3" />					</li>					<li>						<label for="postcode">Post code <em>*</em></label>						<input type="text" id="postcode" name="postcode" />					</li>				</ul>							</fieldset>						<fieldset>				<legend>Do you currently have SolidWorks <em>*</em></legend>								<ul class="radio">					<li><label for="yes"><input type="radio" name="solidworks" id="yes" value="Yes" /> Yes</label></li>					<li><label for="no"><input type="radio" name="solidworks" id="no" value="No" /> No</label></li>				</ul>				<div id="divReseller" style="display:none;">									<p>Who is your SolidWorks reseller?</p>					<ul class="radio">						<li><label for="rd1"><input type="radio" id="rd1" name="reseller" value="Cad Connect" /> Cad Connect</label></li>						<li><label for="rd2"><input type="radio" id="rd2" name="reseller" value="Cadtek" /> Cadtek</label></li>						<li><label for="rd3"><input type="radio" id="rd3" name="reseller" value="CCSL" /> CCSL</label></li>						<li><label for="rd4"><input type="radio" id="rd4" name="reseller" value="Innova" /> Innova</label></li>						<li><label for="rd5"><input type="radio" id="rd5" name="reseller" value="NT CAD/CAM" /> NT CAD/CAM</label></li>						<li><label for="rd6"><input type="radio" id="rd6" name="reseller" value="Solid Engineer" /> Solid Engineer</label></li>						<li><label for="rd7"><input type="radio" id="rd7" name="reseller" value="Solid Solutions Ireland" /> Solid Solutions Ireland</label></li>						<li><label for="rd8"><input type="radio" id="rd8" name="reseller" value="Solid Solutions Management" /> Solid Solutions Management</label></li>						<li><label for="rd9"><input type="radio" id="rd9" name="reseller" value="TMS Scotland" /> TMS Scotland</label></li>					</ul>									</div>						</fieldset>						<p>* required fields</p>						<p><input type="submit" name="continue" value="Continue" /></p>					</form>				<?php				}				?>				<?php				// Check if user has selected None from the last question then show the message or go to paypal		function ResellerCheck()		{					$solidworks = $_POST['solidworks'];					if($solidworks == 'No')			{				echo "SolidCAM Xpress requires a valid copy of SolidWorks, we will be in touch shortly to discuss pricing!";			}			else			{				// Do some PAYPAL stuff			}				}				?>		</body></html>

As you will see at the very end is a simple if statement that checks if they chose a particular reseller or not, and if they have then I want to do the paypal stuff, but need a little help with how to use that Aktive Merchant, presuming of course that is the best solution.Thanks.

Link to comment
Share on other sites

you have to match the input names used in paypal when you transfer to paypal page. they have only addres1 and address2, postcode is zip, county is state, you can nick.. sorry! "borrow" their dropdown listing of countries.
Where do you find this list of input names? Also how do I get this to work with Aktive merchant ( do I even need it? or would it be easy without? )Would you be able to share some sample code to get my code talking to PayPal. Thanks
Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...