# Upsell callback reference

Implement the Kustom Checkout upsell callback with upsell_request, upsell_service_response and upsell_line fields, limits and widget eligibility rules.

Kustom calls `merchant_urls.upsell` before confirmation loads and after each added item.
Return product recommendations within **10 seconds**; calls aren't retried. Aim for under
three seconds to limit the customer's wait.

Portal-curated products for the order take precedence over your endpoint. See
[Add confirmation page upsells](/checkout/use-cases/confirmation-page-upsell/) for
setup and order handling.

## Request — `upsell_request`

| Field | Type | Meaning |
|---|---|---|
| `upsell_possible` | boolean | `false` when the payment method can't support upsell. You're still called |
| `max_upsell_amount` | integer | Authorization headroom in minor units: the original order total (at least 100 SEK, NOK or DKK, or 10 EUR or GBP), minus what has already been upsold. `0` when the payment method doesn't support upsell. Pre-filter against it |
| `order_lines` | array | What the customer has already bought |
| `selected_shipping_option` | object | Their chosen delivery. Present whenever the order has one selected — from its own `shipping_options` or from the Shipping Assistant |
| `billing_address` | object | For tax and locale-aware filtering |
| `shipping_address` | object | As above |
| `purchase_currency` | string | ISO 4217 |
| `locale` | string | BCP 47, such as `en-SE` |
| `merchant_id` | string | Your merchant ID |
| `session_id` | string | The order identifier. Map it to your own order |

## Response — `upsell_service_response`

| Field | Type | Required | Meaning |
|---|---|---|---|
| `upsell_lines` | array | Yes | Products to display. Empty means no widget — return `[]` to signal "no recommendations" |
| `last_upsell_time` | string | No | ISO 8601 moment the widget stops accepting additions. Falls back to the account-level window. Doesn't move the confirmation push, which always waits for the account-level window |
| `notification_uri` | string | No | Where Kustom pushes when the order is updated with upsell items, used only when `merchant_urls.upsell_notification` isn't set — useful as a re-read trigger if you create on redirect |

## Each `upsell_line`

Required:

| Field | Type | Meaning |
|---|---|---|
| `name` | string | Product name, max 255 characters |
| `quantity` | integer | The quantity you're *offering*, not the customer's choice |
| `unit_price` | integer | Minor units, tax included |
| `tax_rate` | integer | Two implicit decimals — `2500` is 25% |
| `total_amount` | integer | Minor units, tax and discount included. Must equal `quantity` × `unit_price` − `total_discount_amount` |
| `total_tax_amount` | integer | Minor units |
| `max_allowed_quantity` | integer | The most the customer may add |

Recommended fields. Without `image_url`, the product card has no picture:

| Field | Meaning |
|---|---|
| `reference` | Your SKU |
| `image_url` | Card image, max 1024 characters |
| `product_url` | Product page, max 1024 characters |
| `description` | Max 1024 characters |
| `product_identifiers` | GTIN, ISBN and similar |
| `shipping_attributes` | Weight, dimensions and tags, for shipping compatibility |
| `feedback_url` | Called when a customer adds this item — an item-level signal |

Set `quantity` to the default offer, usually `1`, and use `max_allowed_quantity` to limit
additions. Supply correct totals; Kustom recalculates them and checks the authorization
whenever an item is added.

```json
{
  "shipping_attributes": {
    "weight": 500,
    "dimensions": { "width": 100, "height": 150, "length": 200 },
    "tags": ["standard", "non-fragile"]
  }
}
```

## When the widget is shown

The widget requires upsell enabled on the order, a payment method that supports increased
authorization and recommendations within the available amount. Kustom checks payment method
eligibility.

For an unsupported payment method, `upsell_possible` is `false`, `max_upsell_amount` is `0`,
no widget appears and the push isn't delayed. With no recommendations, no widget appears,
but the push still waits for the full upsell window.

## Related

- [Add confirmation page upsells](/checkout/use-cases/confirmation-page-upsell/) — the how-to this contract serves
- [Checkout URLs and callbacks](/checkout/integrate/merchant-urls/) — where `merchant_urls.upsell` is set
- [Checkout API reference](/api/checkout/) — the order schema the request embeds
