2. Integrate into Checkout
Show Titus as a payment option in your checkout. When the customer picks it, your server calls Titus API to create a checkout and you redirect the customer to Titus to pay.
1. Surface Titus as a payment option
When the customer chooses Titus, your server calls POST /v1/checkouts and redirects the customer to the returned checkoutUrl. Steps 2 and 3 cover both calls.
Design note: you can show Titus as an option in a multi-select next to your other payment methods and create the checkout when the customer submits the order. Or you can add a separate Titus payment button that creates the checkout when clicked. See Design Guidance.
2. Create a checkout
Call POST /v1/checkouts from your server with the staging API key and base URL from 1. Set Up. Never call the API from the browser, because that would expose your API key.
Example
const response = await fetch(`${process.env.TITUS_API_BASE_URL}/v1/checkouts`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.TITUS_API_KEY,
},
body: JSON.stringify({
orderId: order.id, // the order or invoice number in your system; included in webhooks
// Retrying with the same key returns the first checkout, even if other fields changed.
// Use a new key when the order total changes.
idempotencyKey: `order-${order.id}`,
amount: 500.0, // in dollars, from 1 to 50,000
description: 'Listing photography package', // shown to the customer
payNowEnabled: true, // false hides card payments and leaves only pay at close
// Absolute URLs. successUrl: after a completed payment. cancelUrl: when the customer leaves.
successUrl: `https://yourapp.com/orders/${order.id}/complete`,
cancelUrl: `https://yourapp.com/orders/${order.id}`,
// Optional but recommended: the listing address and the person the project is for.
project: {
address: {
addressLine1: '123 Main St',
city: 'San Francisco',
state: 'CA', // uppercase 2-letter state code
zip: '94102', // 5-digit ZIP code
},
contact: {
firstName: 'Jane',
lastName: 'Doe',
phone: '5555555555', // digits only
},
},
}),
});
if (!response.ok) {
// Error body: { "error": "Bad Request", "message": "..." }
const { error, message } = await response.json();
throw new Error(`Titus checkout failed (${response.status}): ${message ?? error}`);
}
const { data } = await response.json();
// Save data.id with your order. Refund webhooks identify the checkout only by this id.
const { id, checkoutUrl } = data;
The response's data is the checkout. You'll redirect the customer to data.checkoutUrl in the next step. See Working with the API for error codes.
3. Redirect the customer
Redirect the customer to checkoutUrl. This URL takes the customer to a secure, Titus-hosted flow where they will:
-
Select a payment method by:
-
applying for financing (aka "pay at close")
-
entering a credit/debit card (if the business's card payment application is approved)
-
-
Complete the payment
To test card payments on staging, create a checkout of $500 or less. See Testing in Staging for test cards.
Where the customer lands afterward:
-
successUrl: Titus redirects here only after a completed payment, with nothing added to the URL. Show the order as pending on this page. The webhook in step 4 confirms the payment. -
cancelUrl: the customer lands here when they leave the hosted checkout. Landing here doesn't cancel the checkout, and the customer can come back and pay later. Creating the checkout again with the sameidempotencyKeyreturns the same checkout andcheckoutUrl. -
If the customer's pay-at-close application goes to manual review or is denied, Titus redirects to neither URL.
Don't treat a redirect as confirmation of payment. Confirm the payment with webhook events or API requests.
4. Handle webhook events
Titus sends webhook events when a checkout changes. Use them to update your orders.
Build the endpoint
Add an HTTPS POST route to your server, for example /webhooks/titus. Verify the signature of every request before using its body, as shown in Authenticating webhooks.
Every event has the same top-level fields. Checkout events carry the full checkout in payload:
{
"id": "evt_789",
"type": "checkout.updated",
"createdAt": "2026-12-03T18:00:00.000Z",
"payload": {
"id": "chk_456",
"orderId": "order_123",
"status": "succeeded",
"amount": 1500,
"refundedAmount": 0,
"paymentMethod": "pay-at-close",
"payNowMethod": null,
...
}
}
Use
orderIdto match an event to your order.
Titus retries failed deliveries and doesn't guarantee their order. Make your handler safe to run twice for the same event, and return a 2xx once it succeeds.
Choose your events
Subscribe to checkout.updated. It's the only event you need: it carries every status change, failed payment and refund. The other events are optional.
| Event | Sent when | Required? |
|---|---|---|
checkout.updated |
A checkout field changes, including status, lastPaymentError and refundedAmount. |
Yes |
checkout.payment_failed |
A payment that was processing fails, for example a returned ACH debit. The checkout returns to requires-payment. Sent with a checkout.updated that carries the same checkout. |
Optional |
checkout.loan_application_denied |
The customer's pay-at-close application is declined. The checkout doesn't change, so no checkout.updated is sent. Use it to offer another payment method. |
Optional |
checkout.created |
You create a checkout. | Optional |
checkout.loan_application_under_review |
The application goes to manual review. | Optional |
checkout.loan_application_approved |
The application is approved after review. | Optional |
refund.created, refund.updated |
A refund is created or changes status. | Optional |
A checkout moves through these statuses:
-
requires-payment: the customer hasn't paid yet, is applying for financing, or their payment failed and they need to try again. -
processing: the payment started and is pending. -
succeeded: the payment completed. -
canceled: you called the cancel endpoint, or the checkout went unpaid long enough for Titus to expire it.
Refunds don't change the checkout's status, which stays succeeded. A refund updates refundedAmount and sends checkout.updated. refund.* events carry checkoutId, amount and status (pending, completed or failed), but no orderId.
See Webhooks for the event model, signatures and retries.
Register the endpoint
-
In the dashboard, go to Settings → Developer → Webhooks and click Create webhook.
-
Select
checkout.updated, plus any optional events you want, and enter your endpoint's full URL. Staging and production accept onlyhttpsURLs. -
Open the webhook with View details and copy its Secret. Store it in an environment variable, such as
TITUS_WEBHOOK_SECRET, and use it to verify signatures.
Staging and production each need their own webhook and secret.
Test webhooks locally
Titus can't reach localhost. Use a tunnel such as ngrok to give your local server a public HTTPS URL.
-
Install ngrok. See ngrok's getting started guide.
-
With your app running, run
ngrok http <port>, using the port your app listens on. For example,ngrok http 3000. -
ngrok prints a forwarding URL with only a host, such as
https://random-id.ngrok-free.app. Add your webhook route's path, and register the full URL. e.g:https://random-id.ngrok-free.app/webhooks/titus.
Pay at close only
To offer only pay at close, set payNowEnabled: false when you create the checkout. The hosted checkout then hides card payments. Everything else on this page stays the same.
Now you're ready to accept Titus as a payment method! Next, add pay-at-close prompts earlier in your flow, so customers know they can pay at close.

