> For the complete documentation index, see [llms.txt](https://docs.hyperswitch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperswitch.io/integrations/prism/node/merchant-authentication-service/create-session-token.md).

# Create Session Token

## Overview

The `createSessionToken` method creates a session token for payment processing. This token maintains state across multiple payment operations, enabling secure tracking for multi-step payment flows.

**Business Use Case:** When processing payments that require multiple steps (3DS authentication, redirect flows), you need to maintain session state between requests.

## Purpose

| Scenario            | Benefit                                 |
| ------------------- | --------------------------------------- |
| 3DS authentication  | Maintain context through challenge flow |
| Redirect payments   | Preserve state during bank redirects    |
| Multi-step checkout | Track progress across pages             |

## Request Fields

| Field               | Type    | Required | Description                     |
| ------------------- | ------- | -------- | ------------------------------- |
| `merchantSessionId` | string  | Yes      | Your unique session reference   |
| `amount`            | Money   | Yes      | Payment amount for this session |
| `metadata`          | object  | No       | Additional metadata             |
| `testMode`          | boolean | No       | Use test environment            |

## Response Fields

| Field          | Type   | Description                     |
| -------------- | ------ | ------------------------------- |
| `sessionToken` | string | Token for subsequent operations |
| `statusCode`   | number | HTTP status code                |

## Example

### SDK Setup

```javascript
const { MerchantAuthenticationClient } = require('hyperswitch-prism');

const authClient = new MerchantAuthenticationClient({
    connector: 'stripe',
    apiKey: 'YOUR_API_KEY',
    environment: 'SANDBOX'
});
```

### Request

```javascript
const request = {
    merchantSessionId: "session_001",
    amount: {
        minorAmount: 10000,
        currency: "USD"
    },
    testMode: true
};

const response = await authClient.createSessionToken(request);
```

### Response

```javascript
{
    sessionToken: "sess_1234567890abcdef",
    statusCode: 200
}
```

## Next Steps

* [createSdkSessionToken](/integrations/prism/node/merchant-authentication-service/create-sdk-session-token.md) - Initialize wallet sessions
* [Payment Service](/integrations/prism/node/payment-service.md) - Process payments using session


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hyperswitch.io/integrations/prism/node/merchant-authentication-service/create-session-token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
