Installation

Get your API key

  1. Go to two.inc and sign up with your company.
  2. You will receive an email with your API test keys. And as soon as you are ready, your production keys as well.
  3. Once you change out your test keys with your production keys, you are ready to offer your B2B customers the Two solution.

From Composer

Installation using Composer

Composer is a dependency manager for PHP. Composer declare the libraries your project depends on and it will manage (install/update) them for you.

Check if your server has composer installed by running the following command:

Copy
Copied
composer –v

If your server doesn’t have composer installed, you can easily install it by using this manual: https://getcomposer.org/doc/00-intro.md

Step-by-step to install the Magento® 2 extension through Composer:

Connect to your server running Magento® 2 using SSH or other method (make sure you have access to the command line). Locate your Magento® 2 project root. Install the Magento® 2 extension through composer and wait till it's completed:

Copy
Copied
composer require two-inc/magento2

Once completed run the Magento® module enable command:

Copy
Copied
php bin/magento module:enable Two_Gateway

After that run the Magento® upgrade and clean the caches:

Copy
Copied
php bin/magento setup:upgrade php bin/magento cache:flush

If Magento® is running in production mode you also need to redeploy the static content:

Copy
Copied
php bin/magento setup:static-content:deploy

After the installation: Go to your Magento® admin portal and open ‘Stores’ > ‘Configuration’ > TWO and check that the Two option has appeared in your Magento backend.

Screenshot of Magento backend showing Two plugin

Configuration

The configutation of the Two Checkout plugin is split into 3 areas.

Screenshot of Magento backend showing Two configuration tabs

General Config Settings

Screenshot of Magento backend showing Two configuration General tab
Field
Default Value
Description
Environment
Sandbox
Allows you to choose between the Two sandbox and production environments. The sandbox environment is exclusively for testing and does not involve any real funds unlike production
Two Username
NA
A Two provided username that is required to use the Two plugin
API key
NA
The API key is required to authorise the plugin. The sandbox API key can be found in your merchant portal after you have signed up with Two. Production keys will be handed over to you by a Two representative.
Debug Mode
Yes
The debug mode enables writing to the error logs. Debug mode should only be enabled when the sandbox enviroment is active.

Payment Config Settings

Screenshot of Magento backend showing Two configuration Payment tab
Screenshot of Magento backend showing Two configuration Payment tab
Field
Default Value
Description
Enable Two Payments
No
Whether to show Two payment option in the checkout page.
Title
Business invoice in 30 days
Descriptive title which gives the buyer a better understanding of Two payments.
Fulfilment Trigger
NA
Fulfilment can be triggered by either initializing shipping or submitting an invoice in Magento admin "/admin/sales/order_invoice/new/order_id/...". Fulfilment is an internal order state Two uses to define and track the order journey. You can experiment with the Fulfilment trigger by going to Sales → Orders and stepping through submitting an invoice or initializing shipping.
Sort Order
NA
The order in which the Two checkout appears in the payment options
Allow To Applicable Countries
NA
Enables the Two Checkout only for specific countries
Enable international telephone
Yes
Adds a country selector which enables the buyer to select the correct region number
Show telephone field
On billing page
Optional field which enables the buyer to register the telephone number the purchase is connected to. The information will be displayed on the invoice
Add department field
On billing page
Optional field which enables the buyer to register the department the purchase is connected to. The information will be displayed on the invoice
Add order note field
Yes
Optional field which enables the buyer to register a note to the merchant. The information will be displayed on the invoice
Add project field
Yes
Optional field which enables the buyer to register the project the purchase is connected to. The information will be displayed on the invoice
Add PO number field
No
Optional field which enables the buyer to register their purchase order number
Include "What is Two?" link in the checkout
Yes
Adds a link to a website which describes how Two works from a buyer perspective
Activate company name auto-complete
Yes
Adds a searchable company name input field where the buyer can select their company from a dropdown menu

Search Config Settings

Screenshot of Magento backend showing Two configuration Search tab
Field
Default Value
Description
Enable address autocomplete
Yes
The Two search service can be used to auto-fill the company address

Complete & Apply Changes

In the Admin interface, navigate to System > Tools > Cache Management > Flush Cache.Alternatively, run the following in the command line: php bin/magento cache:flush

Your Two payment gateway is now ready to use!

Disabling

If for any reason you'd like to temporarily disable the Two Magento plugin, please follow one of the below methods.

Disable via Command Line

Run the commands below:

Copy
Copied
php bin/magento module:disable Two_Gateway php bin/magento setup:upgrade php bin/magento setup:static-content:deploy php bin/magento cache:flush

Disable via Composer

Navigate to Store → Configuration → Two → Payment and set Enable Two payments to No. This will disable Two as a checkout option.
Screenshot of Magento backend showing how to disable via composer

Uninstallation

Please follow one of the below methods to uninstall the Two Magento plugin.

Uninstall via Command Line

Run the commands below:

Copy
Copied
php bin/magento module:uninstall Two_Gateway php bin/magento setup:upgrade php bin/magento setup:static-content:deploy php bin/magento cache:flush

Uninstall via Composer

Run the commands below:

Copy
Copied
php bin/magento module:disable Two_Gateway composer remove -r two-inc/magento2 php bin/magento setup:upgrade php bin/magento setup:static-content:deploy php bin/magento cache:flush

Magento Refunds

In order to refund an order, you must navigate to your Magento orders from Admin > Sales > Orders.

Select an order that has a status of 'Processing' in order to issue a refund. In this example we are selecting the top most order to edit.

Screenshot of Magento backend showing Two configuration General tab

Clicking 'View' in the order actions to edit the order, you can then navigate to the invoices tab with the associated order. In order to issue a refund, you first need to click 'View' in the invoice actions. After doing so, you can the click 'Credit Memo' to start the refund process.

Screenshot of Magento backend showing Two configuration General tab

The 'New Memo' page shows you the line items that make up the order and lets you set the quantities to refund. After setting the quantities for the items you wish to refund, click 'Refund' at the bottom of the page to issue the refund, which will then send the buyer a credit note.

Screenshot of Magento backend showing Two configuration General tab