2. Integrate into Checkout

Now, let’s show Titus as a payment option within the checkouts of connected businesses.

1. Surface Titus as a payment optionCopied!

There are a number of ways you can introduce Titus as a payment method including:

  • Adding Titus as a payment option in a multi-select next to your existing payment methods, and then when the customer submits the order with Titus selected as a payment method, calling the Titus API to create a checkout session

  • Introducing Titus as a payment button that when clicked on the calls the Titus API to create a checkout session

See Design Guidance for more detail

2. Create a CheckoutCopied!

When a customer chooses to pay with Titus, your backend should call the Titus API to create a checkout session.

As with all requests, this must be done server-side to protect your API key.

Example

const response = await fetch('https://api.gotitus.com/v1/checkouts', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_TITUS_API_KEY',
  },
  body: JSON.stringify({
    orderId: 'order_123', // the order or invoice number in your system
    externalId: 'biz_abc', // the id of the business/vendor in your system
    amount: 1500.00,
    description: 'Description of payment',
    successUrl: 'https://yourapp.com/order/order_123/complete',
    cancelUrl: 'https://yourapp.com/order/order_123/cancel',
  }),
});

const { checkoutUrl } = await response.json()

This returns a checkoutUrl. You’ll redirect the customer to the checkoutUrl in the next step.

3. Redirect the customerCopied!

Once you've created a checkout, redirect the customer to the checkoutUrl returned by the Titus API.

This URL will take the user to a secure, Titus-hosted flow where they will:

  • Log in

  • Apply for or confirm financing

  • Complete the payment

  • Be redirected back to your successUrl or cancelUrl

You must not treat the redirect alone as confirmation of payment; always verify the payment via webhook events or API requests. In some cases the user may need to await manual financing approval before they can complete their payment.

4. Handle webhook events to track payment statusCopied!

Titus will trigger a checkout.created event when a new checkout is initiated, and a checkout.updated event each time the checkout is modified. Use these webhooks events to track the outcome of the payment and update your internal order records.

Example Webhook Payload

{
  "type": "checkout.updated",
  "payload": {
    "id": "chk_456",
    "orderId": "order_123",
    "status": "succeeded",
    ...
  }
}

Use the orderId to correlate with your internal system.

The checkout will transition through multiple statuses:

  • requires-payment : the customer has not initiated payment, is applying for financing, or payment failed and they need to reattempt with a new payment.

  • processing: the payment is initiated and pending.

  • succeeded: the payment has completed successfully and the vendor has now received funds.

  • canceled : the checkout has been canceled (typically this is the result of your platform creating a new checkout and the previous being auto-canceled). The checkout is not canceled when the user is redirected to the cancelUrl.

Now, your onboarded businesses are ready to accept Titus as a payment method! Next, we’ll add a browser SDK you can introduce earlier in the flow to make customers aware they can pay with Titus.