PHP: Verisign Payflow Pro 関数 - Manual
PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<PDOStatement::rowCountpfpro_cleanup>
view the version of this page
Last updated: Tue, 21 Dec 2004

XC. Verisign Payflow Pro 関数

導入

この拡張モジュールにより、以前はSignio()として知られていたVerisign Payment Servicesを使用してクレジットカードおよび他の金融トランザク ションを処理することが可能になります。

これらの関数を使用する場合、pfpro_init()および pfpro_cleanup()のコールを省略することが可能です。 これは、この拡張モジュールが必要に応じて時動的にこれらをコールする ためです。しかし、複数のトランザクションを処理し、ライブラリ全体を 意のままに制御したい場合には、これらの関数を利用することが可能です。 これら二つの関数コールの間に、pfpro_process()を 使用してトランザクションを何回でも行うことが可能です。

これらの関数は、PHP 4.0.2で追加されました。

注意: これらの関数は、Verisign Payment Servicesへのリンクのみ提供します。 必要なパラメータの詳細については、Payflow Pro Developers Guideを 参照下さい。

注意: この拡張モジュールはWindows環境 では利用できません。

要件

使用するプラットフォーム用の適当なSDKが必要です。これは、登録後に からダ ウンロードすることが可能です。この拡張モジュールをSSL対応のWebサー バまたは(CURL+SSL拡張のような)他のSSLコンポーネントで使用する際に は、ベータ版のSDKが必要です。

SDKをダウンロードした後、配布ファイルのディレクトリlibからファイルをコピーする必要があり ます。ヘッダファイルpfpro.h/usr/local/includeに、 ライブラリファイルlibpfpro.so/usr/local/libにコピーして 下さい。

インストール手順

以下の関数は、PHPがオプション--with-pfpro[=DIR]を付けてコンパイルされ ている場合にのみ利用可能です。

実行用の設定

これらの関数の動作は、php.iniの設定により変化します。

表 1. Verisign Payflow Pro 設定オプション

名前デフォルト変更の可否
pfpro.defaulthost/PFPRO_VERSION < 3 "test.signio.com"PHP_INI_ALL
pfpro.defaulthost"test-payflow.verisign.com"PHP_INI_ALL
pfpro.defaultport"443"PHP_INI_ALL
pfpro.defaulttimeout"30"PHP_INI_ALL
pfpro.proxyaddress""PHP_INI_ALL
pfpro.proxyport""PHP_INI_ALL
pfpro.proxylogon""PHP_INI_ALL
pfpro.proxypassword""PHP_INI_ALL
PHP_INI_* 定数の詳細と定義については、 ini_set()を参照して下さい。

リソース型

この拡張モジュールはリソース型を全く定義しません。

定義済みの定数

この拡張モジュールは定数を全く定義しません。

目次
pfpro_cleanup -- Payflow Proライブラリをシャットダウンする
pfpro_init -- Payflow Proライブラリを初期化する
pfpro_process_raw -- Payflow Proにより素のトランザクションを処理する
pfpro_process -- Payflow Proでトランザクションを処理する
pfpro_version -- Payflow Pro ソフトウエアのバージョンを返す


add a note add a note User Contributed Notes
Verisign Payflow Pro 関数
mark at tuscaloosadesigncompany dot com
25-Sep-2004 11:02
After upgrading my slackware system's glibc to 2.3.3 (which is the first version of glibc on slackware that does not include a __ctype compatibility patch) and spending far too much time trying to figure out why the configure script could not figure out I had version 3 of the payflow pro library, the simple solution was to download the "Linux (Redhat 9.x)" version of the payflow SDK because Verisign has linked this version of the library to the glibc 2.3.x version of the __ctype functions (which are of the form __ctype_xxx_loc instead of __ctype_xxx). 

You should avoid the "Linux - (libc6 / glibc2 / ELF kernels 2.0.36 and above)" version of the SDK unless you have a glibc version < 2.3.x. 

If you're having this problem, check your config.log for the following lines:
/usr/local/lib/libpfpro.so: undefined reference to `__ctype_b'
/usr/local/lib/libpfpro.so: undefined reference to `__ctype_tolower'

You can also run the following command to find out which version of the __ctype functions the library was linked to:
readelf -s /usr/local/lib/libpfpro.so | grep ctype
sean at trunkmonkey dot com
17-Aug-2004 03:09
To expand on Michael's instructions on getting Payflow Pro working as a loadable module under FreeBSD, you can do the same thing under RedHat Enterprise and Fedora:

1) Drop pfpro.h and libpfpro.so into their respective directories per Requirements above.
2) Install the RedHat Enterprise or Fedora PHP SRPM.
3) Add "--with-pfpro=shared,/usr/local \" to the "%configure \" line in php.spec.
4) Run rpmbuild -bc php.spec
5) Copy /usr/src/redhat/BUILD/php-X.X.X/build-apache/modules/pfpro.so to /usr/lib/php4.
6) Add "extension=pfpro.so" to /etc/php.d/pfpro.ini using the other .ini files as templates.

/Sean/
richard at richowe dot com
03-Jul-2004 03:07
Here's a more complete example using COM

<?php

 $objCOM
= new COM("PFProCOMControl.PFProCOMControl.1");

 
$parmList = "TRXTYPE=S&TENDER=C&ZIP=12345&COMMENT2=PHP/COM Test Transaction";
 
$parmList .= "&ACCT=" . $cardNum;
 
$parmList .= "&PWD=" . $userPW;
 
$parmList .= "&USER=" . $userId;
 
$parmList .= "&VENDOR=" . $vendorId;
 
$parmList .= "&PARTNER=" . $partnerId;
 
$parmList .= "&EXPDATE=" . $cardExp;
 
$parmList .= "&AMT=" . $amount;

 
$ctx1 = $objCOM->CreateContext("test-payflow.verisign.com", 443, 30, "", 0, "", "");
 
$result = $objCOM->SubmitTransaction($ctx1, $parmList, strlen($parmList));

 
$objCOM->DestroyContext($ctx1);

 
$valArray = explode('&', $result);
 foreach(
$valArray as $val)
 {
  
$valArray2 = explode('=', $val);
  
$response[$valArray2[0]] = $valArray2[1];
 }

 if (
$response['RESULT'] == 0)
 {
   echo
"<b>Success!</b><br><br>";
 }
 else
 {
   echo
"<b>Failure!</b><br><br>";
 }

 foreach(
$response as $name => $value)
 {
   echo
"<b>$name</b> = $value<br>"
  
}
?>
zhengyi13 at yahoo dot com
07-Jun-2004 07:44
jho8344, two things:

1) No such dll exists, nor to my knowledge ever has, because
2) PHP has built-in support for COM, thus you don't need it.

If you're using PHP on Windows, install VeriSign's Payflow Pro COM object per their normal directions, and then use that COM object directly via PHP. You can do so (roughly) like this:

<?php
/* Create pfCOM Object */
$pfpro_client = new COM('PFProCOMControl.PFProCOMControl.1');
      
/* Process Transaction */
$pfpro_context = $pfpro_client->CreateContext($url, $port, $timeout, $proxy_url, $proxy_port, $proxy_logon, $proxy_password);
@
$result = $pfpro_client->SubmitTransaction($pfpro_context, $parmsString, strlen($parmsString));

/* Destroy Context */
$pfpro_client->DestroyContext($pfpro_context);
?>

Note that's strictly off the top of my head; not actually guaranteed to work out of the box. I don't run PHP on Windows, so I can't really test it for you. But give it a go, and report back here if it works for you.
cfischer17 at acm dot org
15-Apr-2004 05:36
I've just spent a morning looking for the beta SDK (as per the
above requirements) to no avail.  Then I found the following
on Verisign's website --

Q:  Where can I find the Beta for apache/mod_ssl/ php beta
download for Payflow Pro?

A:  Our current UNIX - SDKs have this functionality built-in.



In any case, there _is_ a known "incompatibility between the
SSL toolkit used for mod_ssl and that used by Payflow Pro."
Here's a link to the resolution from the Verisign
knowledgebase --
ng4rrjanbiah at rediffmail dot com
16-Dec-2003 09:49
Zend has a nice tutorial titled "Accepting payments using Verisign's Payflow Pro" at

HTH,
R. Rajesh Jeba Anbiah
maw at synesis dot net
21-Nov-2003 11:24
I can confirm that the undefined references (__ctype_b) bug referred to in the previous note is indeed fixed by using the Versign SDK for Redhat 9.

It all works fine on Redhat 9 + glibc 2.3.2 + Apache 2.0.48 + PHP 4.3.4.

Just FYI, this is all because __ctype_b has been replaced by __ctype_b_loc in glibc 2.3. Here's the quote from Bug #91290 on bugzilla.redhat.com: "For __ctype_b*, the decision to replace it by __ctype_b_loc etc. and disallow any new links against the old type were made because __ctype_b* does not work together with uselocale(3).These days, uselocale(3) is used quite often e.g. in libstdc++, so it is very bad idea to keep using __ctype_b etc." In a nutshell this means that old libraries linked against glibc < 2.3 should be rebuilt with glibc >= 2.3 if they use any of these symbols. This Verisign has done with the RH9 version of the SDK.
20-Nov-2003 01:00
Redhat 9 compile problems.
Redhat 9's version of glibc will cause compile to fail. It seems that for localization reasons RH started using __ctype_b_loc instead of __ctype_b, which is what payflow is expecting. Not that I know what this means, but it's attested to at if you search for "redhat 9", and there is a bug at about it. Redhat is not going to fix it, so you have to get the beta sdk from verisign. Or use something besides Redhat 9.
freebsd at argentproductions dot com
04-Nov-2003 07:02
A comment on the below notes regarding compilation on FreeBSD... to bring this up-to-date:

It seems Verisign is up to version 3.06 as of 3 Nov 2003, and at least on FreeBSD 5.1-RELEASE no special actions are necessary to get these functions to compile properly on PHP 4.3.3 or later (also tried on 4.3.4).  I used the listed notes above (download and copy the two files in place, add --with-pfpro=/usr/local to the ./configure options, and off you go) and the module compiled, installed, and ran just fine on a standard port-built apache server.  So if you are running FreeBSD 5.1 or later and have the updated Verisign and PHP code, you should have no problems.
rrolfe at genpac dot com
06-Sep-2003 08:17
For everyone who needs this to work on FreeBSD 4.8 with php 4.3.3 (and for me next time i have to do it), please perform the following:

unpack the tar.gz file for php.
cd php-4.3.3/

and run the following  (as mentioned below):
perl -pi.bak -e  \
's/LIBS="-lpfpro/LIBS="-pthread -lpfpro/g' \
configure

Then run your configure script to include --with-pfpro.
Edit your Makefile and find the "COMMON_FLAGS" line and add -pthread to the end of it.

then run make and make install.

Also be sure to recompile your apache to include -pthread:
unpack apache
run your configure script
edit the src/Makefile and find the "LIBS1" line and add -pthread to the end of it.
then run make and make install.

for php to load on freebsd 4.8 as an apache module with pfpro, you *MUST* compile apache with -pthread.
bohemianadventurer at yahoo dot com
07-Jul-2003 04:45
I have been trying to compile PHP with PayFlow Pro support on FreeBSD 4.8-STABLE and I kept receiving this error:

The pfpro extension requires version 2 or 3 of the SDK

Looking at the config.log I found that the config test code was failing to compile with these errors:

/usr/local/lib/libpfpro.so: undefined reference to `pthread_mutex_unlock'
/usr/local/lib/libpfpro.so: undefined reference to `pthread_self'
/usr/local/lib/libpfpro.so: undefined reference to `pthread_mutex_destroy'
/usr/local/lib/libpfpro.so: undefined reference to `pthread_mutex_lock'
/usr/local/lib/libpfpro.so: undefined reference to `pthread_mutex_init'

With a little further digging, I determined the problem to be with the configure script.  The configure script is smart enough to test for POSIX threads, and to add the appropriate compile flag when building the PHP distribution, but it isn't smart enough to use that flag when compiling the config test code.  The pfp library requires the threads flag to be set.

This will kludge your configure script into working, so that you can get past the bogus error encountered by the pre-compile tests:

perl -pi.bak -e  \
's/LIBS="-lpfpro/LIBS="-pthread -lpfpro/g' \
configure

I broke it into three lines so that it doesn't wrap unhappily in this form.

NOTE:  This is the appropriate flag for FreeBSD 4.8.  Your system may require a different flag.

It is a kludge fix, and I'm not proud of it, but I have to have this damn thing working by morning.  :)

-Chris Knight
gbaratto at superb dot net
19-Jun-2003 08:21
if you are having problems compiling pfpro in freebsd 4.X, it is probably because of its braindead thread library.
Just install linuxthreads from the ports, set  LDFLAGS="-I/usr/local/include/pthread/linuxthreads -L/usr/local/lib -llthread -llgcc_r"
and then do as instructed in the other posts here.
mitka at actdev dot com
23-Feb-2003 06:45
You might want to check the CC number for LUHN checksum before submitting the actual transaction.

function luhncheck($number) {
   $l = strlen($number);
   for ($i=0; $i<$l; $i++) {
       $q = substr($number,$l-$i-1,1)*($i%2+1);
       $r += ($q%10)+(int)($q/10);
   }
   return !($r%10);
}

returns true if card number is valid, $number is a string with digits only (no dashes or spaces).

Before LUHN check, you can verify the card no. prefix and the number length, here's what they should be:

Visa: 4..., 16 digits
MC: 51-55..., 16 digits
Amex: 34... or 37..., 15 digits
Discover: 6011..., 16 digits.
Diners/CBlanche: 300-305..., 36..., 38..., 14 digits
JCB: 3..., 16 digits
JCB: 2131 or 1800, 15 digits
enRoute does not do LUHN verification.

See details at

Dimitri Tarassenko
mike at 3mediaweb dot com
01-Dec-2002 07:59
After searching high and low for a way to get payflow pro to work with my existing servers (other than calling the pfpro binary), I found there was a way I could get it installed on my freebsd apache-mod_ssl servers. I did it via cgi version of php.
1. put freebsd version of libpfpro.so, and pfpro.h in one place.
   I chose /usr/local/lib/.
2. download the last version of php.

3.
./configure                              \
--prefix=/usr/local/php                  \
--with-config-file-path=/usr/local/php  \
--with-pfpro=shared,/usr/local/lib/      \
--enable-discard-path                    \
--with-mcrypt=/usr/local                \
--with-mhash=/usr/local                  \
--with-mysql=/usr/local                  \
--with-expat-dir=/usr/local              \
--enable-wddx                            \
4.
make && make install ..
5.
copy php.ini-dist to your prefix'd location.
edit the safe modes and base directories and any other
security precautions you need.
I also put a link in /usr/bin/ to php so the paths would work.

6.
In your php file you will have to edit the loadable modules directory.
mine ended up being :
/path/lib/php/extensions/no-debug-non-zts-20020429/
browse down to the loadable extentions and add:
extension=pfpro.so
7.
Open up your httpd.conf add:
AddHandler cgi-script xphp
to a virtual host Directory or your cgi-bin:
I used xphp but you can use what you like for a file extention.

You can create a directory like /auth/ but then you will have to put a Options ExecCGI on that folder in order to execute the script.
8.
create a test.xphp file and put a #!/pathto/php before the <?
phpinfo
(); ?>
9. Restart apache to load the Directory directives, and open a browser and browse to the file.  If you see any headers on the top of the page, check your error log. if all goes smoothly you should'nt see any errors in the httpd-error_log. I like to tail -f http-error_log in one console and browse it in real time.

10. create a payflowpro.php in the same manner.
make sure you put a: putenv("PFPRO_CERT_PATH=/pathto/certs"); 
and try the pfpro_init(); function. if the function does'nt exist it will fail, which means you have to go back and check stuff for errors.
..
Warning: This is the way I found to get the job integrated. It may or may not work on all freebsd systems. Also keep in mind that the cgi version of the php scripts need to be chmod'd to the right permissions, safe_mode and disable functions that are not being used. 
It may not be the best way, but at least you still have access to the tools that php has build in.

..

If I missed something big here let me know.
dcp at hps dot com
24-Sep-2002 11:11
I finally got pfpro to work as an apache module. After following the advice above it still did not work. (Apache would not start with both the libssl and libphp4 added).
The solution is in the order in which apache web server loads modules. Review your httpd.conf file  typically located in /etc/httpd/conf. The loading of libssl.so and libphp4.so is important. The libssl.so must be loaded before libphp4.
gerry at ihigh dot com
27-Jun-2002 07:53
From Verisign's VPS support:

The Payflow Pro support in PHP must be configured/compiled as a shared object. In order to enable Payflow Pro support in PHP as a shared object, pass the following switch to the PHP ./configure script:

[root@localhost] # ./configure --with-pfpro=shared,/path/to/pfpro

The directory specified by /path/to/pfpro must contain *both* the libpfpro.so and pfpro.h files included in the Payflow Pro SDK (usually in the lib/ and/or bin/ subdirectories of the SDK), or the ./configure step will fail.
 
 
  Versions of PHP prior to 4.0.2 did not contain the pfpro support functions. See for the latest stable version of PHP.

It appears to be impossible to use older versions of Apache in this sort of setup. Version 1.3.12 or greater are known to work, 1.3.9 may work, older versions reportedly do not work. See for the latest stable version of Apache.

The version of mod_ssl is closely tied to the version of Apache being used; there are sometimes multiple versions of mod_ssl available for a single version of Apache. See for the latest version of mod_ssl.
jason at thinkingman dot org
02-Dec-2001 11:01
[Editors Note:
This is a workaround for Windows users ]

You can download the complete php_pfpro.inc and php_pfpro_com.inc files from my FTP site.  They are WinZip'd.

ntemple at commercestore dot com
29-Aug-2001 03:28
Please also be aware that forking will allow any person with the access to the ps command to potentially see ALL account information: user, password, partner, credit card number, etc.

The preferred way to use the module is through the now-fixed extension.
bswenson at ku dot edu
27-Jun-2001 04:57
If you decide not to use the pfpro functions for any one of several reasons and instead call the pfpro binary with the exec command please note that you must use the putenv function to set the environment variable PFPRO_CERT_PATH that is referred to in the PayFlowPro Developers Guide (see page 12).  Otherwise verisign with always return a -31 error - certificate not found.

<PDOStatement::rowCountpfpro_cleanup>
 Last updated: Tue, 21 Dec 2004
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: /
Last updated: Mon Mar 14 08:13:06 2005 Local time zone must be set--see zic manual page