PAYPROC.PHP3 PayLib Integration Module for Phorm The purpose of this module is to allow integration with the PayLib functions, which provide a uniform interface to the various payment processors such as ECHO, Authorize.Net and Verisign. INSTALLATION To install this module, place the file payproc.php3 in your plugins directory and add the following line to the registry file registry.php3: < valid payproc.php3 USE When installed, the PayProc plugin creates four new $PHORM_ variables and a new validation criterion. The validation criterion is PPROC. The variables are $PHORM_PLBTRAN, $PHORM_PLBCTRL, $PHORM_PLBRESP and $PHORM_PLBPROC. The PPROC criterion requires one argument, to specify which payment processor to use. There are currently four options: AUT - Authorize.Net ECH - ECHO PFL - VeriSign PayflowLink PFP - VeriSign PayflowPro EFT - EFTSecure The field that you specify in the validation rule with the PPROC criterion does not matter. The PayProc module ignores it. There are simply too many different data fields which need to be passed to PayLib, to try to fit them into the actual rule definition. To use the PPROC criterion, you must define the transaction and control fields. The variables $PHORM_PLBTRAN and $PHORM_PBLCTRL correspond to the $Transaction and $Control arrays in the PayLib documentation. See the PayLib documentation for descriptions of these arrays. In your rules file, create a rule with the PPROC criterion. Since the Phorm processor requires a field in the rule definition, you must include one, but PayProc ignores it, so it makes no difference what it is. The only use for it would be in message indicators in the error template. Here's an example: PPROC·PFL»SomeField»1 PayLib returns two arrays, one containing the response fields directly from the processor, and one containing the response fields translated into PayLib response fields. These will be contained in $PHORM_PLBPROC and $PHORM_PLBRESP, respectively. You can use either one for purposes of variable substitution and/or logging. See the PayLib documentation for descriptions of these arrays. While PayProc returns both arrays, it acts solely on $PHORM_PLBRESP. If $PHORM_PLBRESP['Result'] is not equal to "APP" (approved), the rule fails. If the failure was caused by a PayLib error, $PHORM_PLBRESP['Result'] and $PHORM_PLBRESP['Message'] are changed to indicate a general system error, and the actual PayLib error is converted into a Phorm Alert, to be emailed if $PHORM_ALERTTO is set. The reason for this is that PayLib errors deal with configuration or system errors, which the visitor cannot do anything about. PayProc will not submit the transaction to the payment processor if any of the rules before it have failed. This is to avoid committing a transaction before all the data is ready. For this reason, it recommended that the PPROC rule go at the end of your rules file. That's all there is to it! =========================== Copyright (c) 2002 Holotech Enterprises (phorm@holotech.net) You may freely distribute this program as-is, without modifications, as part of a valid Phorm distribution. If you are not sure whether you have a valid distribution, you can obtain one from http://www.phorm.com/. You may use this program freely, and modify it for your own purposes.