Skip to main content

createSdkSessionToken Method

Overview

The createSdkSessionToken method initializes wallet payment sessions for Apple Pay, Google Pay, and other SDK-based payments. It sets up the secure context needed for tokenized wallet payments.

Business Use Case: When offering Apple Pay or Google Pay checkout, initialize a session with merchant configuration and payment details.

Purpose

WalletPurpose
Apple PayInitialize PKPaymentSession
Google PayConfigure PaymentDataRequest
PayPal SDKSet up checkout context

Request Fields

FieldTypeRequiredDescription
merchantSdkSessionIdstringYesYour unique SDK session reference
amountMoneyYesPayment amount
paymentMethodTypestringNoAPPLE_PAY, GOOGLE_PAY
countryCodestringNoISO country code
customerobjectNoCustomer information

Response Fields

FieldTypeDescription
sessionTokenobjectWallet-specific session data
statusCodenumberHTTP status code

Example

SDK Setup

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

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

Request

const request = {
merchantSdkSessionId: "sdk_session_001",
amount: {
minorAmount: 10000,
currency: "USD"
},
paymentMethodType: "APPLE_PAY",
countryCode: "US",
customer: {
name: "John Doe",
}
};

const response = await authClient.createSdkSessionToken(request);

Response

{
sessionToken: {
applePay: {
sessionData: "eyJtZXJjaGFudElkZW50aWZpZXIiOi...",
displayMessage: "Example Store"
}
},
statusCode: 200
}

Next Steps