PHP Classes

File: example_plug_n_pay.php

Recommend this page to a friend!
  Classes of Fabrizio Parrella   bibEC Process Card   example_plug_n_pay.php   Download  
File: example_plug_n_pay.php
Role: Example script
Content type: text/plain
Description: this is a simple example for PlugNPay
Class: bibEC Process Card
Multiple gateway credit card payment processor
Author: By
Last change: updated to version 1.3.1.2
Date: 17 years ago
Size: 2,657 bytes
 

Contents

Class file image Download
<?php
$bibEC_ccp
= new bibEC_processCard('plug_n_pay');
$bibEC_ccp->save_log($file); // the name of a LOG FILE
$bibEC_ccp->set_user($cc_user, $cc_password, $cc_key, $admin_email);
$bibEC_ccp->set_customer($fname, $lname, $address, $city, $state, $zip, $country, $phone, $fax, $email);//can be passed the IP as last field, optional
$bibEC_ccp->set_ship_to($fname, $lname, $address, $city, $state, $zip, $country, $phone, $fax);
$bibEC_ccp->set_ccard($name_on_card, $type, $number, $expmm, $expyy, $cvv);
$bibEC_ccp->set_valuta('USD', '$');
$bibEC_ccp->set_order($total_cart, $order_number, $description, 'auth', NULL, NULL, NULL); //the last 5 fields are:
                                                                                            // mode
                                                                                            // authcode
                                                                                            // transnum
                                                                                            // currency code //optional: there is a separate function now
                                                                                            // currency simbol //optional: there is a separate function now

//I am going to set extra fields if the gateway needs them

//$extra['ipaddress'] = $_SERVER['REMOTE_ADDR']; //not necessary anymore from version 1.2.4
$extra['app-level'] = 1; // ONLY FOR PLUG_N_PAY
                                    // 0 Anything Goes. No transaction is rejected based on AVS
                                    // 1 Requires a match of Zip Code or Street Address, but will allow cards where the address information is not available. (Only 'N' responses will be voided)
                                    // 2 Reserved For Special Requests
                                    // 3 Requires match of Zip Code or Street Address. All other transactions voided; including those where the address information is not available.
                                    // 4 Requires match of Street Address or a exact match (Zip Code and Street Address). All other transactions voided; including those where the address information is not available.
                                    // 5 Requires exact match of Zip Code and Street Address. All other transactions voided; including those where the address information is not available.
                                    // 6 Requires exact match of Zip Code and Street Address, but will allows cards where the address information is not available.
$bibEC_ccp->set_extra($extra); //I need to pass an array

if(!$bibEC_ccp->process()){
   
print_r($bibEC_ccp->get_error());
} else {
   
//save the order!!!!
    //printing the authorization code
   
echo $bibEC_ccp->get_authorization();
    echo
'HERE I HAVE TO SAVE THE CART, SEND EMAILS AROUND, DELETE CREDIT CARD INFO';
}
//if I want, I can print what I retrieve from the gateway

print_r($bibEC_ccp->get_answer());

print_r($bibEC_ccp->get_log());

//if I have a file with the LOG I can retrieve all the log with this :
print_r($bibEC_ccp->get_log_all());
?>