> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paysight.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracking Sessions Across Webhooks

> How to use partnerSession and paysightSession to correlate transaction webhooks with your own traffic, click, or visit data.

# Tracking Sessions Across Webhooks

## Overview

Every transaction webhook Paysight sends includes two session identifiers — `paysightSession` and `partnerSession`. These fields let you tie any billing event (charge, refund, chargeback) back to the original user visit or click on your side.

***

## How the session fields work

### 1 — Card Submit API (direct integration)

When you call the [Card Submit API](/api-reference/card-submit/index), pass your own identifier in `partnerSession`:

```json theme={null}
{
  "partnerSession": "your-click-or-visit-id",
  "card": { ... },
  "email": "customer@example.com",
  "amount": 9.99
}
```

The response returns both identifiers:

```json theme={null}
{
  "partnerSession": "your-click-or-visit-id",
  "paysightSession": "202602231518583780223233",
  ...
}
```

| Field             | Who sets it  | When                                                 |
| :---------------- | :----------- | :--------------------------------------------------- |
| `partnerSession`  | **You**      | Passed in the Card Submit request                    |
| `paysightSession` | **Paysight** | Generated automatically and returned in the response |

### 2 — Widget SDK integration

If you integrate via the [Widget SDK](/widget-sdk/quickstart), supply your identifier as `sessionId` in the widget config:

```javascript theme={null}
createWidget({
  targetId: 'payment-widget',
  config: {
    productId: 1234,
    sessionId: 'your-click-or-visit-id', // forwarded to Card Submit as partnerSession
    amount: 9.99,
    environment: 'production'
  }
});
```

The Widget forwards `sessionId` to Card Submit as `partnerSession` automatically. No extra work required.

***

## How they appear in transaction webhooks

Every **New Transaction** and **Updated Transaction** webhook payload contains both fields:

```json theme={null}
{
  "transactionId": "90a0bbed-752a-4445-8112-b44de14a865c",
  "orderId": 193777233,
  "paysightSession": "202602231518583780223233",
  "partnerSession": "your-click-or-visit-id",
  ...
}
```

Use `partnerSession` to look up the original visit in your own data. Use `paysightSession` when working with Paysight support.

***

## End-to-end reference

```
Your site / CRM
  │
  ├─ Widget config:  sessionId = "click_abc123"
  │        OR
  ├─ Card Submit:    partnerSession = "click_abc123"
  │
  ▼
Paysight Card Submit API
  │
  ├─ Response:  partnerSession = "click_abc123"
  │             paysightSession = "202602231518583780223233"
  │
  ▼
Transaction Webhook (New / Updated)
  ├─ partnerSession = "click_abc123"       ← matches your internal record
  └─ paysightSession = "202602231518583780223233"
```

***

## Tips

* **Unique per visit** — generate a fresh `partnerSession` / `sessionId` for every new click or page visit. Reusing the same value across sessions will make reconciliation harder.
* **Store it early** — persist `partnerSession` in your database before calling Card Submit so it is available when the webhook arrives later (e.g. for subscription rebills).
* **All transaction types** — `partnerSession` and `paysightSession` are present on every transaction webhook type: initial charges, subscription rebills, refunds, chargebacks, and chargeback alerts.

***

## Related docs

<CardGroup cols={3}>
  <Card title="Card Submit API" icon="credit-card" href="/api-reference/card-submit/index">
    Full quickstart and request/response reference
  </Card>

  <Card title="Widget SDK" icon="window" href="/widget-sdk/quickstart">
    Embed the payment widget with a sessionId
  </Card>

  <Card title="Webhooks" icon="webhook" href="/webhooks">
    Full transaction webhook payload reference
  </Card>
</CardGroup>
