Skip to main content

createSession

Create payment session. 🔐 This method requires authorization.

Description

This method creation of a payment session. It returns a Promise that resolves to a payment session object ICreateSessionEntity.

Payments.createSession(

orderId*, type*, automaticTaxEnabled

);

Parameters schema

Schema

orderId(required): number
Order identifier
example: 12345

type(required): 'session' | 'intent'
Session type. Possible values: "session" or "intent"
example: 'session'

automaticTaxEnabled: boolean
Automatic calculation of the tax rate. Default: false
example: false

Examples

Minimal example

const response = await Payments.createSession(1, 'session');

Example response

{
"id": 1764,
"type": "session",
"status": "completed",
"orderId": 1,
"paymentAccountId": 1,
"paymentUrl": "https://checkout.stripe.com/c/pay/cs_test_...nP3F3cGB4JSUl",
"createdDate": "2026-02-06T03:16:19.337Z",
"updatedDate": "2026-02-06T05:15:24.932Z",
"amount": 4061.55,
"clientSecret": "pi_3Mtw...ZluoGH"
}

Response schema

Schema: ICreateSessionEntity

id: number
Object identifier.
example: 1764

createdDate: string
Object creation date.
example: "2025-02-26T10:13:16.839Z"

updatedDate: string
Object modification date.
example: "2025-02-26T10:13:16.839Z"

type: 'session' | 'intent'
Type may be 'session' or 'intent'.
example: "session"

status: string
Payment status.
example: "completed"

paymentAccountId: number
Payment account identifier.
example: 1

orderId: number
Order identifier.
example: 1

paymentUrl: string | null
payment link.
example: " https://www.sandbox.paypal.com/checkoutnow?token=9BE88048TU058770M"

amount: number | null
Amount of the payment session.
example: 100

clientSecret: string
Client secret key returned by payment provider (e.g. Stripe) when creating a session.
example: "pi_3MtwBwLkdIwHu7ix28a3tqPa_secret_YrKJUKribcBjcG8HVhfZluoGH"