Overview
If you are a developer with PHP knowledge and you would like to try your hand in integrating a new payment system not yet available in ViArt Shop
we can offer some basic information which will help you to start.
First of all, note there are two types of payment systems: Direct (also called Advanced) and Redirect.
A Direct payment system is a payment method that allows your customers to pay with credit card without leaving your store website
(this means that client is not redirected to a payment system's site to complete the purchase).
If using a Redirect payment method your customers are redirected to the payment system's site and complete orders there.
Direct (advanced) payment system
As an example of advanced payment system you can review PayPal Website Payments Pro. When creating a similar payment system
usually you need to write a special php script which will submit credit card details to some payment system. For PayPal Website Payments Pro
there is available 'payments/paypal_direct.php' script. ViArt Shop calls this script and passes there special array $payment_parameters
with values set in the Parameters List on Edit Payment System page. Using the data from $payment_parameters array you need to send special request
to payment system and receive a response from it. After receiving the response from the payment system you need to make necessary validation checks and in case of
any errors save these errors in a predefined variable $error_message.
If transaction was processed successfully variable $error_message should be empty.
Then according to the value returned with $error_message variable, order status will be changed automatically to Success or Failure Status which is pre-selected in
Advanced Parameters section in the payment system's settings.
In ViArt Shop for payment systems there are used the following statuses: Success Status, Pending Status and Failure Status.
How they are chosen by the system:
- If variable $error_message is not empty then it is a Failure Status.
- If variable $pending_message is not empty then it is a Pending Status.
- If both variables are empty then it is a Success Status.
Another predefined variable is $transaction_id where we just put order's transaction number from the payment system
we are working with.
Redirect payment system
Integrating a Redirect payment method, where credit card information is filled in on the site of this payment system,
you may look at PayPal Website Payments Standard integration. You can see this system's settings
at www.yoursite.com/admin/admin_payment_system.php?payment_id=6 and review its validation script 'paypal_pdt.php' in 'payments' folder.
The Additional Validation settings (where you are to specify the validation script you will need to write) are set up in
Settings > Orders > Payment Systems > Final Checkout Settings.
3-D Secure
3-D Secure is an XML-based protocol used as an added layer of security for online credit and debit card transactions.
Let's review checkout process step by step:
- 1. order_info.php - this page is for filling in personal and delivery details and once you click 'Continue' the order is created.
- 2. credit_card_info.php - this page is for filling in credit card data.
- 3. order_confirmation.php - on this page after customer clicks on 'Continue' button the payment module script is being called.
On this stage there are possible different ways to proceed, i.e. payment system could support 3-D Secure or not, also
credit card itself could support 3-D Secure transactions or not. In case 3-D Secure is possible, it is the mission of the validation script to
check this possibility and then fill in the following information:
- $variables["secure_3d_acsurl"] - the link where system needs to continue 3-D Secure transaction;
- $variables["secure_3d_pareq"] - encrypted user information;
- $variables["secure_3d_check"] - a parameter for internal use, identifies whether 3-D Secure is possible;
- $variables["secure_3d_status"] - a parameter where could be recorded the result of 3-D Secure transaction;
- $variables["secure_3d_md"] - secondary parameter of 3-D Secure;
- $variables["secure_3d_xid"] - another secondary parameter of 3-D Secure.
If you specify the first two parameters: [secure_3d_acsurl][secure_3d_pareq] then our shopping cart will automatically generate
a redirection form to another website for 3-D Secure. After transaction is performed, its result is being passed to the page
'order_final.php' where you can include additional checks of the received result. Remember the script with 3-D Secure and other validation checks
needs to be specified in Settings > Orders > Payment Systems > Final Checkout Page > "Validation Script" field. |