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.

Installation

Requirements

-Craft CMS version 3.7.0 or later

-Craft Commerce version 3.4.0 or later

You can find our plugin on the Craft 4 plugin store here

Prior to installation, you must first navigate to the root directory of your Craft project in the terminal :

Copy
Copied
cd /path/to/project

You can then use composer to load the plugin with the following command

Copy
Copied
composer require netlab/commerce-two
Now navigate to your Settings > Plugins and click the install button for Commerce Two
craft admin settings page
craft admin plugin page

The plugin is now installed but requires further configuration to complete the implementation

Configuration

These steps must be taken to configurte the plugin

  1. Go to the plugin settings page (admin/settings/plugins/commerce-two) and add your API credentials (Merchant ID, API keys, select the appropriate environment, and language for invoice generation).
craft admin plugin settings page
  1. Create a new payment gateway in Craft Commerce (admin/commerce/settings/gateways) and set Two as the gateway. The plugin supports both Authorize Only and Purchase options. Note that for the Authorize Only option, you will need to manually capture the payment for each order.
settings page for the payment gateway
settings page for the gateway config

Uninstallation

If for any reason you'd like to temporarily disable or uninstall the Two Craft plugin, please follow the instructions below.

Navigate to your Settings > Plugins > Commerce Two and click the gear button to disable or uninstall the plugin.

craft admin plugin settings page

Features

  • Query companies by their names or organization numbers using the commerce-two/company-search action.
  • Retrieve the address of a desired company using commerce-two/company-address.
  • Verify that a company is allowed to use Two as a payment provider using commerce-two/company-check action.
  • If the company is accepted by Two, use commerce-two/set-company to save the company information to the cart object. This is a mandatory step as this information is used during API communication.
  • If your website uses a custom implementation to handle billing or shipping addresses, use the commerce-two/set-customer-addresses endpoint to attach the information to the customer object. This is also mandatory as the plugin uses the built-in Address handling provided by Craft 4.