# Dodo Checkout Session (https://talivia.com/docs/revenue-guides/dodo-payments/checkout-session)



Use this option when your backend creates a Dodo Checkout Session. It also covers Dodo Overlay and Inline Checkout because both start from a Checkout Session.

Connect your account in **Website settings → Revenue → Dodo Payments**, then pass the current Talivia session into the checkout metadata.

## Add the session to checkout metadata [#add-the-session-to-checkout-metadata]

Read the Talivia session cookie on the backend and merge it into the `metadata` object in your existing Dodo call.

```javascript title="Create a Dodo Checkout Session"
const taliviaSessionId = request.cookies.get('talivia_session_id')?.value;

const checkout = await dodo.checkoutSessions.create({
  product_cart,
  return_url: 'https://your-site.com/thanks',
  metadata: {
    // Keep your existing metadata fields here.
    ...(taliviaSessionId && { talivia_session_id: taliviaSessionId }),
  },
});
```

`metadata` is Dodo's standard metadata object. Keep any fields you already send and add only `talivia_session_id`. Talivia reads that value from the verified payment event and handles attribution.

## Checkout API on another origin [#checkout-api-on-another-origin]

If browser code calls a checkout API on another origin, include the opaque session value in that request:

```javascript title="Browser checkout handoff"
const sessionId = window.talivia.getSessionId();

await fetch('https://api.your-site.com/create-checkout', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ sessionId }),
});
```

Validate the request normally and place the received value in `metadata.talivia_session_id` when the backend creates the Checkout Session. The session ID is an attribution identifier, not authentication.

See [Dodo Checkout Sessions](https://docs.dodopayments.com/developer-resources/checkout-session) for the provider-side checkout options.

No manual webhook setup is needed. Talivia configures and verifies the Dodo webhook when you connect the provider.
