Skip to content

Address Unit Confirmation

The AddressUnitConfirmation component collects a unit, apartment, or floor number when the selected address needs one. It renders as content only - you control how to display it (modal, separate page, inline section).

AddressUnitConfirmation component

When to show it

After the user selects an address, call client.checkAddressUnit(address) to determine if the address needs a unit number. If requiresUnitNumber is true, show this component before creating the offer.

flowchart LR
    A["AddressEntry"] --> B{"checkAddressUnit()"}
    B -->|needs unit| C["AddressUnitConfirmation"]
    C --> D["createOffer()"]
    B -->|no unit needed| D

Integration flow

import { useState } from 'react';
import {
OpendoorProvider,
AddressEntry,
AddressUnitConfirmation,
QualificationQuestions,
} from '@opendoor/partner-sdk-client-react';
import { OpendoorClient } from '@opendoor/partner-sdk-client-js-core';
import type { Address } from '@opendoor/partner-sdk-client-js-core';
const client = new OpendoorClient({ baseURL: '/api/opendoor/v1' });
function App() {
const [address, setAddress] = useState<Address | null>(null);
const [needsUnit, setNeedsUnit] = useState(false);
const [offerId, setOfferId] = useState<string | null>(null);
const handleAddressSelect = async (addr: Address) => {
setAddress(addr);
// Check if the address needs a unit number
const { requiresUnitNumber } = await client.checkAddressUnit(addr);
if (requiresUnitNumber) {
setNeedsUnit(true);
} else {
const offer = await client.createOffer({ address: addr });
setOfferId(offer.opendoorOfferRequestId);
}
};
const handleUnitConfirm = async (confirmedAddress: Address) => {
setNeedsUnit(false);
setAddress(confirmedAddress);
const offer = await client.createOffer({ address: confirmedAddress });
setOfferId(offer.opendoorOfferRequestId);
};
return (
<OpendoorProvider client={client}>
{offerId && address ? (
<QualificationQuestions offerId={offerId} address={address} />
) : (
<>
<AddressEntry onAddressSelect={handleAddressSelect} />
{needsUnit && address && (
<div className="modal-overlay">
<AddressUnitConfirmation
address={address}
onConfirm={handleUnitConfirm}
onEdit={() => {
setNeedsUnit(false);
setAddress(null);
}}
/>
</div>
)}
</>
)}
</OpendoorProvider>
);
}

Backend setup

Your BFF server needs a route for the unit check. The server SDK calls the GraphQL addressUnitCheck query.

server.ts
app.post('/api/opendoor/v1/address/unit-check', async (req, res) => {
const result = await opendoor.checkAddressUnit(req.body);
res.json(result);
});

Props

PropTypeDefaultDescription
addressAddressRequiredThe address that needs unit confirmation
appearanceOpendoorAppearance{ theme: 'default' }Visual theme configuration (matches AddressEntry default)
onConfirm(address: Address) => voidRequiredCalled when user confirms - address includes street2 (unit) or not if “No unit number”
onEdit() => void-Called when user clicks “Edit” on the address card
onReady() => void-Called when the component mounts
onError(error: Error) => void-Called on validation errors

Callbacks & Events

CallbackTypeWhen it fires
onConfirm(address: Address) => voidUser confirms — address includes street2 (unit) or not if “No unit number”
onEdit() => voidUser clicks “Edit” on the address card
onReady() => voidComponent mounts
onError(error: Error) => voidValidation errors

UI elements

The component renders:

  1. Title: “Confirm your home address”
  2. Address card: Displays the selected address with an “Edit” link
  3. Unit input: Text field labeled “Unit number, apt, or floor*” with placeholder “#1234”
  4. “No unit number” checkbox: Skips the unit input when checked
  5. “Confirm address” button: Submits the unit or confirms no unit is needed

Display options

Since the component is content-only, you can display it however you want:

As a modal dialog

<dialog open={needsUnit}>
<AddressUnitConfirmation address={address} onConfirm={handleConfirm} />
</dialog>

As a separate page/step

{
step === 'unit' && (
<AddressUnitConfirmation address={address} onConfirm={handleConfirm} />
);
}

Inline below the address input

<AddressEntry onAddressSelect={handleAddressSelect} />;
{
needsUnit && (
<AddressUnitConfirmation address={address} onConfirm={handleConfirm} />
);
}

Styling

The component uses the appearance prop for theming, defaulting to the default theme (same as AddressEntry). See the Styling & Themes guide for all available tokens.

Behavior

  • Validation: If neither a unit number is entered nor “No unit number” is checked, clicking “Confirm address” shows an error
  • “No unit number”: When checked, the unit input is disabled and cleared. onConfirm fires with the original address (no street2)
  • Unit entered: onConfirm fires with the address plus street2 set to the unit value
  • “Edit”: Fires onEdit - the partner navigates back to address entry