Two Order API (1.0)

Download OpenAPI specification:Download

This API is for creating orders connected to an online purchase through your solution. The API also functions as a central building block when using other Two APIs, e.g. Marketplace API, and Trade Account Onboarding API.

Specifically, the API enables you to:

  • Check whether a buyer is accepted for credit before placing the order (Order intent)
  • Create orders
  • Fulfil orders (Send invoice from Two)
  • Edit orders
  • Cancel orders
  • Refund orders (Send credit note)
  • Download invoice

Below you will find a description of a typical flow of how the different endpoints are called. However, you might want to deviate from this order depending on your setup. For inspiration you can find a sample implementation of Two at https://demo.two.inc

Step 0: Use the Two Search API to find the company

By using the Two Search API, you ensure that the user places an order on behalf of the correct organization. It enables an improved user experience and lowers the friction.

Step 1: Check whether a buyer will be accepted for credit during checkout (Order intent)

Use POST /v1/order_intent to credit check your buyers during the checkout. Only enable Two as the payment option if the credit check is approved. Collect the tracking_id from the response of the order intent in order to connect the order_intent with the actual order being placed by the buyer.

Step 2: Create order

Create an order by building a request body containing all required elements and call the POST /v1/order endpoint.

  1. Read the state and status of the order response.
  2. Check if the status is APPROVED.
  3. Check if the state is UNVERIFIED, and redirect the user to the payment_url.

After completing the verfication, the user is redirected back to your order confirmation page.

Step 3: Confirm order

On the order confirmation page use the POST /v1/order/<order_id>/confirm endpoint to confirm that the user has arrived at the order confirmation page.

Step 4: Handling orders

Cancel order

Use POST /v1/order/<order_id>/cancel to cancel a specific order.

Edit order

Use PUT /v1/order/<order_id> with a specified request body to edit an order.

Fulfil order

Use POST /v1/order/<order_id>/fulfilled with a specified request body to fulfil all line items of an order.

Note: Include a request body in order to do a partial fulfillment.

Refund order

Use POST /v1/order/<order_id>/refund to refund a specific order.

Note: Include a request body in order to do a partial refund.

Environments

Company (Deprecated)

Lookup company address from external serviceDeprecated

Deprecated in favour of Company API.

Request
path Parameters
company_id
required
string

ID of the company

country_code
required
string

Country code e.g NO, GB, SE

Responses
200

Company address

default

Error response

get/v1/{country_code}/company/{company_id}/address
Request samples
Response samples
application/json
{
  • "address": null
}

Order intent

Create order intent

The endpoint enables the merchant to check in advance whether invoice payment is applicable as a payment method for the Buyer. Two will perform a risk assessment and credit check using the data provided in the OrderIntent before a boolean is returned as a result. If line_items are provided Two will be able to do a more accurate assessment and the approval rate will in general increase.

Request
Request Body schema: application/json
required
object (LaxBuyerSchema)

Fields representing the buyer. Some elements are optional. Providing optional information enables a more accurate evaluation of the buyer.

currency
required
string (Currency)

Currency code in ISO 4217 format. E.g. 'NOK'

gross_amount
required
string <decimal> (Gross Amount) ^-?[0-9]+(\.[0-9]{0,2})?

net_amount + tax_amount

InvoiceTypeEnum (string) or null
Default: null

FUNDED_INVOICE: Two will handle the invoice and transfer the funds to the merchant as per the factoring agreement. The invoice_details field will be populated by Two. DIRECT_INVOICE: Two generates and sends the invoice to the customer based on the bank account provided by the merchant, but the merchant takes the full credit and fraud risk on direct invoices and they will not receive a payout.

required
Array of objects (Line Items)

List of the line items that constitute the order.

Merchant Id (string) or Merchant Id (null) (Merchant Id)
Default: null

A globally unique merchant ID set by Two.

Merchant Short Name (string) or Merchant Short Name (null) (Merchant Short Name)
Deprecated
Default: null

Deprecated in favor of merchant_id.

OrderOriginationEnum (string) or null
Default: null

IN_STORE orders are not enabled by default. Please reach out to us if you would like to discuss IN_STORE orders.

CreateAddressRequestSchema (object) or null
Default: null

Order shipping address. Optional. Providing this information enables a more accurate evaluation of the buyer.

Responses
201

Create order intent

default

Error response

post/v1/order_intent
Request samples
application/json
{
  • "buyer": {
    },
  • "currency": "GBP",
  • "gross_amount": "120",
  • "line_items": [
    ],
  • "merchant_id": "32d8eb3f-8ac3-4aca-82b9-dbbd6f416cfb",
  • "order_origination": "ONLINE"
}
Response samples
application/json
{
  • "approved": true,
  • "buyer": {
    },
  • "currency": "GBP",
  • "decline_reason": null,
  • "gross_amount": "120.00",
  • "id": "5af5a991-8822-4b61-b892-2ffdd2931fba",
  • "invoice_type": "FUNDED_INVOICE",
  • "line_items": [
    ],
  • "merchant_id": "32d8eb3f-8ac3-4aca-82b9-dbbd6f416cfb",
  • "merchant_short_name": "tillittestuk",
  • "order_origination": "ONLINE",
  • "tracking_id": "3987eb99-f726-436a-aed1-1c77a1ceb667"
}

Get order intent

The endpoint fetches a specific order intent.

SecurityX-Api-Key
Request
path Parameters
order_intent_id
required
string
Responses
200

Get order intent

default

Error response

get/v1/order_intent/{order_intent_id}
Request samples
Response samples
application/json
{
  • "approved": true,
  • "buyer": {
    },
  • "currency": "GBP",
  • "decline_reason": null,
  • "gross_amount": "120.00",
  • "id": "5af5a991-8822-4b61-b892-2ffdd2931fba",
  • "invoice_type": "FUNDED_INVOICE",
  • "line_items": [
    ],
  • "merchant_id": "32d8eb3f-8ac3-4aca-82b9-dbbd6f416cfb",
  • "merchant_short_name": "tillittestuk",
  • "order_origination": "ONLINE",
  • "tracking_id": "3987eb99-f726-436a-aed1-1c77a1ceb667"
}

Order

Create order

Endpoint to create a new order in Two's system. Once all the required order data has been added to the request body and the order has been created successfully, Two performs a credit check of the customer and updates the status. In adition to general information about the order and its content, the response body contains the status of the credit check and payment_url which is used for customer identification. After the verification step is completed successfully, the order will change state. The order is now approved and verified, i.e. the order is placed. Later, the order has to be handled by the merchant, either through Two's API enpoints or the merchant portal. Note: When creating an order it is important to note that the invoice_type, country_prefix, and organization_number has to match what the merchant has signed up for with Two.

SecurityX-Api-Key
Request
Request Body schema: application/json
Billing Account Id (string) or Billing Account Id (null) (Billing Account Id)
Default: null

ID for the billing account attached to the order created through the Two Billing Account API.

required
CreateAddressRequestSchema (object) or null
Default: null

Order billing address

required
NonStrictBuyerSchema (object) or null
Default: null

Fields representing the buyer

Buyer Department (string) or Buyer Department (null) (Buyer Department)
Default: null

Department the purchase is to be registered on

Buyer Project (string) or Buyer Project (null) (Buyer Project)
Default: null

Project the purchase is to be registered on

Buyer Purchase Order Number (string) or Buyer Purchase Order Number (null) (Buyer Purchase Order Number)
Default: null

Purchase order number to attribute to the order

Buyer Reference (string) or Buyer Reference (null) (Buyer Reference)
Default: null

General buyer reference field for information that is not covered by the specific reference fields, e.g. PO-number. Note: Maximum 140 characters

currency
required
string (CurrencyEnum)

Currency code in ISO 4217 format. E.g. 'NOK'

Enum: "NOK" "SEK" "GBP" "EUR" "USD" "DKK" "CHF" "RON" "PLN" "CZK"
discount_amount
string <decimal> (Discount Amount) ^-?[0-9]+(\.[0-9]{0,2})?
Deprecated
Default: "0.00"

Deprecated, discount amount is only applicable at line item level

discount_rate
string <decimal> (Discount Rate) ^-?[0-9]+(\.[0-9]{0,6})?
Deprecated
Default: "0.000000"

Deprecated, discount rate is only applicable at line item level

ElectronicInvoiceRecipient (object) or null
Default: null

electronic_invoice_recipient

gross_amount
required
string <decimal> (Gross Amount) ^-?[0-9]+(\.[0-9]{0,2})?

net_amount + tax_amount

InvoiceDetailsRequestSchema (object) or null
Default: null

Invoice details are provided by the merchant via Merchant Portal when invoice_type is DIRECT_INVOICE, Two Bank or a 3rd-party bank when invoice_type is FUNDED_INVOICE and empty when invoice_type is CARD.

required
Array of objects (Line Items)

List of the line items that constitute the order

Merchant Additional Info (string) or Merchant Additional Info (null) (Merchant Additional Info)
Default: null

Additional info the merchant can connect to the order

Merchant Id (string) or Merchant Id (null) (Merchant Id)
Default: null

A globally unique merchant ID set by Two.

merchant_order_id
required
string (Merchant Order Id)

Your order ID to register against the order

Merchant Payout Account Alias (string) or Merchant Payout Account Alias (null) (Merchant Payout Account Alias)
Default: null

Optional payee account alias account identifier for multiple accounts setup.

Merchant Reference (string) or Merchant Reference (null) (Merchant Reference)
Default: null

Field set by merchant for adding a reference to be used internally by the merchant. Does not appear on invoice.

Merchant Short Name (string) or Merchant Short Name (null) (Merchant Short Name)
Deprecated
Default: null

Deprecated. Use merchant_id where possible.

OrderMerchantUrlsSchema (object) or null
Default: null

List of urls hosted by the merchant.

Merchant User Id (string) or Merchant User Id (null) (Merchant User Id)
Default: null

Your internal ID of the user (the employee of your business customer) registered for one-click purchase through the Two Trade Account Onboarding API.

net_amount
required
string <decimal> (Net Amount) ^-?[0-9]+(\.[0-9]{0,2})?

(quantity * unit_price) - discount_amount

Order Note (string) or Order Note (null) (Order Note)
Default: null

General note/message from the buyer to the merchant

OrderOriginationEnum (string) or null
Default: null

IN_STORE orders are not enabled by default. Please reach out to us if you would like to discuss IN_STORE orders.

Order Placed Date (string) or Order Placed Date (null) (Order Placed Date)
Default: null

Date order was placed (UTC). If not specified, defaults to current timestamp.

OrderTypeEnum (string) or null
Default: null

Type of order (Buyer or Merchant initiated)

Recurring (boolean) or Recurring (null) (Recurring)
Default: null

If set to true, an invoice will be generated periodically according to the specification provided in recurring_details

RecurringDetailsSchema (object) or null
Default: null

Currently not available

Sale Country Code (string) or Sale Country Code (null) (Sale Country Code)
Default: null

Optional sale country code (ISO 3166 Alpha-2) to use for this order, if null defaults to buyer country code.

required
object (CreateAddressRequestSchema)

Order shipping address

ShippingDetailsSchema (object) or null
Default: null

Optional shipping details to track the shipment

tax_amount
required
string <decimal> (Tax Amount) ^-?[0-9]+(\.[0-9]{0,2})?

net_amount * tax_rate

Array of Tax Subtotals (objects) or Tax Subtotals (null) (Tax Subtotals)
Default: null

Tax Subtotals: only used for PEPPOL compliant orders

Tracking Id (string) or Tracking Id (null) (Tracking Id)
Default: null

Tracking ID from POST /order_intent

Vendor Id (string) or Vendor Id (null) (Vendor Id)
Default: null

Optional vendor ID for your reference

Vendor Name (string) or Vendor Name (null) (Vendor Name)
Default: null

Optioanl vendor name for your reference

Responses
201

Order created

default

Error response

post/v1/order
Request samples
application/json
{
  • "billing_address": {
    },
  • "buyer": {
    },
  • "currency": "GBP",
  • "discount_amount": "0",
  • "discount_rate": "0",
  • "gross_amount": "120.00",
  • "line_items": [
    ],
  • "merchant_additional_info": "Additional line item information",
  • "merchant_order_id": "YOUR_MERCHANT_ORDER_ID",
  • "merchant_reference": "YOUR_MERCHANT_REFERENCE",
  • "merchant_urls": {
    },
  • "net_amount": "100.00",
  • "order_intent_id": "ORDER_INTENT_TRACKING_ID",
  • "shipping_address": {
    },
  • "shipping_details": {
    },
  • "tax_amount": "20.00"
}
Response samples
application/json
{
  • "billing_address": {
    },
  • "buyer": {
    },
  • "buyer_department": null,
  • "buyer_project": null,
  • "buyer_purchase_order_number": null,
  • "buyer_reference": null,
  • "credit_note_url": null,
  • "currency": "GBP",
  • "date_created": "2024-01-01 14:02:02.002222",
  • "date_fulfilled": null,
  • "date_updated": "2024-01-01 14:02:02.002222",
  • "decline_reason": null,
  • "discount_amount": "0.00",
  • "discount_rate": "0.000000",
  • "elapsed_time_ms": null,
  • "electronic_invoice_recipient": null,
  • "event_log_url": "https://tillit.ai",
  • "external_order_id": null,
  • "external_order_status": null,
  • "fixed_fee": null,
  • "gross_amount": "120.00",
  • "id": "f36cfe22-5a46-4830-a8fa-0f2d7236e269",
  • "invoice_details": {
    },
  • "invoice_insurance_provider": "NO_INSURANCE",
  • "invoice_type": "FUNDED_INVOICE",
  • "invoice_url": null,
  • "line_items": [
    ],
  • "merchant_additional_info": "Additional line item information",
  • "merchant_id": "1115e2ea-f6d2-4129-930f-3657600555ba",
  • "merchant_order_id": "YOUR_MERCHANT_ORDER_ID",
  • "merchant_payout_account_alias": null,
  • "merchant_reference": "YOUR_MERCHANT_REFERENCE",
  • "merchant_short_name": "tillit",
  • "merchant_urls": {
    },
  • "net_amount": "100.00",
  • "order_note": null,
  • "order_origination": "ONLINE",
  • "order_placed_date": "2024-01-01 14:02:02.002222",
  • "order_revision": null,
  • "order_type": "BUYER_INITIATED",
  • "original_order_id": null,
  • "parent_order_id": null,
  • "percentage_fee": null,
  • "recurring": false,
  • "recurring_details": null,
  • "refunds": null,
  • "root_order_id": null,
  • "sale_country_code": null,
  • "shipping_address": {
    },
  • "shipping_details": {
    },
  • "state": "UNVERIFIED",
  • "status": "APPROVED",
  • "tax_amount": "20.00",
  • "tax_subtotals": null,
  • "total_fee": null,
  • "tracking_id": null,
  • "vendor_id": null,
  • "vendor_name": null
}

Get order details

Endpoint to retrieve details related to a previously created order. The endpoint is typically used to check that the order has been verified successfully, in addition to other relevant state and status changes.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be retrieved

Responses
200

OK

default

Error response

get/v1/order/{order_id}
Request samples
Response samples
application/json
{
  • "billing_address": {
    },
  • "buyer": {
    },
  • "buyer_department": null,
  • "buyer_project": null,
  • "buyer_purchase_order_number": null,
  • "buyer_reference": null,
  • "credit_note_url": null,
  • "currency": "GBP",
  • "date_created": "2024-01-01 14:02:02.002222",
  • "date_fulfilled": null,
  • "date_updated": "2024-01-01 14:02:02.002222",
  • "decline_reason": null,
  • "discount_amount": "0.00",
  • "discount_rate": "0.000000",
  • "elapsed_time_ms": null,
  • "electronic_invoice_recipient": null,
  • "event_log_url": "https://tillit.ai",
  • "external_order_id": null,
  • "external_order_status": null,
  • "fixed_fee": null,
  • "gross_amount": "120.00",
  • "id": "f36cfe22-5a46-4830-a8fa-0f2d7236e269",
  • "invoice_details": {
    },
  • "invoice_insurance_provider": "NO_INSURANCE",
  • "invoice_type": "FUNDED_INVOICE",
  • "invoice_url": null,
  • "line_items": [
    ],
  • "merchant_additional_info": "Additional line item information",
  • "merchant_id": "1115e2ea-f6d2-4129-930f-3657600555ba",
  • "merchant_order_id": "YOUR_MERCHANT_ORDER_ID",
  • "merchant_payout_account_alias": null,
  • "merchant_reference": "YOUR_MERCHANT_REFERENCE",
  • "merchant_short_name": "tillit",
  • "merchant_urls": {
    },
  • "net_amount": "100.00",
  • "order_note": null,
  • "order_origination": "ONLINE",
  • "order_placed_date": "2024-01-01 14:02:02.002222",
  • "order_revision": null,
  • "order_type": "BUYER_INITIATED",
  • "original_order_id": null,
  • "parent_order_id": null,
  • "percentage_fee": null,
  • "recurring": false,
  • "recurring_details": null,
  • "refunds": null,
  • "root_order_id": null,
  • "sale_country_code": null,
  • "shipping_address": {
    },
  • "shipping_details": {
    },
  • "state": "UNVERIFIED",
  • "status": "APPROVED",
  • "tax_amount": "20.00",
  • "tax_subtotals": null,
  • "total_fee": null,
  • "tracking_id": null,
  • "vendor_id": null,
  • "vendor_name": null
}

Edit order

Endpoint to edit a previously created order which has not been fulfilled. The request body may contain changes related items, quantity, prices, etc.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be edited

Request Body schema: application/json
required
object (CreateAddressRequestSchema)

Order billing address

Buyer Department (string) or Buyer Department (null) (Buyer Department)
Default: null

The department the purchase is to be registered on

Buyer Project (string) or Buyer Project (null) (Buyer Project)
Default: null

The project the purchase is to be registered on

Buyer Purchase Order Number (string) or Buyer Purchase Order Number (null) (Buyer Purchase Order Number)
Default: null

The purchase order number the purchase should to be registered on

Buyer Reference (string) or Buyer Reference (null) (Buyer Reference)
Default: null

General buyer reference field for information that is not covered by the specific reference fields, e.g. PO-number. Note: Maximum 140 characters

currency
required
string (CurrencyEnum)

Currency code in ISO 4217 format. E.g. 'NOK'

Enum: "NOK" "SEK" "GBP" "EUR" "USD" "DKK" "CHF" "RON" "PLN" "CZK"
Discount Amount (string) or Discount Amount (null) (Discount Amount)
Deprecated
Default: null

Deprecated, discount amount is only applicable at line item level

Discount Rate (string) or Discount Rate (null) (Discount Rate)
Deprecated
Default: null

Deprecated, discount rate is only applicable at line item level

gross_amount
required
string <decimal> (Gross Amount) ^-?[0-9]+(\.[0-9]{0,2})?

net_amount + tax_amount

InvoiceDetailsRequestSchema (object) or null
Default: null

Invoice details are provided by the merchant via Merchant Portal when invoice_type is DIRECT_INVOICE, Two Bank or a 3rd-party bank when invoice_type is FUNDED_INVOICE and empty when invoice_type is CARD. Only editable for FUNDED_INVOICE orders if the order is in UNVERIFIED state.

required
Array of objects (Line Items)

List of the line items that constitute the order

Merchant Additional Info (string) or Merchant Additional Info (null) (Merchant Additional Info)
Default: null

Additional info the merchant can connect to the order

Merchant Order Id (string) or Merchant Order Id (null) (Merchant Order Id)
Default: null

Your order ID registered in your solution

Merchant Reference (string) or Merchant Reference (null) (Merchant Reference)
Default: null

Field set by merchant for adding a reference to be used internally by the merchant. Does not appear on invoice.

net_amount
required
string <decimal> (Net Amount) ^-?[0-9]+(\.[0-9]{0,2})?

(quantity * unit_price) - discount_amount

Order Note (string) or Order Note (null) (Order Note)
Default: null

General note/message from the buyer to the merchant

Recurring (boolean) or Recurring (null) (Recurring)
Default: null

If set to true, an invoice will be generated periodically according to the specification provided in recurring_details

RecurringDetailsSchema (object) or null
Default: null

Currently not available

required
object (CreateAddressRequestSchema)

Order shipping address

ShippingDetailsSchema (object) or null
Default: null

Optional shipping details to track the shipment

tax_amount
required
string <decimal> (Tax Amount) ^-?[0-9]+(\.[0-9]{0,2})?

net_amount * tax_rate

Array of Tax Subtotals (objects) or Tax Subtotals (null) (Tax Subtotals)
Default: null

'Tax Subtotals: only used for PEPPOL compliant orders'

Responses
200

OK

default

Error response

put/v1/order/{order_id}
Request samples
application/json
{
  • "billing_address": {
    },
  • "buyer_department": null,
  • "buyer_project": null,
  • "buyer_purchase_order_number": null,
  • "buyer_reference": "string",
  • "currency": "GBP",
  • "discount_amount": "0",
  • "discount_rate": "0",
  • "gross_amount": "100",
  • "invoice_details": {
    },
  • "line_items": [
    ],
  • "merchant_additional_info": "Example additional info",
  • "merchant_order_id": "02f98015-3309-48a3-8ded-ffc4285d06d0",
  • "merchant_reference": "Example reference",
  • "net_amount": "100",
  • "order_note": "Example note",
  • "recurring": false,
  • "recurring_details": null,
  • "shipping_address": {
    },
  • "shipping_details": {},
  • "tax_amount": "0",
  • "tax_subtotals": null
}
Response samples
application/json
{
  • "billing_address": {
    },
  • "buyer": {
    },
  • "buyer_department": null,
  • "buyer_project": null,
  • "buyer_purchase_order_number": null,
  • "buyer_reference": null,
  • "credit_note_url": null,
  • "currency": "GBP",
  • "date_created": "2024-01-01 14:02:02.002222",
  • "date_fulfilled": null,
  • "date_updated": "2024-01-01 14:02:02.002222",
  • "decline_reason": null,
  • "discount_amount": "0.00",
  • "discount_rate": "0.000000",
  • "elapsed_time_ms": null,
  • "electronic_invoice_recipient": null,
  • "event_log_url": "https://tillit.ai",
  • "external_order_id": null,
  • "external_order_status": null,
  • "fixed_fee": null,
  • "gross_amount": "120.00",
  • "id": "f36cfe22-5a46-4830-a8fa-0f2d7236e269",
  • "invoice_details": {
    },
  • "invoice_insurance_provider": "NO_INSURANCE",
  • "invoice_type": "FUNDED_INVOICE",
  • "invoice_url": null,
  • "line_items": [
    ],
  • "merchant_additional_info": "Additional line item information",
  • "merchant_id": "1115e2ea-f6d2-4129-930f-3657600555ba",
  • "merchant_order_id": "YOUR_MERCHANT_ORDER_ID",
  • "merchant_payout_account_alias": null,
  • "merchant_reference": "YOUR_MERCHANT_REFERENCE",
  • "merchant_short_name": "tillit",
  • "merchant_urls": {
    },
  • "net_amount": "100.00",
  • "order_note": null,
  • "order_origination": "ONLINE",
  • "order_placed_date": "2024-01-01 14:02:02.002222",
  • "order_revision": null,
  • "order_type": "BUYER_INITIATED",
  • "original_order_id": null,
  • "parent_order_id": null,
  • "percentage_fee": null,
  • "recurring": false,
  • "recurring_details": null,
  • "refunds": null,
  • "root_order_id": null,
  • "sale_country_code": null,
  • "shipping_address": {
    },
  • "shipping_details": {
    },
  • "state": "UNVERIFIED",
  • "status": "APPROVED",
  • "tax_amount": "20.00",
  • "tax_subtotals": null,
  • "total_fee": null,
  • "tracking_id": null,
  • "vendor_id": null,
  • "vendor_name": null
}

Confirm order

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be confirmed

Responses
200

OK

default

Error response

post/v1/order/{order_id}/confirm
Request samples
Response samples
application/json
{
  • "billing_address": {
    },
  • "buyer": {
    },
  • "buyer_department": null,
  • "buyer_project": null,
  • "buyer_purchase_order_number": null,
  • "buyer_reference": null,
  • "credit_note_url": null,
  • "currency": "GBP",
  • "date_created": "2024-01-01 14:02:02.002222",
  • "date_fulfilled": null,
  • "date_updated": "2024-01-01 14:02:02.002222",
  • "decline_reason": null,
  • "discount_amount": "0.00",
  • "discount_rate": "0.000000",
  • "elapsed_time_ms": null,
  • "electronic_invoice_recipient": null,
  • "event_log_url": "https://tillit.ai",
  • "external_order_id": null,
  • "external_order_status": null,
  • "fixed_fee": null,
  • "gross_amount": "120.00",
  • "id": "f36cfe22-5a46-4830-a8fa-0f2d7236e269",
  • "invoice_details": {
    },
  • "invoice_insurance_provider": "NO_INSURANCE",
  • "invoice_type": "FUNDED_INVOICE",
  • "invoice_url": null,
  • "line_items": [
    ],
  • "merchant_additional_info": "Additional line item information",
  • "merchant_id": "1115e2ea-f6d2-4129-930f-3657600555ba",
  • "merchant_order_id": "YOUR_MERCHANT_ORDER_ID",
  • "merchant_payout_account_alias": null,
  • "merchant_reference": "YOUR_MERCHANT_REFERENCE",
  • "merchant_short_name": "tillit",
  • "merchant_urls": {
    },
  • "net_amount": "100.00",
  • "order_note": null,
  • "order_origination": "ONLINE",
  • "order_placed_date": "2024-01-01 14:02:02.002222",
  • "order_revision": null,
  • "order_type": "BUYER_INITIATED",
  • "original_order_id": null,
  • "parent_order_id": null,
  • "percentage_fee": null,
  • "recurring": false,
  • "recurring_details": null,
  • "refunds": null,
  • "root_order_id": null,
  • "sale_country_code": null,
  • "shipping_address": {
    },
  • "shipping_details": {
    },
  • "state": "UNVERIFIED",
  • "status": "APPROVED",
  • "tax_amount": "20.00",
  • "tax_subtotals": null,
  • "total_fee": null,
  • "tracking_id": null,
  • "vendor_id": null,
  • "vendor_name": null
}

Renew order

Re-run credit check to renew our credit guarantee. If an external funding provider owns the order, we cancel that external order, re-create it, and update order.external_order_id on our internal order. Note that Norwegian Orders funded by Kredinor that have already been partially fulfilled cannot be renewed via our credit renewal end point.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be renewed

Responses
200

OK

201

Accepted. Order has already been renewed

400

Bad Request

default

Error response

post/v1/order/{order_id}/renew
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Cancel order

Endpoint to change the state of an order to cancelled, and void the invoice. An order cannot change state to cancelled after being fulfilled. After fulfilment the merchant will have to refund the order instead.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be cancelled

Responses
200

OK

default

Error response

post/v1/order/{order_id}/cancel
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Get fulfilled orders

This endpoint is used to fetch the associated fulfilled orders and refunds for a given order ID. If the requested order is linked to a partially fulfilled order, the endpoint returns all associated fulfilled orders.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the root order

Responses
200

OK

default

Error response

get/v1/order/{order_id}/fulfillments
Request samples
Response samples
application/json
{
  • "fulfilled_orders": [
    ],
  • "refunds": null
}

Fulfil order

Endpoint to fully or partially fulfill an order based on the line item selection and gross, net amount values. If fully fulfilled, the endpoint changes the state of an order to FULFILLED. If partial fulfilment, the endpoint changes the status of an order to PARTIAL and creates a child order with 'FULFILLED' state. Note that fulfilment is an async process may take a few minutes to realise.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be partially fulfilled

Request Body schema: application/json
optional
Invoice Issue Date (string) or Invoice Issue Date (null) (Invoice Issue Date)
Default: null
Invoice Number (string) or Invoice Number (null) (Invoice Number)
Default: null

Invoice number to be used for invoice if merchant is set up to provide own invoice numbers by Two. If not, then we will generate an auto-incremented one for you. Note this can not be set for orders in Norway.

PartialFulfillOrderSchema (object) or null
Default: null

The partially fulfilled order

Responses
200

OK

default

Error response

post/v1/order/{order_id}/fulfillments
Request samples
application/json
{
  • "invoice_issue_date": null,
  • "invoice_number": null,
  • "partial": null
}
Response samples
application/json
{
  • "fulfilled_order": {
    },
  • "remained_order": null,
  • "elapsed_time_ms": null
}

Complete partial order by cancelling

This end point will cancel any unfulfilled parts of the original root order, and in doing so will complete the order.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The root ID of the partial order to be completed/cancelled

Responses
200

OK

default

Error response

post/v1/order/{order_id}/fulfillments/complete_partial
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Fulfil order (deprecated)Deprecated

Endpoint to change the state of the order (similar to "capture" for card payment). The invoice will be issued and distributed to the customer. The endpoint changes the state of a specified order to FULFILLED.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be marked as fulfilled

Request Body schema: application/json
optional
Invoice Number (string) or Invoice Number (null) (Invoice Number)
Default: null

Invoice number to be used for invoice if merchant is set up to provide own invoice numbers by Two. If not, then we will generate an auto-incremented one for you. Note this can not be set for orders in Norway.

Responses
200

OK

default

Error response

post/v1/order/{order_id}/fulfilled
Request samples
application/json
{
  • "invoice_number": null
}
Response samples
application/json
{
  • "billing_address": {
    },
  • "buyer": {
    },
  • "buyer_department": null,
  • "buyer_project": null,
  • "buyer_purchase_order_number": null,
  • "buyer_reference": null,
  • "credit_note_url": null,
  • "currency": "GBP",
  • "date_created": "2024-01-01 14:02:02.002222",
  • "date_fulfilled": "2024-01-01 14:02:02.002222",
  • "date_updated": "2024-01-01 14:02:02.002222",
  • "decline_reason": null,
  • "discount_amount": "0.00",
  • "discount_rate": "0.000000",
  • "elapsed_time_ms": null,
  • "electronic_invoice_recipient": null,
  • "event_log_url": "https://tillit.ai",
  • "external_order_id": null,
  • "external_order_status": null,
  • "fixed_fee": "0.00",
  • "fulfilled_order": null,
  • "gross_amount": "432.00",
  • "id": "03c90e8b-9089-44fd-9c66-656620cbc2c2",
  • "invoice_details": {
    },
  • "invoice_insurance_provider": "NO_INSURANCE",
  • "invoice_type": "FUNDED_INVOICE",
  • "line_items": [
    ],
  • "merchant_additional_info": null,
  • "merchant_id": "32d8eb3f-8ac3-4aca-82b9-dbbd6f416cfb",
  • "merchant_order_id": "32d8eb3f-8ac3-4aca-82b9-dbbd6f416cfb",
  • "merchant_payout_account_alias": null,
  • "merchant_reference": null,
  • "merchant_short_name": "tillittestuk",
  • "merchant_urls": {
    },
  • "net_amount": "360.00",
  • "order_note": null,
  • "order_origination": "ONLINE",
  • "order_placed_date": "2024-01-01 14:02:02.002222",
  • "order_revision": null,
  • "order_type": "BUYER_INITIATED",
  • "original_order_id": null,
  • "other_partial_orders": null,
  • "parent_order_id": null,
  • "percentage_fee": "0.000000",
  • "recurring": false,
  • "recurring_details": null,
  • "refunds": null,
  • "remained_order": null,
  • "root_order_id": null,
  • "sale_country_code": null,
  • "shipping_address": {
    },
  • "shipping_details": null,
  • "state": "FULFILLED",
  • "status": "APPROVED",
  • "tax_amount": "72.00",
  • "tax_subtotals": null,
  • "total_fee": "0.00",
  • "tracking_id": null,
  • "vendor_id": null,
  • "vendor_name": null
}

Get list of orders

Additionally following query params can be specified to manage pagination settings limit - set limit items per page (default=100) page - page number (calculated from limit and total results) to display offset - items offset - alternative to page (pages not calculated if this param provided) Returns 401 error code if not authenticated. Returns 404 error code if merchant is not specified.

SecurityX-Api-Key
Request
query Parameters
End Date (string) or End Date (null) (End Date)
Default: null

Last date that should be included in the list of orders.

Limit (integer) or Limit (null) (Limit)
Default: null

Limit the number of results per page to this number.

Offset (integer) or Offset (null) (Offset)
Default: null

Number of offset results by (page parameter is disregarded if provided).

Page (integer) or Page (null) (Page)
Default: null

Page number to display results for.

Start Date (string) or Start Date (null) (Start Date)
Default: null

First date that should be included in the list of orders.

Responses
200

OK

default

Error response

get/v2/orders
Request samples
Response samples
application/json
{
  • "items": null,
  • "page": {
    }
}

Get order verification data

Endpoint to retrieve verification data related to an order. This endpoint is typically used by merchants to get data related to the verification links sent for an order.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order to be retrieved

Responses
200

OK

default

Error response

get/v1/order/{order_id}/verification_data
Request samples
Response samples
application/json
{
  • "link_sent": true,
  • "link_recipient_phone_number": "+46XXXXXXXXXX",
  • "link_timestamp": "2024-01-01 14:02:02.002222",
  • "link_verification_successful": null
}

Send order verification notification to buyer

Within the notification, the buyer will receive a link that they need to visit to complete their order verification.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string
Request Body schema: application/json
channel
required
string (NotificationChannel)
Enum: "sms" "email"
Responses
200

Trigger order verification notification to buyer

default

Error response

post/v1/order/{order_id}/notify
Request samples
application/json
{
  • "channel": "sms"
}
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Refund order

Endpoint to refund an order. The customer will receive a credit note with a description of the items that are credited. An order can also be partially refunded by specifying the exact items and amount that are refunded in the JSON request body.

Request
path Parameters
order_id
required
string

The ID of the order to be refunded

header Parameters
Idempotency-Key (string) or Idempotency-Key (null) (Idempotency-Key)
Default: null
Request Body schema: application/json
Any of:

Refund request

Can be either a full or a partial refund

amount
null (Amount)
Default: null

Gross amount being refunded

Value: null
Array of Buyer Refund Surcharges (objects) or Buyer Refund Surcharges (null) (Buyer Refund Surcharges)
Default: null
currency
null (Currency)
Default: null

Currency refund is being issued in

Value: null
Order Revision (string) or Order Revision (null) (Order Revision)
Default: null
Reason (string) or Reason (null) (Reason)
Default: null

Reason for order refund

Refund Reference (string) or Refund Reference (null) (Refund Reference)
Default: null
Array of Upload References (strings) or Upload References (null) (Upload References)
Default: null

references of externally uploaded credit notes

Responses
201

Refund order

default

Error response

post/v1/order/{order_id}/refund
Request samples
application/json
{
  • "amount": "100.00",
  • "currency": "GBP",
  • "reason": "Example reason"
}
Response samples
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "amount": "100.00",
  • "currency": "NOK",
  • "refund_no": 0,
  • "credit_note_number": "string",
  • "credit_note_url": null,
  • "line_items": null,
  • "reason": "Damage",
  • "tax_subtotals": null,
  • "buyer_refund_surcharges": null,
  • "refund_reference": null,
  • "refund_date": null
}

Create Web client data

Endpoint for merchants to provide data about a user's browser and client. Once the required WebClientData has been added to the request body and the resource has been created successfully, a tracking_id is returned which the merchant should pass along when they create an order later.

SecurityX-Api-Key
Request
Request Body schema: application/json
WebClientFingerprint (object) or null
Default: null
Http Method (string) or Http Method (null) (Http Method)
Default: null
ip_address
required
string (Ip Address)
User Agent (string) or User Agent (null) (User Agent)
Default: null
Responses
201

Endpoint for providing web client data.

default

Error response

post/v1/web_client_data
Request samples
application/json
{
  • "ip_address": "string",
  • "user_agent": null,
  • "http_method": null,
  • "fingerprint": null
}
Response samples
application/json
{
  • "tracking_id": "string"
}

Invoice

Fetch invoice details

Return an object representing the current status of an invoice, including payment status.

SecurityX-Api-Key
Request
path Parameters
order_id
required
string

The ID of the order being queried

Responses
200

OK

404

Order not found

409

Order not invoiced

default

Error response

get/v1/order/{order_id}/invoice_details
Request samples
Response samples
application/json
{
  • "billing_period_id": "75bbbadc-95b0-4b4e-bade-3641204a135c",
  • "due_date": "2024-01-31",
  • "due_in_days": "30",
  • "gross_amount": "200.00",
  • "id": "ac8f7621-3214-478b-84ad-3f7ada4df83a",
  • "invoice_number": "string",
  • "invoicing_group_id": "string",
  • "last_updated": "2023-07-07T13:00:25.552211",
  • "net_amount": "160.00",
  • "payee": {
    },
  • "payment_reference": "string",
  • "payment_reference_message": "string",
  • "payment_reference_ocr": "string",
  • "payment_reference_type": "string",
  • "statement_number": "123",
  • "tax_amount": "40.00",
  • "total_collected_amount": "0.00",
  • "total_credited_amount": "0.00",
  • "total_paid_amount": "0.00",
  • "total_recoursed_amount": "0.00",
  • "unpaid_amount": "200.00"
}

Download PDF invoice via Order ID

Endpoint to fetch the invoice for a fulfilled order using the global order ID. The order ID is returned as part of the create order response and is under the key of id at the highest level of the JSON response.

Request
path Parameters
order_id
required
string

The order id of a fulfilled order

query Parameters
Generate (boolean) or Generate (null) (Generate)
Default: "false"

Optional parameter generate (defaults to false) to help with testing or the need to re-create if the template changes etc

Lang (string) or Lang (null) (Lang)
Default: null

Specify language to generate PDF [en_US, nb_NO, sv_SE]

V (string) or V (null) (V)
Default: null

Optional parameter v=original to download the original invoice and not the credit note (if any)

Responses
200

OK

default

Error response

get/v1/invoice/{order_id}/pdf
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Download PDF Invoice via Invoice ID

Endpoint to fetch the invoice for a fulfilled order by using the global invoice ID. The invoice ID is provided in the response as part of the invoice_details object with field id.

Request
path Parameters
invoice_id
required
string

The id of an invoice connected to a fulfilled order

Responses
200

OK

default

Error response

get/v1/invoice/{invoice_id}/document
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Download PDF Invoices in a zip file

Only fulfilled orders can have invoices.

SecurityX-Api-Key
Request
query Parameters
Generate (boolean) or Generate (null) (Generate)
Default: "false"

Optional parameter generate (defaults to false) to help with testing or the need to re-create if the template changes etc

Lang (string) or Lang (null) (Lang)
Default: null

Specify language to generate PDF [en_US, nb_NO, sv_SE]

order_id
required
string <uuid> (Order Id)

Order IDs of the invoices, provided multiple times as a query parameter

V (string) or V (null) (V)
Default: null

Optional parameter v=original to download the original invoice and not the credit note (if any)

Responses
200

OK

default

Error response

get/v1/invoice/pdfs
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Change an invoice post fulfillment

This will credit note the current invoice and create a new invoice, with new invoice number, with the requested fields updated. This will not work for overdue invoices or invoices with a status of NOT_PAID.

SecurityX-Api-Key
Request
path Parameters
invoice_id
required
string
Request Body schema: application/json
CreateAddressRequestSchema (object) or null
Default: null

Order billing address

Buyer Project (string) or Buyer Project (null) (Buyer Project)
Default: null

New value for buyer project on order

Buyer Purchase Order Number (string) or Buyer Purchase Order Number (null) (Buyer Purchase Order Number)
Default: null

Order purchase number being edited

Buyer Reference (string) or Buyer Reference (null) (Buyer Reference)
Default: null

New value for buyer reference on order

Array of Line Item Updates (objects) or Line Item Updates (null) (Line Item Updates)
Default: null

Changes to existing line items

Order Note (string) or Order Note (null) (Order Note)
Default: null

Notes associated with invoice edit

Responses
200

OK

default

Error response

patch/v1/invoice/{invoice_id}
Request samples
application/json
{
  • "buyer_purchase_order_number": null,
  • "buyer_reference": null,
  • "order_note": null,
  • "buyer_project": null,
  • "billing_address": null,
  • "line_item_updates": null
}
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

API Key

Create API key

Create a new API key. An existing API key is required to authenticate the request. If you do not have an API key yet, this can be obtained from the merchant portal integration panel. Note that production API key is only available after a manual review once onboarding and integration is complete. The existing key will remain valid until it is revoked.

SecurityX-Api-Key
Request
path Parameters
merchant_id
required
string

Merchant ID

Responses
201

API key schema

403

Access denied

404

Merchant not found

default

Error response

post/v1/merchant/{merchant_id}/api_key
Request samples
Response samples
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "hint": "string",
  • "label": "string",
  • "date_created": "2019-08-24T14:15:22Z",
  • "date_last_used": null,
  • "date_expiry": null,
  • "usage_count": 0,
  • "merchant_id": "500924a8-3f5e-4c00-beb8-2efcde988aea",
  • "api_key": "string"
}

Retrieve API keys

Retrieve a list of metadata associated with active API keys.

SecurityX-Api-Key
Request
path Parameters
merchant_id
required
string

Merchant ID

Responses
200

List of API key metadata

404

Merchant not found

default

Error response

get/v1/merchant/{merchant_id}/api_key
Request samples
Response samples
application/json
[
  • {
    }
]

Retrieve API key

Retrieve metadata related to an active API key.

SecurityX-Api-Key
Request
path Parameters
api_key_id
required
string

API Key ID

merchant_id
required
string

Merchant ID

Responses
200

API key metadata

404

Merchant or API key not found

default

Error response

get/v1/merchant/{merchant_id}/api_key/{api_key_id}
Request samples
Response samples
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "hint": "string",
  • "label": "string",
  • "date_created": "2019-08-24T14:15:22Z",
  • "date_last_used": null,
  • "date_expiry": null,
  • "usage_count": 0,
  • "merchant_id": "500924a8-3f5e-4c00-beb8-2efcde988aea"
}

Revoke API key

Revoke an existing API key. Once revoked, the key will stop working for subsequent requests.

SecurityX-Api-Key
Request
path Parameters
api_key_id
required
string

API Key ID

merchant_id
required
string

Merchant ID

Responses
200

API key deleted successfully

403

Access denied

404

Merchant not found

default

Error response

delete/v1/merchant/{merchant_id}/api_key/{api_key_id}
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Settlement report

Download settlement report for a specified period

Endpoint for downloading Two settlement report from start_date to end_date as .xlsx or .csv.

SecurityX-Api-Key
Responses
200

Two settlement report for a specified period.

400

Bad request.

default

Error response

get/v1/portal/merchant/statement
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Download settlement report by its ID

Endpoint for downloading Two settlement report by settlement ID as .xlsx or .csv.

SecurityX-Api-Key
Request
query Parameters
Filetype (string) or Filetype (null) (Filetype)
Default: "xlsx"

The filetype of the statement file. Two currently supports csv and xlsx as value for the filetype parameter. Default is xlsx.

Settlement Id (string) or Settlement Id (null) (Settlement Id)
Default: null

The ID of the settlement that belongs to the merchant.

Responses
200

Two settlement report for a specified period.

400

Bad request.

default

Error response

get/v1/portal/merchant/statement-by-settlement-id
Request samples
Response samples
application/json
{
  • "error_code": null,
  • "error_details": null,
  • "error_message": null,
  • "error_json": null,
  • "error_trace_id": null
}

Get list of settlements for merchant.

SecurityX-Api-Key
Responses
200

List of recent payouts from Two

400

Bad request.

default

Error response

get/v1/portal/merchant/settlements
Request samples
Response samples
application/json
{
  • "items": [
    ],
  • "page": {
    }
}