Jump to content

Recommended Posts

I am trying to setup an ecommerce website and my client has purchased a CC processing gateway through yourpay.com and I am trying to follow their documentation for setting up their PHP API integration but I am confused as all get out.

 

the example form code they give

<?php
echo"<html><head><title>PHP_FORM_MIN.php LinkPoint Sample </title></head><body><br>";

/*
<!---------------------------------------------------------------------------------
* PHP_FORM_MIN.php - A form processing example showing the minimum 
* number of possible fields for a credit card SALE transaction.
*
* This script processes form data passed in from PHP_FORM_MIN.html
*
*
* Copyright 2003 LinkPoint International, Inc. All Rights Reserved.
* 
* This software is the proprietary information of LinkPoint International, Inc.  
* Use is subject to license terms.
*

	This program is based on the sample SALE_MININFO.php

	Depending on your server setup, this script may need to
	be placed in the cgi-bin directory, and the path in the
	calling file PHP_FORM_MIN.html may need to be adjusted
	accordingly.

	NOTE: older versions of PHP and in cases where the PHP.INI
	entry is NOT "register_globals = Off", form data can be
	accessed simply by using the form-field name as a varaible
	name, eg. $myorder["host"] = $host, instead of using the 
	global $_POST[] array as we do here. Passing form fields 
	as demonstrated here provides a higher level of security.

------------------------------------------------------------------------------------>
*/
include"lphp.php";
$mylphp=new lphp;

# constants
$myorder["host"]       = "hostname";
$myorder["port"]       = "postname";
$myorder["keyfile"]    = ".PEM-file"); # Change this to the name and location of your certificate file 
$myorder["configfile"] = "store-number";        # Change this to your store number
//$myorder["result"]       = "GOOD";

# form data
$myorder["cardnumber"]    = $_POST["cardnumber"];
$myorder["cardexpmonth"]  = $_POST["cardexpmonth"];
$myorder["cardexpyear"]   = $_POST["cardexpyear"];
$myorder["chargetotal"]   = $_POST["chargetotal"];
$myorder["ordertype"]     = $_POST["ordertype"];

if ($_POST["debugging"])
	$myorder["debugging"]="true";

  # Send transaction. Use one of two possible methods  #
//	$result = $mylphp->process($myorder);       # use shared library model
$result = $mylphp->curl_process($myorder);  # use curl methods

if ($result["r_approved"] != "APPROVED")    // transaction failed, print the reason
{
	print "Status:  $result[r_approved]<br>\n";
	print "Error:  $result[r_error]<br><br>\n";
}
else	// success
{		
	print "Status: $result[r_approved]<br>\n";
	print "Transaction Code: $result[r_code]<br><br>\n";
}

# if verbose output has been checked,
# print complete server response to a table
if ($_POST["verbose"])
{
	echo "<table border=1>";

	while (list($key, $value) = each($result))
	{
		# print the returned hash 
		echo "<tr>";
		echo "<td>" . htmlspecialchars($key) . "</td>";
		echo "<td><b>" . htmlspecialchars($value) . "</b></td>";
		echo "</tr>";
	}	

	echo "</TABLE><br>\n";
}
?> 

</body></html>

 

the HTML form

<!---------------------------------------------------------------------------------
* PHP_FORM_MIN.html - A form processing example showing the minimum 
* number of possible fields for a credit card SALE transaction.
*
* This page passes form data passed to the script PHP_FORM_MIN.php.  
*
*   Copyright 2003 LinkPoint International, Inc. All Rights Reserved.
*
*   This software is the proprietary information of LinkPoint International, Inc.
* Use is subject to license terms.
*-->


<html><head><title>PHP_FORM_MIN.html sample program</title></head><body>

<br>
<form name="form1" method="post" action="PHP_FORM_MIN.php">

<br><br>
<table>
<tr>
	<td align="right">ordertype</td>
	<td><input name="ordertype" value="SALE"></td>
</tr>
<tr>
	<td align="right">amount</td>
	<td><input name="chargetotal" value="9.99"></td>
</tr>
<tr>
	<td align="right">cardnumber</td>
	<td><input name="cardnumber" value="4111111111111111"></td>
</tr>
<tr>
	<td align="right">cardexpmonth</td>
	<td><input name="cardexpmonth" value="01"></td>
</tr>
<tr>
	<td align="right">cardexpyear</td>
	<td><input name="cardexpyear" value="05"></td>
</tr>
<tr>
	<td align="right"> debugging</td> 
	<td><input type=checkbox name="debugging"></td>
</tr>
<tr>
	<td align="right"> verbose output</td> 
	<td><input type=checkbox name="verbose"></td>
</tr>
<tr>
	<td> </td>
	<td> <input type="submit"></td>
</tr>
</table>
</form>

</font></body></html>

 

I am not understanding how all of this is supposed to work...

 

here is some of their instructions from their website

 

Build the XML string yourself and send it directly to the secure payment gateway.

This option requires a PHP version higher than 4.0.2 and cURL support to be compiled

into PHP. (This is the default setup for Red Hat® Linux® server installations.)

This option does not use the PHP module to build the XML string. You need to manage

your own XML output. This option is demonstrated in the PHP sample program

pass_xml_direct.php.

2. Use cURL (with OpenSSL) along with the lphp.php module.

Use this option with older versions of PHP or where PHP has not been compiled to

support cURL. This object accepts either hash-style input or XML.

3. Use the PHP built-in cURL methods along with the lphp.php module.

This is the easiest option to use. It requires PHP version higher than 4.0.2 and that

cURL support is compiled into PHP. (This is the default setup for Red Hat Linux server

installations.) This option accepts either hash-style input or XML.

4. Use the lphp.php module with the provided shared libraries and OpenSSL.

This option requires the provided shared libraries libspssl.so and liblphp.so to be

installed, and that you have OpenSSL libraries built with shared object support on your

web server.

This option uses the lphp.php module to accept either hash-style input or XML. It is

recommended for users with admin privileges on their server to correctly install the

shared libraries. FreeBSD 3.3 PHP users should not attempt to use the shared libraries

option. Shared libraries are not supported for FreeBSD 3.3 with PHP.

5. Build the XML stream yourself and send it through cURL or the shared libraries

provided with the PHP module.

This option requires the provided shared libraries libspssl.so and liblphp.so to be

installed, and that you have OpenSSL libraries built with shared object support on your

web server.

This option is demonstrated in the PHP sample program pass_xml_lib.php. To

determine whether PHP cURL support is installed, enter the command php -m in the

command prompt window.

 

If anyone can shed some light into my world, I will be greatly appreciative. I have contacted their support but its so hard to get anyone to answer back and in a timely manner. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/144879-openssl-api-integration/
Share on other sites

When you submit the information to the PHP file..

 

the following displays

 

Status: <

Error: <

 

Which according to yourpay.com's support line is because the .PEM file cannot be found but the .PEM file is in the same directory as all of the rest of the files... so I am not sure what is happening

  • 4 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.