Skip to main content

getSessionById

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

Description​

Fetches a payment session by its id. Resolves to an ISessionEntity.

.getSessionById(

);

Parameters schema​

Schema

id(required): number
Payment session ID.
example: 12345

Examples​

Minimal example​

const response = await Payments.getSessionById(21);

Example response​

{
"id": 21,
"createdDate": "2025-02-26T10:13:16.839Z",
"updatedDate": "2025-02-26T10:13:16.839Z",
"type": "session",
"status": "waiting",
"paymentAccountId": 1,
"orderId": 43,
"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"