Interchange Protx Direct payment system interface
- Provided by: interchange (Version: 5.7.7-2)
- Report a bug
Net::SSLeay
or LWP::UserAgent and Crypt::SSLeay
wget - a recent version built with SSL and supporting the 'connect' timeout function.
1. Call this module in interchange.cfg with:
Require module Vend::Payment::Protx2
2. Add into products/variable.txt (tab separated):
MV_PAYMENT_MODE protx
3. Add a new route into catalog.cfg (options for the last entry in parentheses):
Route protx id YourProtxID
Route protx host ukvps.protx.com (ukvpstest.protx.com)
Route protx currency GBP (USD, EUR, others, defaults to GBP)
Route protx txtype PAYMENT (AUTHENTICATE, DEFERRED)
Route protx available yes (no, empty)
Route protx logzero yes (no, empty)
Route protx double_pay yes (no, empty)
Route protx logdir "path/to/log/dir"
Route protx protxlog yes (no, empty)
Route protx applyavscv2 '0': if enabled then check, and if rules apply use.
'1': force checks even if not enabled; if rules apply use.
'2': force NO checks even if enabled on account.
'3': force checks even if not enabled; do NOT apply rules.
Route protx giftaidpayment 0 (1 to donate tax to Gift Aid)
or put these vars into products/variable.txt instead:
MV_PAYMENT_ID YourProtxID Payment
MV_PAYMENT_MODE protx Payment
MV_PAYMENT_HOST ukvps.protx.com Payment
MV_PAYMENT_CURRENCY GBP Payment
and the rest as above.
4. Create a new locale setting for en_UK as noted in "item currency" below, and copy the public space interchange/en_US/ directory to a new interchange/en_UK/ one. Ensure that any other locales you might use have a correctly named directory as well. Ensure that this locale is found in your version of locale.txt (and set up UK as opposed to US language strings to taste).
5. Create entry boxes on your checkout page for: 'mv_credit_card_issue_number', 'mv_credit_card_start_month', 'mv_credit_card_start_year', 'mv_credit_card_type', and optionally 'mv_credit_card_cvv2'.
The Vend::Payment::Protx module implements the Protx() routine for use with Interchange. It is not compatible on a call level with the other Interchange payment modules - Protx does things rather differently. We need to save four of the returned codes for re-use when doing a RELEASE, REPEAT, or REFUND.
To enable this module, place this directive in "interchange.cfg":
Require module Vend::Payment::Protx2
This must be in interchange.cfg or a file included from it.
Make sure CreditCardAuto is off (default in Interchange demos).
Note that the Protx 'Direct' system is the only one which leaves the customer on your own site and takes payment in real time. Their other systems, eg Terminal or Server, do not require this module.
Note also that Maestro cards can only be taken by the 3DSecure version of this module, not by this version, as Mastercard have decreed that Maestro cards will no longer be accepted without 3DSecure.
While PREAUTH is still in this module, it is scheduled to be dropped on the 1st August 2007 or shortly thereafter, and is only here as a backup during the changeover to AUTHENTICATE.
The module uses several of the standard settings from the Interchange payment routes. Any such setting, as a general rule, is obtained first from the tag/call options on a page, then from an Interchange order Route named for the mode in catalog.cfg, then a default global payment variable in products/variable.txt, and finally in some cases a default will be hard-coded into the module.
Variable MV_PAYMENT_MODE protx
or in variable.txt:
MV_PAYMENT_MODE protx (tab separated)
if you want this to cooperate with other payment systems, eg PaypalExpress or GoogleCheckout, then see the documentation that comes with that system - it should be fully explained there (essentially, you don't run the charge route from profiles.order but from log_transaction).
in variable.txt:
MV_PAYMENT_ID YourProtxID Payment
or in catalog.cfg either of:
Route protx id YourProtxID
Variable MV_PAYMENT_ID YourProtxID
The transaction type is taken firstly from a dynamic variable in the page, meant primarily for use with the 'virtual payment terminal', viz: 'transtype' in a select box though this could usefully be taken from a possible entry in the products database if you have different products to be sold on different terms; then falling back to a 'Route txtype AUTHENTICATE' entry in catalog.cfg; then falling back to a global variable in variable.txt, eg 'MV_PAYMENT_TXTYPE AUTHENTICATE Payment'; and finally defaulting to 'PAYMENT' hard-coded into the module. This variable is returned to the module and logged using the value returned from Protx, rather than a value from the page which possibly may not exist.
$Session->{payment_result}{TxType} will be NULL,
$Session->{payment_result}{StatusDetail} will be: 'UNKNOWN status - check with Protx before dispatching goods'
and you should include these into the report emailed to you.
You may display a select box on the checkout page like so:
<select name="mv_credit_card_type">
[loop
option=mv_credit_card_type
acclist=1
list=|
VISA=Visa,
MC=MasterCard,
SOLO=Solo,
DELTA=Delta,
AMEX=Amex,
UKE=Electron,
JCB=JCB,
DINERS=Diners
|
]
<option value="[loop-code]">[loop-param label]</option>
[/loop]
</select>
code en_UK en_EUR en_US
iso_currency_code GBP EUR USD
It then falls back to a 'Route protx currency EUR' type entry in catalog.cfg; then falls back to a global variable (eg MV_PAYMENT_CURRENCY EUR Payment); and finally defaults to GBP hard-coded into the module. This variable is returned to the module and logged using the value returned from Protx, rather than a value from the page which possibly may not exist.
CVV2: <input type=text name=mv_credit_card_cvv2 value='' size=6>
but note that under PCI rules you must not log this value anywhere.
Card issue number: <input type=text name=mv_credit_card_issue_number value='' size=6>
<select name="mv_credit_card_start_year">
[loop option=start_date_year lr=1 list=`
my $year = $Tag->time( '', { format => '%Y' }, '%Y' );
my $out = '';
for ($year - 7 .. $year) {
/\d\d(\d\d)/;
$last_two = $1;
$out .= "$last_two\t$_\n";
}
return $out;
`]
<option value="[loop-code]">[loop-pos 1]</option>
[/loop]
</select>
Route protx logdir "path/to/log/dir"
It must be relative to the catalog root directory if you have NoAbsolute set for this catalog in interchange.cfg.
If logdir is not set, it defaults to the system /tmp.
A somewhat dangerous option allows the payment page to specify the logdir in a form variable, like this:
<input type="hidden" name="logdir" value='your_choice_here'>
This allows an individual user to have his own logs in a shared hosting environment. However, it also allows a creative end-user to create arbitrary empty files or update timestamps of existing files.
Because of the potential for abuse, this option is not allowed unless you set a special route variable indicating you want it:
Route protx logdir_from_user_allowed 1
0 = If AVS/CV2 enabled then check them. If rules apply, use rules. (default)
1 = Force AVS/CV2 checks even if not enabled for the account. If rules apply, use rules.
2 = Force NO AVS/CV2 checks even if enabled on account.
3 = Force AVS/CV2 checks even if not enabled for the account but DON'T apply any rules.
You may pass this value from the page as 'applyavscv2' to override the payment route setting.
CustomerName: optional, may be different to the cardholder name
ContactFax: optional
GiftAidPayment: set to -
0 = This transaction is not a Gift Aid charitable donation(default)
1 = This payment is a Gift Aid charitable donation and the customer has
AGREED to donate the tax.
You may pass this value from the page as 'giftaidpayment'
ClientIPAddress: will show in Protx reports, and they will attempt to Geo-locate the IP.
Variable<tab>MV_CREDIT_CARD_INFO_TEMPLATE Card type: {MV_CREDIT_CARD_TYPE}; Card no: {MV_CREDIT_CARD_NUMBER}; Expiry: {MV_CREDIT_CARD_EXP_MONTH}/{MV_CREDIT_CARD_EXP_YEAR}; Issue no: {MV_CREDIT_CARD_ISSUE_NUMBER}; StartDate: {MV_CREDIT_CARD_START_MONTH}/{MV_CREDIT_CARD_START_YEAR}
An AUTHENTICATE will validate the card and store the card details on Protx's system for up to 90 days. Against this you may AUTHORISE for any amount up to 115% of the original value.
A DEFERRED will place a shadow ('block') on the funds for seven days (or so, depending on the acquiring bank). Against a DEFERRED you may do a RELEASE to settle the transaction.
A PAYMENT will take the funds immediately. Against a PAYMENT, you may do a REFUND or REPEAT.
A RELEASE is performed to settle a DEFERRED. Payment of the originally specified amount is guaranteed if the RELEASE is performed within the seven days for which the card-holder's funds are 'blocked'.
A REFUND may be performed against a PAYMENT, RELEASE, AUTHORISE or REPEAT. It may be for a partial amount or the entire amount, and may be repeated with several partial REFUNDs so long as the total does not exceed the original amount.
A DIRECTREFUND sends funds from your registered bank account to the nominated credit card. This does not need to refer to any previous transaction codes, and is useful if you need to make a refund but the customer's card has changed or the original purchase was not made by card.
This has now been split out from this module, and may be found as the rather pretentiously named Payment Terminal Interchange Plug-in Module (PTIPM), also on http://kiwi.zolotek.net. The PTIPM does refunds and repeats, directrefunds, and converts offline transactions to online ones. Being a plugin to the Interchange Admin Panel it integrates these operations into your database.
Only the test card numbers given below will be successfully authorised (all other card numbers will be declined).
VISA 4929 0000 0000 6
MASTERCARD 5404 0000 0000 0001
DELTA 4462000000000003
SOLO 6334900000000005 issue 1
DOMESTIC MAESTRO 5641 8200 0000 0005 issue 01 (should be rejected now)
AMEX 3742 0000 0000 004
ELECTRON 4917 3000 0000 0008
JCB 3569 9900 0000 0009
DINERS 3600 0000 0000 08
You'll also need to supply the following values for CV2, Billing Address Numbers and Billing Post Code Numbers. These are the only values which will return as Matched on the test server. Any other values will return a Not Matched on the test server.
CV2 123
Billing Address Numbers 88
Billing Post Code Numbers 412
If nothing works:
Require module Vend::Payment::Protx2
perl -MNet::SSLeay -e 'print "It works\n"'
or
perl -MLWP::UserAgent -MCrypt::SSLeay -e 'print "It works\n"'
If either one prints "It works." and returns to the prompt you should be OK (presuming they are in working order otherwise).
<pre>
[calcn]
my $string = $Tag->uneval( { ref => $Session->{payment_result} });
$string =~ s/{/{\n/;
$string =~ s/,/,\n/g;
return $string;
[/calcn]
</pre>
That should show what happened.
If you get the same error message within the Virtual Terminal, then you haven't set the order route as noted above.
http://kiwi.zolotek.net is the home page with the latest version. Also to be found on Kevin Walsh's excellent Interchange site, http://interchange.rtfm.info.
Lyn St George <info@zolotek.net>, based on original code by Mike Heins <mike@perusion.com> and others.
Hillary Corney (designersilversmiths.co.uk), Jamie Neil (versado.net), Andy Mayer (andymayer.net) for testing and suggestions.
GPLv2