Skip to main content

createSession

Create payment session 🔐 This method requires authorization.

Payments.createSession(orderId, type, automaticTaxEnabled)

const value = await Payments.createSession(1, 'session')
Schema

orderId:* number
Order identifier
example: 1

type:* 'session' | 'intent'
Session type
example: session

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

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

Example return:

{
"id": 1764,
"updatedDate": "2024-06-21T09:53:28.898Z",
"version": 10,
"identifier": "my-id",
"paymentUrl": "https://paymewntlink.com"
}
Schema

id: number
object identifier
example: 1764

updatedDate: string
object modification date

version: number
object modification version number
example: 10

identifier: string
text identifier for the record field
example: catalog

type: string
type may be 'session' or 'intent'
example: session

lineItems: array
list of items

orderId: number
order identifier
example: 1

paymentAccountId: number
payment account object identifier
example: 1

status: string
payment status
example: completed

sessionId: string
Payment ID from an external provider
example: 9BE88048TU058770M

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

successUrl: string
redirect link after successful payment
example: https://example.com/success

cancelUrl: string
redirect link after payment cancellation
example: https://example.com/cancel

intent: string
example:

{
"amount": 1,
"currency": "usd"
}

intentId: number
intent object identifier
example: 1

clientSecret: string
client secret key
example: pi_3Oyz2kQWzXG1R23w144qG7o4_secret_OeScuCwTpHmyOM1atbm7pWJw2