Skip to content
Permalink
oc-1
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

This branch is no long updated by Svea, the master branch has support for OC 2.3+

OpenCart - Svea payment module

  • Supports OpenCart 1.4.9 or higher
  • Requires PHP 5.3 or higher (namespace support)
  • Feature Product Price Widget and admin functions requires vQmod to be installed in your Opencart installation

This module supports Svea invoice and payment plan payments in Sweden, Finland, Norway, Denmark, Netherlands and Germany, as well as creditcard and direct bank payments from all countries.

The module has been tested with OpenCart and any pre-installed checkout, coupon, voucher and shipping modules, including the Svea invoice fee module. The module has been updated to make use of the latest payment systems at Svea, and builds upon the included Svea php integration package.

New! The module integrates the Opencart admin functions with svea admin. Functions such as deliver, confirm, cancel and credit orders will execute corresponding action in svea admin.

NOTE: If you are upgrading from the previous version 1.x of this module, please contact Svea support before installing the module, your account settings may require updating.

As always, we strongly recommend that you have a test environment set up, and make a backup of your existing site, database and settings before upgrading.

If you experience technical issues with this module, or if you have feature suggestions, please submit an issue on the Github issue list.

For release history, see github release tags

#Installation instructions If you are upgrading from a previous version of the Svea module follow these steps:

  • Uninstall the old module.

##Basic installation example using the Svea Invoice payment method

The following example assumes that you have already downloaded and installed OpenCart as described in the OpenCart documentation.

This guide covers how to install the SveaWebPay OpenCart module and various payment methods in your OpenCart shop, as well as the various localisation settings you need to make to ensure that the module works properly.

Install the OpenCart SveaWebPay module files

  • Download or clone the contents of this repository from github, and unzip to a local folder.
  • If you are upgrading from a previous version of the Svea module, uninstall the old module.
  • Copy the contents of the src folder to your OpenCart root folder.
  • Make sure to merge the files and folders from the module with the ones in your OpenCart installation (no files should be overwritten).

Configure the payment module(s) in the OpenCart admin panel

In this example we'll first configure the Svea invoice payment method, instructions for other payment methods follow below.

Svea payment modules

Svea invoice configuration

The various Svea payment modules are located under Extensions/Payments in the OpenCart administration interface.

  • Log in to your OpenCart admin panel.
  • Browse to extensions -> payments where the various Svea payment methods should appear in the list.
  • Click the install link of the payment method you want to install. For now, select install the Svea Invoice payment method.
  • Then select edit next to the now installed payment method. You will now see a view with various payment method settings.
  • Set geo zone and sort order according to your preferences.
  • Add additional Description in checkout. Will be added right after the payment name in step 5 in checkout.
  • Set the fields status and testmode to enabled.
  • Set order status with the orderstatuses you want to trigger the corresponding action to Svea admin. When you edit an order and change the orderstatus, an request will be sent to Svea. The actions available for invoice are Deliver, Credit and Cancel order.
  • Shipping same as billing determines whether to use the svea billing address for both shipping and billing. It will ignore if customer tries to change the shipping address. Should be set to yes if your contract with Svea does not tell otherwise.
  • _Auto deliver order will set the orderstatus to shipped when customer confirms purchase.
  • Show Product Price Widget: If set to true, the Svea Product Price Widget will be shown on product pages, displaying the minimum invoice amount to pay. Note: Only applicable if Svea buys the invoices, and for private customers. Only applies in Sweden, Norway, Finland and the Netherlands.

Widget will be displayed if the product price equals or exceeds the amount given. If not set, the Product Price Widget will be displayed regardless of product price. Please contact your Svea account manager if you have further questions. Note! Requirers vQmod

  • Fill out the required fields username, password and client no. In an production environment, use your Svea account credentials for the desired locales and payment methods. For testing purposes, make sure to use the supplied test account credentials. Note that there are separate settings for each country in which you have an agreement with Svea to accept invoice payments, each country has its own unique client no and credentials.
  • Finally, remember to save your settings.

Invoice payment settings

Next we set up the Svea invoice fee (used by Svea Invoice payment method )

The Svea invoice fee has its own module, which is located under Extensions/Order Totals in the OpenCart administration interface.

  • Browse to extensions -> order totals.
  • Locate Svea invoice fee in the list, choose install and then edit:
  • For each country which you accept invoice payments from, selected the corresponding tab an fill in the fields:
  • Set the status field to enabled to add the invoice fee to invoice orders from this country.
  • Set the fee to the amount you want to charge. The fee is always specified in the store default Currency. It will be converted into the customer currency on order.
  • Set the corresponding tax class which should apply to the Svea invoice fee. Note that you must specify a tax class or the invoice fee will show up in the order total display, but it will not be included in the order total.
  • Finally, the sort order field should be set to apply before taxes (i.e. to a lower value than Order Totals/Taxes).

Invoice fee additional settings

See also "Localisation and additional OpenCart configuration requirements" below.

Other payment methods

For the other Svea payment methods (payment plan, card payment and direct bank payment), see below.

Svea payment plan configuration

  • In OpenCart admin panel, browse to extensions -> payments.
  • Locate Svea part payment in the list, choose install and then edit:
  • Set geo zone and sort order according to your preferences.
  • Add additional Description in checkout. Will be added right after the payment name in step 5 in checkout.
  • Set testmode and status to enabled.
  • Set order status with the orderstatuses you want to trigger the corresponding action to Svea admin. When you edit an order and change the orderstatus, an request will be sent to Svea. The actions available for Payment Plan are Deliver, Credit and Cancel order.
  • Shipping same as billing determines whether to use the svea billing address for both shipping and billing. It will ignore if customer tries to change the shipping address. Should be set to yes if your contract with Svea does not tell otherwise.
  • Fill out the required fields username, password and client no. In an production environment, use your Svea account credentials for the desired locales and payment methods. For testing, make sure to use the supplied test account credentials.
  • The field min. amount must match the corresponding setting in Svea admin.
  • Show Product Price Widget: If set to true, the Svea Product Price Widget will be shown on product pages, displaying the minimum payment plan amount to pay each month. Only applies in Sweden, Norway, Finland and Denmark. Please contact your Svea account manager if you have further questions. Note! Requirers vQmod
Updating available payment plan campaigns

NOTE: To avoid excessive traffic to Svea and speed up checkout delays, the modules stores the various payment plans/campaigns locally. This means that you have to manually update the module with the current campaigns after any changes has been made in Svea back office:

  • In OpenCart admin panel, browse to extensions -> payments.
  • Locate Svea part payment in the list, and select edit.
  • The module will automatically update the available campaigns when you select to save the payment method. There is no additional confirmation.

Svea Card Payment

Module supports one Svea merchant id per Opencart installation.

  • In OpenCart admin panel, browse to extensions -> payments.
  • Locate Svea card payment in the list, choose install and then edit:
  • Set order status with the orderstatuses you want to trigger the corresponding action to Svea admin. When you edit an order and change the orderstatus, an request will be sent to Svea. The actions available for Card are Deliver, Credit and Cancel order.
  • Set geo zone and sort order according to your preferences.
  • Add additional Description in checkout. Will be added right after the payment name in step 5 in checkout.
  • Set testmode and status to enabled.
  • Fill out the required fields merchant id and secret word. There are tabs for each test and prod. For prod, use your Svea account credentials. For test, make sure to use the supplied test account credentials.

Card payment settings

Svea Direct Payment

Module supports one Svea merchant id per Opencart installation.

  • In OpenCart admin panel, browse to extensions -> payments.
  • Locate Svea card payment in the list, choose install and then edit:
  • Set order status with the orderstatuses you want to trigger the corresponding action to Svea admin. When you edit an order and change the orderstatus, an request will be sent to Svea. The actions available for Direct Bank is Credit order.
  • Set geo zone and sort order according to your preferences.
  • Add additional Description in checkout. Will be added right after the payment name in step 5 in checkout.
  • Set testmode and status to enabled.
  • Fill out the required fields merchant id and secret word. There are tabs for each test and prod. For prod, use your Svea account credentials. For test, make sure to use the supplied test account credentials.

##Additional OpenCart configuration requirements

Specifying prices

  • The product prices must be given in the default currency if multiple currencies are used.
  • Also, prices must be given excluding any taxes.
  • Currency decimals must be set to two (2) when using Euro currency.

Customer registration required fields

  • For use in Dutch and German stores the postal code needs to be set to required for customer registrations.

Order Total module sort order

  • For use with vouchers, the voucher module sort order must be after taxes.
  • For coupons, the coupon module sort order (in admin, under extensions/order totals) must be set to have a lower sort order than taxes.
  • Also, the coupon discount amount (in admin, under sales/coupon) must be specified excluding tax. The coupon tax discount will then be calculated in accordance with OpenCart standard behaviour, and is specified in the order history.
  • The recommended order total sort order is: sub-total (lowest), Svea invoice fee, shipping, coupon, taxes, store credit, voucher and total.

A note on specifying taxes in OpenCart

If you have your shop set up to sell mainly to Swedish customers, but have a substantial number of sales to a foreign country (here: Norway), you might want to charge Swedish tax for Swedish customers, and Norwegian tax for Norwegian customers. Ask your accountant for the precise sales numbers required, or sales abroad in general.

This is done by specifying a tax class containing two different tax rates, one for Sweden and one for Norway with the appropriate tax rates. The tax rates each contain a geo zone. For the Swedish tax rate, the geo zone should include all countries where Swedish vat should be charged (i.e. typically all countries that you sell to, but excluding Norway). The Norwegian tax rate geo zone should then include the countries where Norwegian vat should be charged (i.e. Norway only).

In the tax class settings, make sure that the Norwegian tax rate applies before the Swedish tax rate, i.e. has a higher priority than the Swedish tax rate, and that all tax rate selections are based on the customer Payment Address. The same procedure applies be used for products and i.e. the Svea invoice fee.

Svea order administration actions

Administrating orders

  • Set the order statuses in module settings.
  • Go to Sales -> Orders -> Edit order -> Totals tab
  • When you change the Order Status to the same status set in module, the action will be sent to Svea admin aswell, meaning you do not have to log in to the Svea admin.
  • Save.

Please note that orders created with earlier versions of the Module than 2.6.0 cannot be administrated from the Opencart order administration interface. Important! The Svea order id information saved in the Comment field must not be changed for the action to work. You may add to the information, but not change or remove it.

The below actions only applies to orders created in Module version 2.6.0 or higher.

Actions available:

Method Deliver order Cancel order Credit order Auto Deliver order
Invoice * * * *
Paymentplan * * *
Card * * *
Direct bank *

##Auto deliver option

Set up to auto deliver the order. If not set this can be done from Sveas admin panel.

  • Browse to extensions -> payments -> Svea payment method (applies only to the Invoice or Payment plan payment methods)
  • Set auto deliver to enabled
  • Set the order status
  • If you have an agreement with Svea to deliver the invoice as email, you can also set the distribution type -> Email

##Troubleshooting and recommendations

Always check that you have set up your settings correctly before posting issues or contacting Svea support. Specifically, the following settings must all be in place for the payment module to work correctly:

Check your Svea customer credentials

  • Your username, password, client no for Invoice and Part Payment are correct.
  • Your secret word and merchant id for Card and Direct bank payments are correct and that the test-secret word and production-secret word are in their right places.

Check correlated OpenCart settings and localisations

  • Under system -> localisation, the correlating tax class, tax rate (including customer groups), currency and geo zone settings are correct.
  • Under extensions -> order totals, the sort order et al are correct.
  • You are using correct test case credentials when conducting test purchases.

Specific payment method problems FAQ

The invoice fee shows doesn't seem to be included in the OpenCart order total, though it is present in the Svea invoice?

Ensure that you have specified a valid tax class for the country in question in the svea invoice fee module.

My card or direct payments don't go through after reinstalling my shop?

Check that you don't attempt to reuse order numbers, they need to be unique. I.e. in the call to

$form = WebPay::createOrder()-> ... ->setClientOrderNumber("33")-> ...

the order number "33" can't have been used in a previous order.

##Important info The request made from the card and direct payment modules to Sveas systems is made through a redirected form. The response of the payment is then returned to the module via POST or GET (selectable in the corresponding Svea admin interface).

###When using GET response Have in mind that a long response string sent via GET could get cut off in some browsers and especially in some servers due to server limitations. Our recommendation to solve this is to check the PHP configuration of the server and set it to accept at LEAST 512 characters.

###When using POST response As our servers are using SSL certificates and when using POST to get the response from a payment the users browser propmts the user with a question whether to continue or not, if the receiving site does not have a certificate. Would the customer then click cancel, the process does not continue. This does not occur if your server holds a certicifate. To solve this we recommend that you purchase a SSL certificate from your provider.

We can recommend the following certificate providers:

  • InfraSec: infrasec.se
  • VeriSign : verisign.com