Download OpenAPI specification:Download
This API is designed for the purpose of creating and managing repayment accounts and repayment plans.
A repayment account stores the billing details of buyers, which are used to issue invoices and follow up for incoming payments.
A business can have one or multiple repayment accounts, each of which should have a corresponding account record in the merchant's system.
A repayment plan represents the receivable purchased from merchants and is expected to be paid by buyers over time. It is a collection of instalments, and the instalments of different repayment plans can be invoiced together.
The Repayment Plans fulfilled via this API will be invoiced and distributed to the Buyers the following 3-36 months.
Instalments created by the same merchant for the same repayment account will be invoiced together, typically on the 1st day of each calendar month, to allow Buyers to pay them together with a single payment.
You will receive a net payout from us upon fulfilment of the repayment plan, at the end of your negotiated payout cycle.
POST /account
endpointbuyer_company
if you would like each to receive seperate invoices. POST /credit-check
endpointThis step is optional: You might want to show a breakdown of one or more tentative repayment plans to your buyer before they commit to one of them.
POST /preview
endpointPOST /plan
endpoint :GET /status
endpoint until the API responds with an "Accepted" or "Rejected" funding decisionPUT /fulfilment
endpoint you will finalise the repayment plan and initiate the payout processOnly available in sandbox
This endpoint can be called to trigger invoice generation and distribution with a specified cut off date in sandbox and can be used to test invoicing behaviour when integrating with the API. Normal invoicing rules will run and factor in:
The endpoint will trigger invoicing as if it is running on the specified cut off date. This means it will identify any instalments with an invoicing date between today and the given cut off date (inclusive) and generate invoices for those instalments according to the factors mentioned above.
As the invoicing process is asynchronous, there will be a short delay after hitting this endpoint before invoices are distributed. This delay will typically be 2 minutes.
Successful Response
Forbidden
Not Found
Validation Error
{- "account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
- "cut_off": "2019-08-24",
- "invoice_grouping_key": "string"
}
{- "invoice_ids": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}
Create a new repayment plan.
Successful Response
Created
Validation Error
{- "reference": "string",
- "description": "string",
- "total_repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
], - "currency": "DKK",
- "consent_date": "2019-08-24",
- "line_items": [
- {
- "name": "string",
- "description": "string",
- "product_identifiers": [
- {
- "value": "string",
- "identifier_type": "EAN"
}
], - "unit_price_amount": "string",
- "unit_discount_amount": "string",
- "tax_rate": "string",
- "tax_class_name": "string",
- "quantity": "string",
- "quantity_unit_name": "string",
- "line_item_type": "DIGITAL"
}
], - "account_id": "string",
- "buyer_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "shipping_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "string"
}, - "terms": {
- "period": "YEARLY",
- "number_of_periods": 1,
- "start_month": 1
}
}
{- "id": "string",
- "reference": "string",
- "description": "string",
- "total_repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
], - "currency": "DKK",
- "consent_date": "2019-08-24",
- "line_items": [
- {
- "name": "string",
- "description": "string",
- "product_identifiers": [
- {
- "value": "string",
- "identifier_type": "EAN"
}
], - "unit_price_amount": "string",
- "unit_discount_amount": "string",
- "tax_rate": "string",
- "tax_class_name": "string",
- "quantity": "string",
- "quantity_unit_name": "string",
- "line_item_type": "DIGITAL"
}
], - "account_id": "string",
- "buyer_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "shipping_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "string"
}, - "terms": {
- "period": "YEARLY",
- "number_of_periods": 1,
- "start_month": 1
}, - "invoice_grouping_key": "string",
- "instalments": [
- {
- "id": "string",
- "reference": "string",
- "invoice_issue_date": "2019-08-24",
- "description": "string",
- "repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
]
}
]
}
{- "id": "string",
- "reference": "string",
- "description": "string",
- "total_repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
], - "currency": "DKK",
- "consent_date": "2019-08-24",
- "line_items": [
- {
- "name": "string",
- "description": "string",
- "product_identifiers": [
- {
- "value": "string",
- "identifier_type": "EAN"
}
], - "unit_price_amount": "string",
- "unit_discount_amount": "string",
- "tax_rate": "string",
- "tax_class_name": "string",
- "quantity": "string",
- "quantity_unit_name": "string",
- "line_item_type": "DIGITAL"
}
], - "account_id": "string",
- "buyer_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "shipping_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "string"
}, - "terms": {
- "period": "YEARLY",
- "number_of_periods": 1,
- "start_month": 1
}, - "invoice_grouping_key": "string",
- "instalments": [
- {
- "id": "string",
- "reference": "string",
- "invoice_issue_date": "2019-08-24",
- "description": "string",
- "repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
]
}
]
}
Update repayment plan.
Successful Response
Not Found
Validation Error
{- "invoice_grouping_key": "string"
}
{- "description": "string",
- "code": "ERROR"
}
{- "funding_status": "PENDING",
- "fulfilment_status": "NOT_INITIATED",
- "cancelled_amount": "string",
- "invoiced_amount": "string",
- "total_repayment_amount": "string",
- "on_recourse": true,
- "credit_decline_reason": "string",
- "recourse_decline_reason": "string"
}
Successful Response
Validation Error
{- "plan_id": "string",
- "instalments": [
- {
- "instalment_id": "string",
- "invoice_details": {
- "invoice_id": "string",
- "gross_amount": "string",
- "net_amount": "string",
- "tax_amount": "string",
- "invoice_issue_date": "2019-08-24",
- "payment_reference": "string",
- "payment_status": "string",
- "total_paid_amount": "string",
- "total_credited_amount": "string",
- "total_collected_amount": "string",
- "total_recoursed_amount": "string",
- "unpaid_amount": "string"
}, - "last_updated": "2019-08-24T14:15:22Z"
}
]
}
Successful Response
Validation Error
{- "cancelled_at": "2019-08-24T14:15:22Z",
- "cancel_reason": "TERMINATED"
}
{- "id": "string",
- "cancelled_at": "2019-08-24T14:15:22Z",
- "cancelled_repayment_amount": "string",
- "currency": "DKK",
- "cancel_reason": "TERMINATED"
}
Requests that Two marks the repayment plan as fulfilled.
This endpoint will submit a request for Two to mark the repayment plan as fulfilled (the HTTP 202 response code
indicates that Two has successfully received the request to fulfil this repayment plan). Note that fulfilment in
Two's systems will happen asynchronously, so your integration should check the repayment plan fulfilment_status
using the repayment plan status endpoint before marking the repayment plan as fulfilled (or fulfilled by Two) in
your own system.
fulfilment_status
in the repayment plan
status endpoint will show as NOT_INITIATED
.fulfilment_status
will be marked as PENDING
.fulfilment_status
will be SUCCEEDED
.fulfilment_status
to show as FAILED
if the credit decision for the plan has expired and Two
has reassessed the buyer for this plan and can no longer support this repayment plan.Successful Response
Validation Error
{- "invoice_grouping_key": "string"
}
null
Request a preview of a repayment plan based on key features of a plan including term length and total amount.
Successful Response
Validation Error
{- "total_repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
], - "terms": {
- "period": "YEARLY",
- "number_of_periods": 1,
- "start_month": 1
}
}
{- "terms": {
- "period": "YEARLY",
- "number_of_periods": 1,
- "start_month": 1
}, - "instalments": [
- {
- "repayment_amount": "string",
- "invoice_issue_date": "2019-08-24",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
]
}
], - "total_repayment_amount": "string",
- "tax_subtotals": [
- {
- "tax_rate": "string",
- "taxable_amount": "string",
- "tax_amount": "string"
}
]
}
{- "description": "string"
}
{- "detail": [
- {
- "loc": [
- "string"
], - "msg": "string",
- "type": "string"
}
]
}
Creates a repayment account for use with repayment plan invoicing.
When a repayment plan is created, an existing repayment account must be referenced. Then, whenever an instalment is invoiced the referenced repayment account is used to determine the billing details for the invoice. Updating a repayment account will affect subsequent invoices only.
Successful Response
Created
Validation Error
{- "buyer_company": {
- "trade_name": "string",
- "official_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "country_code": "AT",
- "national_identifier": "string"
}, - "billing_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "invoice_email": "user@example.com",
- "invoice_cc_emails": [
- "user@example.com"
], - "account_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "due_in_days": 0
}
{- "id": "string",
- "buyer_company": {
- "trade_name": "string",
- "official_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "country_code": "AT",
- "national_identifier": "string"
}, - "billing_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "invoice_email": "user@example.com",
- "invoice_cc_emails": [
- "user@example.com"
], - "account_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "due_in_days": 0
}
{- "id": "string",
- "buyer_company": {
- "trade_name": "string",
- "official_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "country_code": "AT",
- "national_identifier": "string"
}, - "billing_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "invoice_email": "user@example.com",
- "invoice_cc_emails": [
- "user@example.com"
], - "account_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "due_in_days": 0
}
Update the payment account information using the Two repayment_account_id
.
As was stated when creating a payment account, it is strongly encouraged that the repayment accounts correspond to existing accounts of your buyers in your system, so that Buyers have a place to change their contact details. You are expected to provide the buyer company's national id and address, which you can easily get from Step 1.
Note that the due_in_days field can only be updated before any repayment plans have been fulfilled, otherwise a 409 error will be returned.
Successful Response
Conflict
Validation Error
{- "buyer_company": {
- "trade_name": "string",
- "official_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}
}, - "billing_address": {
- "address_line_1": "string",
- "address_line_2": "string",
- "city": "string",
- "region": "string",
- "postal_code": "string",
- "country_code": "AT"
}, - "invoice_email": "user@example.com",
- "invoice_cc_emails": [
- "user@example.com"
], - "account_representative": {
- "first_name": "string",
- "last_name": "string",
- "phone_number": "string",
- "email": "user@example.com"
}, - "due_in_days": 0
}
{- "description": "string",
- "code": "ERROR"
}
Retrieve the URL of the invoice PDF for the given invoice ID.
Successful Response
Forbidden
Not Found
Validation Error
{- "url": "string"
}
Successful Response
Forbidden
Not Found
Validation Error
{- "invoice_id": "string",
- "gross_amount": "string",
- "net_amount": "string",
- "tax_amount": "string",
- "invoice_issue_date": "2019-08-24",
- "payment_reference": "string",
- "payment_status": "string",
- "total_paid_amount": "string",
- "total_credited_amount": "string",
- "total_collected_amount": "string",
- "total_recoursed_amount": "string",
- "unpaid_amount": "string"
}
Use the POST /credit-check
endpoint to evaluate the funding eligibility of a buyer based on the total value of a
prospective instalment plan and the frequency of invoicing for a prospective plan.
The API responds with the conditions under which Two can approve the funding, including the maximum and minimum terms, as well as the maximum amount that can be offered per term (such as monthly).
Successful Response
Validation Error
{- "country_code": "AT",
- "national_identifier": "string",
- "company_name": "string",
- "amount": "string",
- "currency": "GBP",
- "instalment_period": "MONTHLY"
}
{- "minimum_instalments": 0,
- "maximum_instalments": 0,
- "maximum_instalment_amount": "string",
- "decision": "APPROVED",
- "currency": "DKK"
}