<?php require_once 'Payment/Process2.php'; $options = array(); // If you have a test store on the staging server uncomment these // $options['host'] = 'staging.linkpt.net'; // $options['port'] = '1129'; // Path to your keyfile (the pem file given to you by linkpiont) $options['keyfile'] = '/path/to/your/keyfile.pem'; $process = Payment_Process::factory('LinkPoint', $options); $process->_debug = true; $process->login = '******'; // Your linkpoint store ID $process->password = '******'; // Your store's password $process->action = Payment_Process2::ACTION_AUTHONLY; $process->amount = 1.0; $card = Payment_Process2_Type::factory('CreditCard'); $card->type = Payment_Process2_Type::CC_VISA; $card->invoiceNumber = 112345145; $card->customerId = 1461264151; $card->cardNumber = '411111111111111'; $card->expDate = '08/2008'; $card->zip = '98123'; $card->cvv = '444'; $process->setPayment($card); $result = $process->process(); print_r($result); echo "\n"; echo "---------------------- RESPONSE ------------------------\n"; echo $result->getMessage() . "\n";
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @category Payment * @package Payment_Process2 * @author Ian Eure <*****@*****.**> * @copyright 2003-2008 The PHP Group * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version CVS: $Id$ * @link http://pear.php.net/package/Payment_Process2 */ require 'Payment/Process2.php'; // Set options. These are processor-specific. $options = array('randomResult' => true); // Get an instance of the processor $processor = Payment_Process::factory('Dummy', $options); // The data for our transaction. $data = array('login' => "foo", 'password' => "bar", 'action' => Payment_Process2::ACTION_NORMAL, 'amount' => 15.0); // The credit card information $cc = Payment_Process2_Type::factory('CreditCard'); $cc->type = Payment_Process2_Type::CC_VISA; $cc->cardNumber = "4111111111111111"; $cc->expDate = "99/99"; $cc->cvv = "123"; /* Alternately, you can use setFrom() $ccData = array( 'type' => Payment_Process2_Type::CC_VISA, 'cardNumber' => "4111111111111111", 'expDate' => "99/99", 'cvv' => 123 );
<?php require_once 'Payment/Process2.php'; $options = array(); $options['x_test_request'] = 'TRUE'; $options['x_delim_data'] = 'TRUE'; $options['avsCheck'] = true; $options['cvvCheck'] = true; $process = Payment_Process::factory('AuthorizeNet', $options); $process->_debug = true; $process->login = '******'; $process->password = '******'; $process->action = Payment_Process2::ACTION_AUTHONLY; $process->amount = 1.0; $card = Payment_Process2_Type::factory('CreditCard'); $card->type = Payment_Process2_Type::CC_VISA; $card->invoiceNumber = 112345145; $card->customerId = 1461264151; $card->cardNumber = '4111111111111111'; $card->expDate = '01/2005'; $card->zip = '48197'; $card->cvv = '768'; $result = $card->validate(); $result = $process->setPayment($card); $result = $process->process(); print_r($result); echo "\n"; echo "---------------------- RESPONSE ------------------------\n"; echo $result->getMessage() . "\n"; echo $result->getCode() . "\n"; $validate = $result->validate();
/** * FIXME NID and AID are never used, but are in the parameter list * * @param unknown_type $uid * @param unknown_type $nid * @param unknown_type $aid * @param unknown_type $planid * @param unknown_type $ccn * @param unknown_type $cctype * @param unknown_type $expdate * @param unknown_type $firstname * @param unknown_type $lastname * @param unknown_type $email * @param unknown_type $phone * @return unknown */ private static function subscribeViaGateway($uid, $nid, $aid, $planid, $ccn, $cctype, $expdate, $firstname = null, $lastname = null, $email = null, $phone = null) { $response = array(); $result = Api_Dao_Payments::getGateway(); $response['gateway'] = $result; // error_log( 'response: ' . print_r( $response, true ) ); $options = array('action' => 'subscribe'); $type = $response['gateway'][0]['type']; $processor = Payment_Process::factory($type, $options); if (!PEAR::isError($processor)) { $processor->login = $response['gateway'][0]['subject']; $processor->password = $response['gateway'][0]['password']; $processor->amount = self::calculateAmount($planid); $card = Payment_Process_Type::factory('CreditCard'); $card->type = $cctype; if (!isset($firstname) || !isset($lastname)) { throw new Exception('First name or last name is not set; can not process payment.'); } $card->firstName = $firstname; $card->lastName = $lastname; $card->cardNumber = $ccn; $card->expDate = $expdate; $processor->setPayment($card); $processor->refId = 'refid-' . time(); $processor->subscriptionName = 'sub-' . time(); $processor->intervalLength = 1; $processor->intervalUnit = 'months'; $dateArray = getdate(); $dateStr = date('Y-m-d', $dateArray[0]); $processor->startDate = $dateStr; $processor->totalOccurrences = '9999'; mt_srand(time()); $rand = mt_rand(); $processor->invoiceNumber = $uid . '-' . $rand; if (isset($email)) { $processor->email = $email; } if (isset($phone)) { $processor->phoneNumber = $phone; } $result = $processor->process(); if (PEAR::isError($result)) { throw new OpenFBAPIException($result->getMessage()); } return $result; } }