NYCPHP Meetup

NYPHP.org

[nycphp-talk] PayFlow Pro Extension

Rolan Yang rolan at omnistep.com
Sun Dec 19 00:48:05 EST 2004


Here is an example function that will charge the card and return the 
response code.
Replace the USER,PWD,VENDOR parameters with the info Verisign provides 
to you.
The Payflow manual describes the different response codes in detail, but 
really most of the time all you need to know is wether the charge was 
accepted or rejected.

~Rolan

<?
/* EXAMPLE:
$response=chargecard(1.5,'4111111111111111','0904','Rolan Yang','123 
Westgate Dr','08820');
print "Result: ".$response[RESULT]." PNREF:".$response[PNREF]." 
AUTHCODE:".$response[AUTHCODE]."\n"; */

function chargecard($amt,$acct,$exp,$name,$street,$zip) {
if (strlen($acct)>19) {$acct=substr($acct,0,19);}
if (strlen($name)>30) {$name=substr($name,0,30);}
if (strlen($street)>30) {$street=substr($street,0,30);}
pfpro_init();
$transaction = array(USER=> 'VerisignUserNameGoesHere',
     PWD=> 'SecretPasswordGoesHere',
     TRXTYPE=> 'S',
     TENDER=> 'C',
     AMT=> $amt,
     ACCT=> $acct,
     EXPDATE=> $exp,
     PARTNER=> 'VeriSign',
     VENDOR=> 'VendorNameGoesHere',
     STREET=> $street,
     ZIP=> $zip,
     NAME=> $name
);
putenv("PFPRO_CERT_PATH=/etc/verisign/certs/");
$response = pfpro_process($transaction,'payflow.verisign.com','443');
if (!$response) { print "BLAH!\n"; die("Couldn't establish link to 
Verisign.\n"); }
pfpro_cleanup();
return ($response);
}
?>

Jose Villegas wrote:

> Hey Rolan,
>
> I'm about to set up a site with PayFlow as well. I'd love to see your 
> examples too, if it's not too much trouble.
>
> -jose
> www.josevillegasdesign.com
>
> On Dec 18, 2004, at 11:00 PM, Rolan Yang wrote:
>
>> I used the php functions without any problems. It's pretty easy.
>> Msg me offline if you want to see some examples.
>>
>> ~Rolan
>>
>> Randal Rust wrote:
>>
>>> Is this my only option for processing transactions via Verisign's 
>>> PayFlow Pro?
>>>
>>> http://us2.php.net/pfpro
>>>
>> _______________________________________________
>> New York PHP Talk
>> Supporting AMP Technology (Apache/MySQL/PHP)
>> http://lists.nyphp.org/mailman/listinfo/talk
>> http://www.newyorkphp.org
>>
>>
>
>



More information about the talk mailing list