Skip to main content

createSession

Create a payment session. Access depends on the module permissions of the caller's user group; a signed-in user isn't required.

Description​

Creates a payment session for an order and resolves to an ISessionEntity. Use type 'session' for a hosted checkout page (the link is in paymentUrl) or 'intent' for a custom payment form.

.createSession(

, ,

);

Parameters schema​

Schema

orderId(required): number
ID of the order.
example: 12345

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

automaticTaxEnabled: boolean
Whether the tax rate is calculated automatically. Default: false.
example:

false

Examples​

Minimal example​

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

Example response​

{
"id": 61,
"createdDate": "2026-10-27T09:15:47.713Z",
"updatedDate": "2026-10-27T09:15:47.713Z",
"type": "session",
"status": "waiting",
"paymentAccountId": 1,
"orderId": 685,
"amount": null,
"paymentUrl": null
}

Response schema​

Schema: ISessionEntity

id: number
Object ID.
example: 1764

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

updatedDate: string
Date the object was last modified.
example: "2025-02-26T10:13:16.839Z"

type: 'session' | 'intent'
Session type: "session" or "intent".
example: "session"

status: string
Payment status.
example: "completed"

paymentAccountId: number
ID of the payment account.
example: 1

orderId: number
ID of the order.
example: 1

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

amount: number | null
Payment session amount.
example: 100

clientSecret: string
Client secret returned by the payment provider (for example, Stripe) when the session is created.
example: "pi_3MtwBwLkdIwHu7ix28a3tqPa_secret_YrKJUKribcBjcG8HVhfZluoGH"


Usage examples​

Step-by-step walkthroughs in the documentation:

  • Order pay: create a payment session for an order placed by a registered user.
  • Tickets order: full tickets checkout: create order, then start the payment session.
  • Guest order: guest checkout flow with payment session creation.

Try it live​

Run this method interactively in the JS SDK sandbox. On your first visit, connect your Project URL and App Token, then open:

  • Order pay: create a payment session for an order placed by a registered user.
  • Tickets order: full tickets checkout: create order, then start the payment session.
  • Guest order: guest checkout flow with payment session creation.