Skip to main content

CreateSessionToken RPC

Overview

The CreateSessionToken RPC creates a session token for payment processing. This token maintains state across multiple payment operations, enabling secure tracking and improved security for multi-step payment flows.

Business Use Case: When processing payments that require multiple steps (3DS authentication, redirect flows, wallet payments), you need to maintain session state between requests. This RPC creates a session token that carries context through the entire payment journey.

Purpose

Why use session tokens?

ScenarioSession Token Benefit
3DS authenticationMaintain context through challenge flow
Redirect paymentsPreserve state during bank redirects
Multi-step checkoutTrack progress across pages
SecurityBind payment to specific session

Key outcomes:

  • Session-scoped payment context
  • Secure state management
  • Cross-request continuity
  • Enhanced fraud protection

Request Fields

FieldTypeRequiredDescription
merchant_session_idstringYesYour unique session reference
amountMoneyYesPayment amount for this session
metadataSecretStringNoAdditional metadata for the connector
connector_feature_dataSecretStringNoConnector-specific metadata
stateConnectorStateNoExisting state to continue session
browser_infoBrowserInformationNoBrowser details for fraud detection
test_modeboolNoUse test/sandbox environment

Response Fields

FieldTypeDescription
errorErrorInfoError details if creation failed
status_codeuint32HTTP-style status code
session_tokenstringSession token for subsequent operations

Example

Request (grpcurl)

grpcurl -H "x-connector: stripe" \
-H "x-connector-config: {\"config\":{\"Stripe\":{\"api_key\":\"$STRIPE_API_KEY\"}}}" \
-d '{
"merchant_session_id": "session_001",
"amount": {
"minor_amount": 10000,
"currency": "USD"
},
"browser_info": {
"accept_header": "text/html",
"user_agent": "Mozilla/5.0..."
},
"test_mode": true
}' \
localhost:8080 \
types.MerchantAuthenticationService/CreateSessionToken

Response

{
"session_token": "sess_1234567890abcdef",
"status_code": 200
}

Next Steps