Create session

Use this method to create a session token that you use to authenticate a Hosted Fields session. When you create an instance of Hosted Fields on a webpage, include the session token in the config object.

For more information about how to set up Hosted Fields, see Set up Hosted Fields.

Note: You need to generate a new session token each time you load Hosted Fields on a webpage.

Path parameters

processingTerminalIdstringRequired>=4 characters<=50 characters

Unique identifier that we assigned to the terminal.

Headers

AuthorizationstringRequired

Bearer authentication of the form Bearer <token>, where token is your auth token.

Idempotency-KeystringRequired

Unique identifier that you generate for each request. You must use the UUID v4 format for the identifier. For more information about the idempotency key, go to Idempotency.

Request

This endpoint expects an object.
libVersionstringRequiredformat: "^\d{1,2}.\d{1,2}.\d{1,2}(?:-beta)?.\d+$"

Version of the Hosted Fields JavaScript library that you are using.

The current production version is 1.6.0.172441.

scenarioenumRequired

Indicates if a merchant wants to take a payment or tokenize a customer’s payment details:

  • payment - The merchant wants to take a payment immediately.
  • tokenization - The merchant wants to save the customer’s payment details to take a payment later or to update a customer’s payment details that they’ve already saved.
Allowed values:
secureTokenIdstringOptional>=1 character<=200 characters

Unique identifier that represents a customer’s payment details.

If a merchant wants to update a customer’s payment details that are linked to a secure token, include the secureTokenId in your request.

Response

Successful request. We created the session and returned a session token.

processingTerminalIdstring

Unique identifier that we assigned to the terminal.

tokenstring

Token that our gateway assigned to the Hosted Fields session.

Include this session token in the config file for Hosted Fields.

The session token expires after 10 minutes.

expiresAtstringformat: "date-time"

Date and time that the token expires. We return this value in the ISO 8601 format.