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,
"updatedDate": "2024-06-21T09:53:28.898Z",
"version": 10,
"identifier": "my-id",
"paymentUrl": "https://paymewntlink.com"
}
Response schema
Schema: ICreateSessionEntity
id: number
Object identifier.
example: 12345
updatedDate: string
Object modification date.
example: "2023-10-01T12:00:00Z"
version: number
Version of the object.
example: 1
identifier: string
Text identifier for the recording field.
example: "payment_12345"
paymentUrl: string
Payment link.
example: "https://example.com/payment/12345"