PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Adam Globus-Hoenich  >  Payflow Pro Frontend  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Payflow Pro Frontend
Credit card payments w/o Payflow Pro extension!
Author: By
Last change:
Date: 10 years ago
Size: 1,106 bytes
 

Contents

Class file image Download
<?php

require("pfpro.class.inc");

$p = new PFPro("/home/phenaproxima/payflow/bin", "phena", "pRoXiMa", "verisign", "phena");

//Collect customer info
$addr = $_POST['address'];
$zip = $_POST['zipcode'];
$p->setCustomerInfo($addr, $zip);

$cc = $_POST['creditcard'];
$exp = $_POST['month'] . $_POST['year'];
$cvv = $_POST['cvv2'];
$price = $_POST['price'];
$p->setPaymentInfo($cc, $exp, $cvv, $price);

if(
$p->process() == false)
    die(
"<b>Error:</b>" . $p->geLastMessage());
else
{
    if(
isInternational())
       
$p->setSecurity("none", "none");
    else
       
$p->setSecurity("medium", "medium");

    if(
$p->fraudCheck() == false)
    {
       
//AVS and/or CVV checks failed
       
if($p->void() == false)
            die(
"<b>Error voiding transaction</b>: " . $p->getLastMessage());
        else
            die(
"<b>Declined:</b> AVS or CVV check failed");
    }
    else
    {
        echo
"<b>Transaction Approved, now refunding you because we sell useless junk</b><br />";
        if(
$p->credit() == false)
            die(
"<b>refund failed<b>: " . $p->getLastMessage());
        else
            die(
"Refunded. Spend your money elsewhere...");
    }
}

?>