Introduction
This guide explains the essential steps and concepts for developers integrating Two's services directly via our API. A successful integration hinges on understanding key aspects of the Two ecosystem:
- Proactive Credit Assessment with Order Intent: How to gauge creditworthiness before creating an order.
- Order
status
: How Two evaluates credit for an order. - Order
state
: How an order progresses through necessary verification steps. - Post-Verification Actions: Optional steps and rules for managing verified orders.
- Order Fulfilment: The final step to complete the order and trigger invoicing.
Let's explore these in detail.
Proactive Credit Assessment with Order Intent
Before creating an order, you can proactively assess a buyer's potential creditworthiness using the POST v1/order_intent endpoint. This step is highly recommended as it can enhance the buyer experience, reduce unnecessary API calls, and provide an early indication of Two's likelihood to approve credit for a potential order.The Order Intent endpoint allows you to submit key details about the prospective buyer and order. In return, Two provides an assessment, typically indicating if the intent isapproved
. This is a strong signal, though not a final guarantee, of credit approval.Using Order Intent can help you:
- Optimize API Usage: Avoid creating full orders if the initial credit assessment is unfavorable.
- Improve Buyer Experience: Provide earlier feedback to buyers regarding their ability to use Two for a purchase.
- Streamline Decision Making: Get a quick credit signal before committing to the full order creation process.
Pillar 1: Order status
– The Credit Decision
When you create an order with Two using the POST v1/order
endpoint, our system performs an immediate, real-time credit check on the buyer's company specified in your API request. The API response will include a status
field, which reflects Two's credit decision for that order.The status
field can be:APPROVED
: Indicates Two can provide credit for this particular order.REJECTED
: Signifies Two cannot offer a credit guarantee for the order amount at this time.
status
is APPROVED
. An APPROVED
status is your assurance that Two will back the credit for this order, making it "fulfillable" (Two's term for an order ready for completion).Pillar 2: Order state
– The Verification Journey
Once an order is credit-approved (i.e., its status
is APPROVED
), the next critical field to monitor is its state
. This field, also returned in the API response when an order is created, tracks the order's progression through the necessary verification steps.Initial State: UNVERIFIED
Every new order created with Two automatically starts with a state
of UNVERIFIED
.The Goal: Achieving VERIFIED
State
Even if an order has an APPROVED
credit status
, it cannot be fulfilled until its state
transitions from UNVERIFIED
to VERIFIED
. This transition requires the buyer's representative (as defined in your order creation request) to complete an active verification step with Two.Standard Verification Process (Buyer-Interactive Flow)
Here’s the most direct way to facilitate verification in a typical checkout experience where the buyer is present:
- Create the Order: Submit the order details via the POST v1/order endpoint.
- Use the
payment_url
: The API response for a successful order creation will contain apayment_url
field. You must redirect the buyer's representative to this Payment URL.
payment_url
leads to a unique, Two-hosted page where the buyer completes the required verification steps. Successfully completing this process automatically updates the order's state
from UNVERIFIED
to VERIFIED
.Managing the payment_url
- Activation and Lifespan: The
payment_url
becomes active once it's first opened and remains valid for 24 hours. - Expiration: If a buyer attempts to use an opened
payment_url
after this 24-hour window, the verification will fail, and the order'sstate
will not change. - Renewal: Should the
payment_url
expire or if a new one is needed for any reason (e.g., the user closed the page and lost the link), you can obtain a fresh, unactivatedpayment_url
by making a GET v1/order/<order_id> request for that specific order. This new link will also have a 24-hour active window once opened.
Verification Methods Employed by Two
Upon visiting thepayment_url
, the buyer's representative will be prompted to complete a verification step. The specific method Two employs (e.g., a One-Time Password (OTP) sent via SMS/email, or an Open Banking check) is determined dynamically by Two's risk assessment. This assessment considers factors such as the representative's details, the buyer's company profile, and the order amount.Redirecting the User After Verification (merchant_urls
)
You can control where the user is redirected after interacting with the payment_url
page by setting URLs in the merchant_urls
object during the initial order creation. While the merchant_urls
object can accommodate various case-specific URLs, for most practical purposes, you primarily need to provide:merchant_confirmation_url
: After the buyer successfully completes the verification, they are automatically redirected here. Use this to guide them to an appropriate page on your site (e.g., an order confirmation page).merchant_cancel_order_url
: If the buyer chooses to click a "cancel" action on Two'spayment_url
page, they will be redirected to this URL.
merchant_urls
, refer to the create order request schema here.Handling Buyer-Initiated Cancellation on payment_url
Page
Important: If a buyer is redirected to your merchant_cancel_order_url
(because they clicked "cancel" on the Two verification page), Two does not automatically change the order's state
from UNVERIFIED
to CANCELLED
. The order will remain UNVERIFIED
. This design gives you, the merchant, the flexibility to manage such situations—for instance, if the buyer made a mistake and wishes to retry the verification, or if you have a different internal workflow for such cases.Automatic Order Cancellation by Two (Timeout)
If an order remains in anUNVERIFIED
state
for more than 48 hours after its creation, Two will automatically cancel it.- Result: The order's
state
will change toCANCELLED
. - Consequence: Any subsequent attempts to verify the order using its
payment_url
will be unsuccessful. - Confirming Auto-Cancellation: You can confirm this by fetching the order using its global Two order
id
; the API response will reflect the updatedCANCELLED
state.
Therefore, it is crucial to ensure that if you intend to progress an order for a credit-approved buyer, they complete the verification process within the 48-hour window following order creation.
Alternative Verification Scenarios (Asynchronous/Remote)
The standard process described above outlines the most common verification path, where the buyer is present and can be immediately redirected to thepayment_url
(e.g., during an e-commerce checkout).However, some integrations or operational needs may require asynchronous or remote verification. Common examples include:
- Administrator-Initiated Orders: A service administrator creates a Two order on behalf of a buyer. The buyer then needs to receive the verification request and complete it independently.
- In-Store POS Orders: A Two order is created through an in-store Point of Sale (POS) system. The buyer needs to complete the verification on their personal device (e.g., smartphone) to progress the order.
For these asynchronous or remote verification needs, Two provides a dedicated solution:
Using the POST v1/order/<order_id>/notify
Endpoint
You can use the POST v1/order/<order_id>/notify endpoint to send a direct verification notification to the intended buyer for a specific order.- How it works: You specify the desired communication channel (SMS or email) in the API request body.
- Outcome: Upon a successful API call, Two issues the notification directly to the buyer.
- Buyer Action: The buyer receives a message containing a unique link. Clicking this link takes them to the Two verification page where they can complete the necessary steps, similar to using the
payment_url
.
This method allows you to decouple the order creation from the immediate, on-screen verification, providing flexibility for various business workflows.
Pillar 3: Post-Verification Considerations and Actions
Once an order'sstate
is VERIFIED
, it's ready for fulfilment. However, there are a couple of additional considerations: an optional merchant-driven confirmation step and the rules around editing verified orders.Optional Step: The CONFIRMED
State
After an order is VERIFIED
(and the buyer, if applicable, has been redirected to your merchant_confirmation_url
), you have the option to transition it to a CONFIRMED
state.- Purpose: The
CONFIRMED
state is primarily for your internal tracking and operational workflows. It allows you, as the merchant, to explicitly acknowledge that the order has passed a certain checkpoint in your process post-Two verification (e.g., confirming the buyer successfully landed on your confirmation page). - Merchant-Driven: Unlike the
VERIFIED
state, which Two sets automatically upon successful buyer verification, theCONFIRMED
state is triggered by you via an API call. - How to Trigger: To move a
VERIFIED
order toCONFIRMED
, you use the POST v1/order/<order_id>/confirm endpoint. The order must be in aVERIFIED
state before you can do this. - Common Use Case: A typical scenario is to call this endpoint after your system detects that the buyer has successfully reached your
merchant_confirmation_url
. Since Two only redirects to this URL upon successful verification, a buyer landing there is a strong indicator of a successful Two verification. Using theCONFIRMED
state can add an extra layer to your tracking.
CONFIRMED
is optional. A VERIFIED
order can be directly fulfilled without ever entering the CONFIRMED
state.Modifying Orders: Pre and Post-Verification
The ability to edit an order (e.g., change line items, quantities, or total amounts) is significantly different before and after itsstate
becomes VERIFIED
.Editing UNVERIFIED
Orders
- Flexibility: Before an order is
VERIFIED
, you have more flexibility to modify its details. - Credit Re-evaluation: If you change the order amount (either by increasing or decreasing it), Two will re-evaluate the credit
status
.- If the new amount is still within the buyer's credit limit, the
status
will remainAPPROVED
. - If an increase pushes the order amount beyond the buyer's credit limit, the
status
may change toREJECTED
.
- If the new amount is still within the buyer's credit limit, the
Editing VERIFIED
Orders
Once an order's state
is VERIFIED
, the original credit approval (status
: APPROVED
) is tied to the specific order amount at the time of verification.- Decreasing Order Amount: Generally, you can make changes that decrease the total order amount (e.g., reducing quantity, lowering a price). Such changes usually retain the
APPROVED
status. - Increasing Order Amount: It is strongly discouraged to make changes that increase the total order amount on a
VERIFIED
order. This is highly likely to result in the order'sstatus
changing toREJECTED
, as the original credit approval did not cover the higher amount.
Best Practice for Order Adjustments:
- Finalize Before Verification: Aim to finalize all order details (items, quantities, prices) before the buyer completes the verification process and the order becomes
VERIFIED
. - Post-Verification Reductions: If adjustments are needed after verification, limit them to those that reduce the total order value.
- Post-Verification Increases: If the order amount needs to be increased after verification, the safest approach is to cancel the existing
VERIFIED
order (if your policy allows and before fulfilment) and create a new order with the correct details. This new order will then go through the standard credit check and verification process.
This approach ensures that you always have a valid credit approval for the order amount you intend to fulfil.
Pillar 4: Order Fulfilment – Completing the Process
Once an order isVERIFIED
(and, if applicable, CONFIRMED
), the final step to complete the order lifecycle and secure your payout is fulfilment.What is Fulfilment in Two?
In the Two ecosystem, fulfilment signifies that you are ready to complete the order, which in turn triggers Two to issue the final invoice to the buyer and arrange your payout.
Up to this point, aVERIFIED
order confirms:- Two has approved credit for the order amount.
- The buyer's identity has been successfully verified.
However, no invoice has been issued to the buyer, nor has a payout been initiated to you, the merchant.
Triggering Fulfilment
To generate the final invoice and start the buyer's payment term window (e.g., pay in 30, 60, or 90 days), you must initiate the fulfilment action. This is a merchant-triggered process using the POSTv1/order/<order_id>/fulfillments
endpoint.This guide focuses on standard, full fulfilment. For details on fulfilling orders in parts, please refer to our the fulfillments endpoint.
The Fulfilment States: FULFILLING
to FULFILLED
- API Call: When you call the
POST v1/order/<order_id>/fulfillments
endpoint for aVERIFIED
order. - Transition to
FULFILLING
: Upon a successful API call, the order'sstate
transitions toFULFILLING
. The API response will include the updated order schema reflecting this.FULFILLING
is an interim, transitional state.
- Automatic Transition to
FULFILLED
: Two runs a continuous batch job that processes orders in theFULFILLING
state. An order in theFULFILLING
state is guaranteed to progress toFULFILLED
once this batch job processes it. - Order Complete (
FULFILLED
): When the order'sstate
becomesFULFILLED
:- The order is considered complete from Two's perspective.
- An automated invoice email, including a PDF invoice, is sent to the buyer representative's email address.
- Your payout for this invoice amount will be processed according to your agreed payout cycle.
- The buyer's repayment term window begins.
This completes the "happy path" for an order processed through Two.
Conclusion
Successfully integrating Two's order creation and processing workflow hinges on carefully managing the orderstatus
(for credit approval) and its state
(for verification and fulfilment progress). By understanding the lifecycle of an order—from initial creation and credit assessment (Pillar 1), through the various verification paths like the direct payment_url
or the POST v1/order/<order_id>/notify
mechanism (Pillar 2), considering post-verification actions and order modification rules (Pillar 3), and finally, executing fulfilment to complete the order and trigger invoicing (Pillar 4)—you can build robust, reliable, and user-friendly purchasing experiences with Two. Always ensure you are monitoring these key fields and adhering to the specified time windows and procedures for a seamless integration.