Onboarding (1.0)

Download OpenAPI specification:Download

Joachim Kruger: hello@two.inc URL: https://two.inc

[currently in Beta]

Overview and usage

This API allows you to onboard your business customers to your own product and to the Two "Buy Now Pay Later" product. To get access, contact us at hello@two.inc

Specifically:

  • Enable 1-click checkout with Two
  • Approve additional users to place orders on behalf of your business customers
  • Access insights and enriched data on your business customers
  • Receive validation that Two believes it is an accurate and valid representative of the business

Step 1: Create a B2B business customer

Do a POST /merchant/{mid}/customer. If fields are missing, you can optionally redirect the user to missing_customer_data_url where Two will collect the missing fields and store them.

Step 2: Fetch customer insights

Through GET /merchant/{mid}/customer/{cid}/insights you can obtain financial data and enriched company information on your newly created business customer, including their current purchasing power when using Two. If you provided a webhook url in Step 1, Two will keep you up-to-date whenever the insights get updated.

Step 3: Create users for your business customers.

The employees who place orders on behalf of your business customer (their employer), can be set up for purchasing through POST /merchant/{mid}/customer/{cid}/user. If a user is redirected to one_click_purchase_onboarding_url and completes the following verification steps, one-click purchasing are granted to all* existing and future users (colleagues) of this customer.

*Two reserves the right to add extra verification steps for certain orders.

Authentication

X-API-Key

Security Scheme Type API Key
Header parameter name: API Key

Create a user (employee, person) for this business customer

Your business customer has people who place orders. This resource represent one such user, and the last step of the onboarding is to create at least one user.

Provide the data you have collected (if any), and then redirect the user to the two_enrollment_url in order to let Two verify the user and complete the onboarding.

Request
path Parameters
cid
required
string

The ID of your business customer, uuid.

mid
required
string

Your merchant ID, uuid.

Request Body schema: application/json
email
string

The work email of the user.

first_name
string

User's first name.

last_name
string

User's last name.

merchant_user_id
required
string

Your internal ID of this user (the employee of your business customer).

phone
string

The phone number of the user.

Responses
200

OK

post/merchant/{mid}/customer/{cid}/user
Request samples
application/json
{
  • "email": "string",
  • "merchant_user_id": "string",
  • "first_name": "string",
  • "last_name": "string",
  • "phone": "string"
}
Response samples
application/json
{
  • "id": "string",
  • "email": "string",
  • "merchant_user_id": "string",
  • "first_name": "string",
  • "last_name": "string",
  • "phone": "string",
  • "verified_fields": "email",
  • "user_enrollment_url": "string",
  • "is_legal_rep": true
}

Create new business customer

The first step in onboarding your business customer is to create a Customer resource.

Request
path Parameters
mid
required
string

Your merchant ID, uuid.

Request Body schema:
country_prefix
string

Country code in ISO 3166-1 alpha-2 format.

email_domain
string

The customer's official email domain (the part after the "@").

insights_webhook
string

Subscribe to updates for company insights. A json object will be POST-ed to this url whenever the insights for this company get updated. The schema for this json-object it the same as for the response body of GET /merchant/{mid}/customer/{cid}/insights.

legal_name
string

The company's legally registered name.

merchant_customer_id
required
string

Your internal ID of this business customer

missing_customer_data_url
string

If any required fields are missing on your customer, you can redirect them to Two, so we can collect the missing data.

organization_id
string

The unique identification number assigned to the company/entity by the government in its juristiction.

Array of objects (Address)
trade_name
string

If the company is using a different brand/trade name, this can included here.

website
string

The official website of the company.

Responses
201

Created

post/merchant/{mid}/customer
Request samples
No sample
Response samples
application/json
{
  • "id": "string",
  • "country_prefix": "string",
  • "organization_id": "string",
  • "legal_name": "string",
  • "trade_name": "string",
  • "website": "string",
  • "merchant_customer_id": "string",
  • "insights_webhook": "string",
  • "shipping_addresses": [
    ],
  • "email_domain": "string",
  • "missing_customer_data_url": "string"
}

Fetch the business customer user

This endpoint returns the data Two has stored for this user.

Request
path Parameters
cid
required
string

The ID of your business customer, uuid.

mid
required
string

Your merchant ID, uuid.

uid
required
string

The ID of a user of your business customer, uuid.

Responses
200

OK

get/merchant/{mid}/customer/{cid}/user/{uid}
Request samples
curl -i -X GET \
  https://api.two.inc/v0/merchant/:mid/customer/:cid/user/:uid
Response samples
application/json
{
  • "id": "string",
  • "email": "string",
  • "merchant_user_id": "string",
  • "first_name": "string",
  • "last_name": "string",
  • "phone": "string",
  • "verified_fields": "email",
  • "user_enrollment_url": "string",
  • "is_legal_rep": true
}

Retrieve company insights on the business customer

Retrive Two's company insights on your business customer. When a customer resource is created, Two will start an analysis process which will result in a collection of data that can be accessed through this endpoint.

If an insights_webhook was provided on the MerchantCustomer, Two will post updates to this webhook whenever new updates are available.

Request
path Parameters
cid
required
string

The ID of your business customer, uuid.

mid
required
string

Your merchant ID, uuid.

Responses
200

OK

get/merchant/{mid}/customer/{cid}/insights
Request samples
curl -i -X GET \
  https://api.two.inc/v0/merchant/:mid/customer/:cid/insights
Response samples
application/json
{
  • "id": "string",
  • "company_type": "private",
  • "industry_code": "string",
  • "official_addresses": "string",
  • "general_manager": "string",
  • "annual_sales": {
    },
  • "sales_growth_yoy": 0,
  • "is_flagged": true,
  • " year_of_establishment": 0,
  • "date_updated": "string",
  • "date_created": "string",
  • "risk_tier": "string",
  • "minimum_available_spend": {
    }
}

Retrieve your business customer

Retrieve your business customer.

Request
path Parameters
cid
required
string

The ID of your business customer, uuid.

mid
required
string

Your merchant ID, uuid.

Responses
200

OK

get/merchant/{mid}/customer/{cid}
Request samples
curl -i -X GET \
  https://api.two.inc/v0/merchant/:mid/customer/:cid
Response samples
application/json
{
  • "id": "string",
  • "country_prefix": "string",
  • "organization_id": "string",
  • "legal_name": "string",
  • "trade_name": "string",
  • "website": "string",
  • "merchant_customer_id": "string",
  • "insights_webhook": "string",
  • "shipping_addresses": [
    ],
  • "email_domain": "string",
  • "missing_customer_data_url": "string"
}

Update your business customer

Update your business customer.

Request
path Parameters
cid
required
string

The ID of your business customer, uuid.

mid
required
string

Your merchant ID, uuid.

Request Body schema: application/json
country_prefix
string

Country code in ISO 3166-1 alpha-2 format.

email_domain
string

The customer's official email domain (the part after the "@").

insights_webhook
string

Subscribe to updates for company insights. A json object will be POST-ed to this url whenever the insights for this company get updated. The schema for this json-object it the same as for the response body of GET /merchant/{mid}/customer/{cid}/insights.

legal_name
string

The company's legally registered name.

merchant_customer_id
required
string

Your internal ID of this business customer

missing_customer_data_url
string

If any required fields are missing on your customer, you can redirect them to Two, so we can collect the missing data.

organization_id
string

The unique identification number assigned to the company/entity by the government in its juristiction.

Array of objects (Address)
trade_name
string

If the company is using a different brand/trade name, this can included here.

website
string

The official website of the company.

Responses
200

OK

put/merchant/{mid}/customer/{cid}
Request samples
application/json
{
  • "country_prefix": "string",
  • "organization_id": "string",
  • "legal_name": "string",
  • "trade_name": "string",
  • "website": "string",
  • "merchant_customer_id": "string",
  • "insights_webhook": "string",
  • "shipping_addresses": [
    ],
  • "email_domain": "string",
  • "missing_customer_data_url": "string"
}
Response samples
application/json
{
  • "id": "string",
  • "country_prefix": "string",
  • "organization_id": "string",
  • "legal_name": "string",
  • "trade_name": "string",
  • "website": "string",
  • "merchant_customer_id": "string",
  • "insights_webhook": "string",
  • "shipping_addresses": [
    ],
  • "email_domain": "string",
  • "missing_customer_data_url": "string"
}
Copyright © 2021 Tillit AS. All rights reserved.