DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Cardia ePayment

Created:2005-07-29T11:26:40
Changed:2008-03-10T11:43:08
Author:Rainer Kuhn
Email:kuhn@punkt.de
Info 3:punkt.de GmbH
Info 4:

EXT: Cardia ePayment

Extension Key: pt_payment

Copyright 2004-2008, Rainer Kuhn, <kuhn@punkt.de>

revised for version 1.1.3 (using Cardia Shop v2.2), 2008-03-10

THIS EXTENSION IS OBSOLTE SINCE 03/2008:

Cardia has been taken over by DIBS, pt_payment is discontinued now!

Extension development sponsored by punkt.de GmbH ( `http://punkt.de/ <http://punkt.de/>`_ )

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: Cardia ePayment 1

Introduction 1

What does it do? 1

URL Reference 3

Screenshots 3

Administration 5

Integration into your shop system 5

Test transactions 6

Running live transactions 6

Debugging 6

Configuration 6

Required adaptation of your shop system 6

Extension configuration via TypoScript/ Constant Editor 7

Changing the extensions' CSS styles 7

Reference 8

Known problems 10

To-Do list 10

Changelog 10

Introduction

THIS EXTENSION IS OBSOLTE SINCE 03/2008:Cardia has been taken over by DIBS, pt_payment is discontinued now!

What does it do?

The Cardia ePayment Extension is an eCommerce payment solution that enables a web shop to receive payments through credit card (Visa, Eurocard, Mastercard), Contopronto/LUUP SMS-payment and Telenor MobilHandel (Norway). It implements the Cardia payment solution “Cardia Shop v2.2” (see URL reference [1]), adapted referring to Cardia's current implementation guide (see URL reference [2]). Cardia Shop does not supply an e-commerce/shop application (i.e. the logic enabling the customer to order goods or services and put them into a shopping basket), but the gateway enabling merchants to receive payments.

The extension has been used in production environment for many conferences so far.

NOTE: This is not a "ready-to-use" extension! Before usage, your shop system has to be slightly adapted to co-operate with the Cardia ePayment extension - this requires some PHP/TYPO3 scripting knowledge (see chapter “Configuration”)! After this adaptation the extension has to be configured at TYPO3's Constant Editor, including the interfaces to your shop system. The Cardia ePayment extension has not been written as a dedicated add-on for the TYPO3 shop extension “tt_products”. It may also work with tt_products (after adapting it to the required needs), but I have not tested this yet .

Here's a short description of how the extension works: The extension issues a unique order identifier (hereby called the merchant reference) for each payment request. This is due to the transaction must be traceable at the merchant’s side. This merchant reference will be used by acquirers and Cardia if questions regarding a specific transaction occur. The extension uses a XML Web Service for identification and registration of required merchant details. The customer is then redirected to Cardia Server where final payment occurs (payment information is entered in a popup window from Cardia). All steps of the transaction are logged to an audit log. After finishing the payment transaction the customer is redirected to the merchants originating shop system.

URL Reference

This tables shows all URL references used in this document:

[1]

Shortcut

[1]

Description

Cardia Shop web page

[2]

Shortcut

[2]

Description

Cardia Shop v2.2Implementation Guide

[3]

Shortcut

[3]

Description

Cardia contact information

[4]

Shortcut

[4]

Description

“NuSOAP - Web Services Toolkit for PHP” Homepage

[5]

Shortcut

[5]

Description

TYPO3 session handling manual

[URL references]

Screenshots

All screenshots are taken from Cardia ePayment v1.0.0 at production implementation for TYCon3, the 1st International TYPO3 Conference in 2005.

img-1 Fig. 1: Example of Cardia ePayment extension in production environment

img-2 Fig. 2: Cardia popup window, input form screen

img-3 Fig. 3 Cardia popup window, transaction polling screen

img-4 Fig. 4: Configuration of Cardia ePayment extension in TYPO3's Constant Editor

Administration

The Cardia ePayment extension has to be integrated into a TYPO3 page as a plugin content element. Before usage your shop system has to be slightly adapted and the pt_payment extension has to be configured in Constant Editor (see chapter “Configuration”).

General requirements to use the extension:

  • JavaScript
  • Cookies required
  • TYPO3-Session

This extension uses the “NuSOAP - Web Services Toolkit for PHP” from Dietrich Ayala. This library is provided “as is” at lib/nusoap.php in the extension directory. More information is available at URL reference [4].

Integration into your shop system

After browsing in your shop, buying goods and supplying his personal/billing data the user finishes shopping and checks out where he choses credit card/Cardia payment as his payment alternative. At this point your shop system should redirect the user to the page where the Cardia ePayment Extension is integrated as a plugin (usually this page should have the checkbox “Hide in menu” checked at “Edit page header”). Here he's going to do the credit card payment in a popup window from Cardia.

After a successful transaction the user is being returned to your shop (see chapter “Configuration”). If problems occur or a transaction is not approved, the customer gets error messages with a link to the shop operator's contact page (configurable in Constant Editor).

Test transactions

The default settings for Merchant token (CF4B6B54-6C28-4FA3-86B0-E9A347D75C6C) and Currency code (NOK) can be used for test transactions. Use the following credit card information for testing purposes at Cardia's interface (popup window):

  • Card number: 44443333222211111
  • Expiry date: 0309
  • CVC2 code (optional): 081

No cards will be charged with this configuration. Please note that transactions having an amount which ends in 1, 2, 10, 20 or 99 will NOT be approved. This is a planned limitation which helps the application developers/service integrators to test the services thoroughly. For more information about testing please refer to the Cardia implementation guide available at URL reference [2].

Running live transactions

To run live transactions you have to apply for your “merchant token” (a unique identifier identifying the merchant) at Cardia (contact information: see URL reference [3]). After this identifier is given to you by Cardia, you have to change the appropriate extension setting at TYPO3's Constant Editor (“Cardia--Merchant token”). Don't forget to change all other relevant “Cardia--...” settings there (e.g. “Currency code”, “Store name”, “Order description”; see chapter “Configuration”). For details about running live transactions please refer to the Cardia implementation guide available at URL reference [2] – here's the appropriate quotation:

“When a merchant is prepared to run live transactions, the merchantToken (which identifies the merchant in Cardias data backend) has to be updated. With an updated Merchant Token it is possible to run a partial live test when still standing in test mode. The amount will be reserved if authorised but not charged. When running tests in live mode all cards will be charged if authorised, and the specified amount will be deducted from the cardholders account. However, the amount can be transferred back to the cardholders’ account - a process that normally takes three bank days (for Norwegian cards).”

Debugging

If you encounter problems getting the extension to work, enable the debug mode (at TYPO3's Constant Editor: “Others”->”Enable debug output”) to print out details what the extension does. This is only for testing purposes, so be sure to disable the option in production environment!

Further more you may have a look at the audit log file (in the directory you've configured in Constant Editor: “Enable”->”Audit log output directory”) for debugging past transactions.

Configuration

Required adaptation of your shop system

An adaptation of your shop system is needed to store required values into TYPO3 session keys for further processing by the Cardia ePayment extension. This requires some PHP/TYPO3 scripting knowledge (for instructions about TYPO3 session handling please refer to URL reference [5]).

There are two values to be stored into the TYPO3 session in order to create an interface to the Cardia ePayment extension:

  • Amount (sum total): The first session key is mandatory and it must contain the total sum (gross amount) the customer has to pay for his shopping transaction.I:underline:MPORTANT: If decimal points are used, the decimal separator has to be a point "." and NOT a comma ","!The default name for the appropriate session key is “amountGross” - if you want to use another session key name feel free to do so, but don't forget to configure this name in Constant Editor's “Shop API-- Gross amount” property (see Reference below).
  • Invoice number: The second required session key should contain the invoice number of the user's shopping transaction. This number is used for transaction logging of the extension and for the order description at Cardia.The default name for the appropriate session key is “billNo” - if you want to use another session key name feel free to do so, but don't forget to configure this name in Constant Editor's “Shop API-- Invoice No.” property (see Reference below).

Your shop system should store these values using TYPO3's session API, e.g.:

$GLOBALS["TSFE"]->fe_user->setKey('ses', 'amountGross', $yourShopsTotalSum);
$GLOBALS["TSFE"]->fe_user->setKey('ses', 'billNo', $yourShopsInvoiceNumber);

The Cardia ePayment extension reads these session keys from the TYPO3 session and uses their values for further payment processing.

Finally, if a payment transaction was completed successfully (payment accepted), a unique transaction GUID (global unique identifier) is returned by Cardia and saved automatically into the TYPO3 session by the extension. The session key name for this GUID is 'acceptedPaymentGuid'. This value is available for further processing in your shop system via PHP:

$GLOBALS['TSFE']->fe_user->getKey('ses', 'acceptedPaymentGuid')

After having saved this session key the extension returns the user to the local shop page configured in Constant Editor (“Shop API--Local return page” property) with the GUID attached to the return page URL as GET parameter 'apid' (for “accepted payment ID”), e.g.

http://<shopdomain.com>/<returnpagename>.html?apid=<accepted payment ID>

Returned to your shop, for security reasons your shop script should compare both IDs (GET param 'apid' from URL/GPvars and session key 'acceptedPaymentGuid' from TYPO3 session) to make sure everything is ok. If these IDs differ, something went wrong (or maybe there was a fraud trial) and the user should contact the shop owner (to be announced by your shop script).

Extension configuration via TypoScript/ Constant Editor

The Extension is widely configurable via TYPO3's “Constant Editor”, including the interfaces to your shop system and to the Cardia payment gateway. To load the default config and the config options in Constant Editor, you have to include the static extension template 'Cardia ePayment configuration' in the TypoScript template of the page where you've installed Cardia ePayment plugin.

To open TYPO3's “Constant Editor”, go to the TYPO3 Backend, click on "Template" in the left-frame menu, choose the page with the root- template in the pagetree and select the "Constant Editor" from the menu in the upper right corner. Please refer to chapter “Reference” for all available parameters.

'Shop API' parameters

Use the “Shop API--” settings in Constant Editor to create the interface to your shop system (that has been adapted for co-operating with pt_payment as described above in chapter “Required adaptation of your shop system”).

You have to configure several page identifiers (TYPO3 page ID [pid] or alias) and the name of the TYPO3 session keys that store values from your shop to be processed by the payment extension (total amount to pay, invoice number). Your shop system has to store the required values into these session keys before calling the Cardia ePayment extension page (see above).

'Cardia' parameters

The Constant Edior settings prefixed with “Cardia--” are parameters used for the Cardia payment gateway. For detailed description of special Cardia parameters please refer to the Cardia implementation guide available at URL reference [2].

The extension's default settings for “Merchant token” and “Currency code” can be used for test transactions (see chapter “Administration”). For live transactions in your production phase you have to apply for an unique merchant token at Cardia (contact information: see URL reference [3]) and change these settings.

Changing the extensions' CSS styles

The default CSS styles of the extension are predefined in the file ext_typoscript_setup.txt within the property “_CSS_DEFAULT_STYLE” (please refer to chapter “Reference” for default value); these styles go into the document header.

To use your own CSS styles for the extension, e.g. within an external CSS file, you have to copy the CSS classes found in the property “_CSS_DEFAULT_STYLE” to your own CSS file (you may copy the classes from the chapter “Reference”), adapt them to your needs and empty the plugin's default property “_CSS_DEFAULT_STYLE” in your root template's TypoScript setup.

((generated))
Example
// clear default CSS styles for Cardia ePayment extension
plugin.tx_ptpayment_pi1._CSS_DEFAULT_STYLE >

Reference

The following table shows the TypoScript properties of plugin.tx_ptpayment_pi1. Most properties are available as appropriate configuration options in TYPO3's Constant Editor.

logDir

Property

logDir

Data type

string

Description

Audit log output directory : Directory path for generated audit log (absolute server path, don't forget the prefacing and closing slashes "/").

Default

systemMail

Property

systemMail

Data type

string

Description

Email address for system mails : Email address for auto-generated mails of this plugin (e.g. logging errors).

Default

scriptLocation

Property

scriptLocation

Data type

string

Description

Shop API--Local script location page : Identifier (PID or alias) of the TYPO3 page within your shop site where you've integrated the Cardia ePayment Plugin. This location is needed for redirections from Cardia Shop server (Host-URL is added by this plugin, Cardia adds GET params).

Default

payment

returnPage

Property

returnPage

Data type

string

Description

Shop API--Local return page : Identifier (PID or alias) of your TYPO3 shop page where the user should be redirected for further processing after completing the ePayment transaction.

Default

confirmation

contactPage

Property

contactPage

Data type

string

Description

Shop API--Local contact page : Identifier (PID or alias) of your TYPO3 shop page where the contact form or contact information for users is integrated in your shop. This will be linked at many points, e.g. if problems occur. Remove the default entry if you don't offer a contact page.

Default

contact

sessionKeyAmount

Property

sessionKeyAmount

Data type

string

Description

Shop API--Gross amount : Name of the session key which holds the gross amount (total sum) the customer has to pay (IMPORTANT: If decimal points are used, the decimal separator has to be a point "." and NOT a comma ","!)

Default

amountGross

sessionKeyInvoiceNo

Property

sessionKeyInvoiceNo

Data type

string

Description

Shop API--Invoice No. : Name of the session key which holds the invoice number of the related invoice.

Default

billNo

messageOnPaymentError

Property

messageOnPaymentError

Data type

string

Description

Shop API--Message on payment error : Text of an message that should be displayed besides an error description and a contact link.

Default

<b>IMPORTANT NOTICE:</b> Independently of this epayment error your invoice has been created. You'll find bank transfer information for alternative payment on your invoice.

cardiaWebserviceURL

Property

cardiaWebserviceURL

Data type

string

Description

Cardia--Web service URL : A script on your web server sends all relevant parameters to a web service at Cardia’s server specified by this URL. The Cardia web service will return values identifying the payment request. (Default URL taken from Cardia Shop v2.2 Implementation Guide; do not change until further notice from Cardia!)

Default

https://secure.cardia.no/ Service/Card/ Transaction/1.2/ Transaction.asmx?WSDL

[*without blanks!*]

merchantToken

Property

merchantToken

Data type

string

Description

Cardia--Merchant token : A unique identifier identifying the merchant. The ID is given to you by Cardia. The default token is a test token for standard transaction testing (taken from Cardia Shop v2.2 Implementation Guide).

Default

CF4B6B54- 6C28-4FA3- 86B0-E9A347D75C6C

[*without blanks!*]

store

Property

store

Data type

string(50)

Description

Cardia--Store name : The name of your shop (max. 50 chars).

Default

Test merchant

orderDescription

Property

orderDescription

Data type

string(50)

Description

Cardia--Order description : Short description of the product(s) purchased. This description will be completed by the user's invoice number (taken from session, see 'Shop API > Invoice No.' above). The completed string must not exceed 50 chars (!) and is shown to the user at the Cardia popup window.

Default

Test order

currencyCode

Property

currencyCode

Data type

string(3)

Description

Cardia--Currency code : The ISO three letter currency code specifying the currency to use (e.g. EUR for Euro, GBP for British pounds, NOK for Norwegian kroner, SEK for Swedish kroner, DKK for Danish kroner). The default code for testing (in combination with the test merchant token, see 'Merchant token' above) is NOK.

Default

NOK

skipFirstPage

Property

skipFirstPage

Data type

boolean

Description

Cardia--Skip first page flag : If enabled (default), the first page in the Cardia payment interface will not be shown to the customer. If this preference is disabled, the first page is displayed to the user. The first page gives the customer the possibility to choose available payment methods (either Credit Card, Telenor MobilHandel or LUUP). If the merchant has only one payment method available, it is advised to enable this preference (as it is by default) and reduce the numbers of steps needed to finalise the payment session.

Default

1

skipLastPage

Property

skipLastPage

Data type

boolean

Description

Cardia--Skip last page flag : If enabled, the last page in the Cardia payment interface will not be shown to the customer. If this preference is disabled (default), the last page is shown to the user. The last page gives the customer a confirmation saying if the payment was approved or not. If this preference is enabled, the user must get the appropriate confirmation message at the first page when he is returned to the merchant’s site.

Default

0

isOnHold

Property

isOnHold

Data type

boolean

Description

Cardia--Is on hold flag : If enabled, the payment is authorised but NOT charged to the customer before a confirmation that the card should be charged is given by the merchant. If this preference is disabled (default), the payment is both authorised AND charged to the customer at the same time. E.g. in Norway it is advised that the customer should not be charged for any goods before the goods are shipped to the customer. When performing an authorisation only (pref enabled), the customer will notice that the amount will disappear from the available funds on his card account (but not from his balance). Depending on the bank the funds will automatically return to the available funds after a period of 3(-30) days if a confirmation from the merchant is not given within due time. The merchant has 19 days from the date the authorisation is given to confirm that the funds should be charged to the cardholders account. If this period is exceeded, a new authorisation must be initiated (the payment process must be done once more).

Default

0

useThirdPartySecurity

Property

useThirdPartySecurity

Data type

boolean

Description

Cardia--Use third party security flag : Enable this preference if the transaction should go through 'Verified by Visa - VbV' (Visa cards) or 'Secure Code - SC' (MasterCard). If disabled (default), the transaction is not routed through VbV or SC. IMPORTANT: Disable this preference until the application is working properly. After the application has been tested thoroughly, enable the preference _only_ if '3DSecure' is ordered at Cardia, and perform new tests with the changed preference. If on the other hand '3DSecure' is not ordered or the merchant not yet enrolled, it is of high importance to disable the preference (as it is by default).

Default

0

paymentMethod

Property

paymentMethod

Data type

int

Description

Cardia--Payment method : This preference has only impact if the skipFirstPage preference is enabled (as it is by default). If this parameter is set to 1000 (default), the customer is shown the credit card window. If this parameter is set to 10000, the customer is shown the Telenor MobilHandel window.

Default

1000

debug

Property

debug

Data type

boolean

Description

Enable debug output : Enables the extensions' debug output (only for testing purposes, be sure to disable in production environment!).

Default

0

_CSS_DEFAULT_STYLE

Property

_CSS_DEFAULT_STYLE

Data type

string

Description

Default CSS styles (these go into the document header) - please change styles in your template setup (TypoScript). The default setting in file ext_typoscript_setup.txt is:

_CSS_DEFAULT_STYLE (

    .tx-ptpayment-pi1-txt-default {font-size:13px; font-weight:normal; font-family:Arial,Helvetica,sans-serif;}
    .tx-ptpayment-pi1-txt-default a {font-size:13px; font-weight:normal; font-family:Arial,Helvetica,sans-serif;}
    .tx-ptpayment-pi1-txt-mini {font-size:11px; font-weight:normal; color:#666666; font-family:Arial,Helvetica,sans-serif;}
    .tx-ptpayment-pi1-fieldset-error {padding:8px; border:1px solid #ff9966;}
    .tx-ptpayment-pi1-legend-error {font-size:15px; font-weight:bold; color:red; font-family:Arial,Helvetica,sans-serif;}

    pre.tx-ptpayment-pi1-trace {font-size:11px; font-weight:normal; color:#666666; font-family:monospace;}
    pre.tx-ptpayment-pi1-auditlog {font-size:11px; font-weight:normal; color:#993300; font-family:monospace;}
    pre.tx-ptpayment-pi1-auditlog-error {font-size:11px; font-weight:normal; color:red; font-family:monospace;}

)

Default

[see description]

Known problems

None so far.

THIS EXTENSION IS OBSOLTE SINCE 03/2008:

Cardia has been taken over by DIBS, pt_payment is discontinued now!

To-Do list

Maybe implement an alternative version without usage of JavaScript someday...

Changelog

  • v1.1.3: Extension marked as obsolte/discontinued
  • v1.1.2:- PHP5 compatibility update: Renamed NuSOAP's class "soapclient" to "nusoapclient" for compatibility with PHP5 which has an internal predefined class called "SoapClient"- Reorganisation of TypoScript template config: the extension's TS template will not be added automatically to all pages anymore, rather the user has to include the static extension template 'Cardia ePayment configuration' where needed
  • v1.1.1:- Cardia popup window: the status bar is displayed now; window height increased for correct Firefox display- Javascipt workaround added to prevent user to reload an already opened popup window by using the main window link- minor bugfix for payment log ("Back from Cardia shop server..." entry has a GUID now, too)
  • v1.1.0:- extension state set to “stable” (after successful production environment period for TYCon3 conference registration)- manual updated and completely reformatted due to faulty TER display
  • v1.0.1: manual updated for testing TER display
  • v1.0.0:- adaptation to current Cardia API “Cardia Shop v2.2” (incl. changed default merchantToken for testing)- complete reorganization of the extension code, improved TYPO3 integration/CGL compliance- usage of customizable CSS styles for the extension- different URLs for the PrepareTransaction params “unsuccessfulTransactionUrl“and “successfulTransactionUrl”- invoice number from originating shop system now used as additional input parameter to create the merchantReference
  • v0.2.1: Finnish translation merged. Thanks for support!
  • V0.2.0:- multilanguage capabilities implemented via TYPO3 locallang file for frontend user output (not debug mode/audit log)- improved TYPO3 integration using TYPO3 Core APIs- fixed double allocation of 'case 45' in method returnResponseCodeMsg()- added XHTML compliance- this documentation: corrected URL of the Cardia Implementation Guide used by the current state of the extension, addedConfiguration Reference
  • v0.1.2: initial version uploaded to TER

img-5 EXT: Cardia ePayment - 9