Nets D2 for WooCommerce

  1. Home
  2. /
  3. Nets D2 for WooCommerce
  4. /
  5. Get started
  6. /
  7. Nets D2 for WooCommerce

Nets D2 for WooCommerce

General information


The Nets D2 for WooCommerce plugin will soon be retired.
All new users should use the Nets Easy plugin.

Nets D2, previously DIBS D2, is a plugin that extends WooCommerce, allowing you to take payments via Nets. This plugin supports Nets D2 FlexWin payment method.

  • You need an agreement with Nets and your acquiring bank to be able to use this plugin.
  • A SSL certificate is not necessary but strongly recommended. If your site doesn’t hold a certificate the customer will, after a completed purchase, go from a secure connection to a unsecure one. In that case the customers browser prompts the customer with a question whether to continue or not. Would the customer then click cancel, the process does not continue. This does not occur if your server holds a certificate.

Currencies


The plugin itself has no limitations regarding currency.

However, please note that there can be limitations in the agreement you have with Nets.

When it comes to questions regarding supported currencies you should always talk to your payment provider. The exception is when the plugin in fact do have limitations.

You can read more about this at the Nets website.


Required WooCommerce settings


Make sure that you have enabled pretty permalinks in your WordPress installation. Otherwise callbacks from Nets back to your store won’t work and orders will not be updated with the correct order status/information.


Installation


  • Login to WordPress Admin. Navigate to Plugins → Add New (in the left column menu).
  • In the search field type “Nets D2” and click Search Plugins. Once you’ve found the plugin you can install it by simply clicking “Install Now”.
  • Activate the plugin.

Configuration: Card payment


  1. Navigate to WooCommerce > Settings > Payments > DIBS
  2. Enable DIBS card payment by checking the Enable DIBS checkbox
  3. The Title and Description fields controls what the customer sees during checkout.
  4. DIBS Merchant ID – Enter your DIBS Merchant ID that you request/recieve from Nets.
  5. MD5 k1 & MD5 k2 – Can be found in your Nets account, under –> Integration –> MD5 keys. Only needed when using FlexWin.
  6. Language – Set the language in which the page will be opened when the customer is redirected to Nets.
  7. Alternative payment icon – Specify the URL to an alternative payment icon that the user sees during checkout. Leave blank to use the default image. Alternative payment method logos can be found here.
  8. Icon width – The width of the Alternative payment icon.
  9. DIBS transaction capture – Select if you want to capture the card payment from WooCommerce or not. When a purchase is completed the amount is first reserved on the customers card. In the next step you as a merchant need to capture the payment.
    – Select On order completion if you want he capture to be triggered from WooCommerce when changing the orderstatus from Processing to Completed.
    – Select On purchase if you want the capture to be done directly when the customer finalizes the purchase in Nets payment screen (this does not work subscription signup payments, use On order completion instead if using WooCommerce Subscriptions).
  10. Calcfee – Check this box if you want to automatically calculate and affix the charge from your acquirer
  11. Decorator – Specifies which of the pre-built decorators to use. This will override the customer specific decorator, if one has been uploaded. Select Responsive to get a mobile optimized payment window experience.
  12. Split card payments – Check this box to enable two additional card payment methods.

API Credentials

To be able to process refunds in Nets directly from WooCommerce you need to create API credentials in the Nets backoffice.

  • Login to your account at Nets.
  • Navigate to → Setup → User Setup.
  • Click on the tab API Users.
  • Click the button Create new login.
  • Enter a username (Login) and password and click the button Create.
  • Enter the same credentials in API Username & API Password in the payment gateway settings.
  • Save the payment gateway settings and you should now be able to process refunds from WooCommerce.

Test Mode Settings

  1. Test Mode – Check this box if your Nets account is set to test mode. Read more about the Nets test process here.
  2. Debug – Check this box to log events for debugging. The log can be found by navigating to WooCommerce > System Status > Logs.

Nets backoffice setup


  • Log in to your account at Nets.
  • Navigate to → Integration → md5 keys.
  • Generate new md5 keys if none have been created yet.
  • Check the box Perform verification of md5key (for security reasons). Make sure to leave the box unchecked if you are using Nets together with the WooCommerce Subscriptions extension.
  • Navigate to → Integration → Return Values and make sure that the following boxes are checked:
    – Orderid
    – Paytype
    – All fields exclusive of card information response
    – Transaction status code
  • Check the box Skip step 3 – Payment approved under → Integration → FlexWin.

Nets transaction ID in order emails


In some cases Nets require that the Nets Transaction ID is included in the order email sent to the customer. At the moment this isn’t a feature included in the payment gateway. To achieve this you could instead add the following lines to your themes functions.php or in a separate plugin:

/**
 * Add the DIBS Transaction ID to order emails
 **/
add_filter('woocommerce_email_order_meta_keys', 'dibs_woocommerce_email_order_meta_keys');

function dibs_woocommerce_email_order_meta_keys( $keys ) {
	$keys['DIBS Transaction ID'] = 'dibs_transaction_no';
	return $keys;
}

Filter the paytype sent to Nets


Through the parameter paytype that is sent to Nets when a payment is being made you can control which payment types that you want to show in the Nets payment window. Standard is that all card types is sent as paytypes. If you want to alter this and add let’s say – Direct bank payment, you can modify this through the filter “woocommerce_dibs_paytypes”.

Here is how you do it:

/**
 * WooCommerce - DIBS payment gateway
 * Filter the paytype sent to DIBS
 *
 **/
add_filter('woocommerce_dibs_paytypes', 'myprefix_dibs_paytypes');
 
function myprefix_dibs_paytypes( $paytypes ) {

	// Multiple paytypes are added comma separated.
	// See list of possible paytypes here: http://tech.dibspayment.com/toolbox/paytypes

	$paytypes = 'LOPLUS';
	return $paytypes;
}

WooCommerce Subscriptions support


The Nets payment gateway has support for recurring payments via WooCommerce Subscriptions. To activate this feature you need to:

  • Set up an agreement with Nets about taking subscription payments.
  • Purchase and configure the WooCommerce Subscriptions extension.

The Nets payment gateway ONLY supports card payments through WooCommerce Subscription.


Correct thank you page for Nets/WPML


From version 2.4.5 of the plugin we have built in support to redirect the customer to the correct language for the thank you page if you are running WPML.

We are using WPML’s filter wpml_permalink to detect the correct url for the thank you page. At the moment (August 2017) there is a known bug in this filter (https://wpml.org/forums/topic/wpml_permalink-not-returning-correct-url/). To get the redirect to work properly you need to have the permalink naming structure the same for all languages on checkout page. This means that if you have the English version like this:

http://domain.com/checkout/order-received/

you must have the Swedish version like this:
http://domain.com/sv/checkout/order-received/

not like this:
http://domain.com/sv/till-kassan/order-received/


FAQ


Q. I get a 404 on the redirect back to the store after completing a purchase in the Nets payment window.

A. This is probably caused by the fact that pretty permalinks isn’t activated on the site. This module has a redirect to mydomain.com/woocommerce/dibscallback so mod_rewrite must be enabled.

Q. Purchases looks ok in my Nets backoffice but customers can’t see the Thank you page when redirected back to the store after a purchase and the order status doesn’t change to Processing.

A. This is probably an error because of wrong configuration in the Return values in the merchants Nets account. Take a closer look at the instructions in the section about Nets backoffice setup.