> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
