Chuyển đến nội dung chính

Đặt vé

Trong ví dụ này, chúng tôi sẽ trình bày cách đặt vé cho một sự kiện bằng cách sử dụng API OneEntry.

✅ Mục đích của kịch bản:

  • Người dùng đăng nhập bằng thông tin xác thực của họ
  • Chọn loại vé, ngày và giờ từ lịch trình
  • Thanh toán cho đơn hàng và nhận vé qua email

✅ Những gì bạn cần:

  • Một PROJECT_URL và APP_TOKEN hợp lệ để xác thực với API OneEntry.
  • Người dùng đã đăng ký để xác thực
  • Mẫu với dấu hiệu "tickets_form" và các trường "schedule" và "tickets"
  • Kho lưu trữ đơn hàng đã được cấu hình với dấu hiệu "tickets"

📌 Quan trọng:

  • Những ví dụ này không bao gồm xử lý lỗi.
  • Bạn có thể quản lý lỗi bằng cách sử dụng khối try-catch hoặc bằng cách sử dụng cấu trúc như await Promise.catch((error) => error).

📚 Xem trong tài liệu:

📦 Tham khảo SDK:

Thử nghiệm trực tiếp

Chạy phương thức này một cách tương tác trong JS SDK sandbox — kết nối URL Dự án và Mã thông báo Ứng dụng của bạn khi truy cập lần đầu, sau đó mở:

  • Đặt vé — Trong ví dụ này, chúng tôi sẽ trình bày cách đặt vé cho một sự kiện bằng cách sử dụng API OneEntry.

Kịch bản

1. Nhập defineOneEntry từ SDK và định nghĩa PROJECT_URL và APP_TOKEN

Ví dụ:

import { defineOneEntry } from 'oneentry';

const PROJECT_URL = 'your-project-url';
const APP_TOKEN = 'your-app-token';

2. Tạo một khách hàng API với defineOneEntry()

Ví dụ:

const { AuthProvider, Forms, Orders, Payments } = defineOneEntry(PROJECT_URL, {
token: APP_TOKEN,
});

3. Xác thực người dùng với AuthProvider.auth()

Ví dụ:

const authData = [
{ marker: 'email_reg', value: 'your-email' },
{ marker: 'password_reg', value: 'your-password' },
];
const authResponse = await AuthProvider.auth('email', { authData });
console.log(authResponse);
Kết quả:
{
"userIdentifier": "kvasssukr.net@gmail.com",
"authProviderIdentifier": "email",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR...pZCI6MTYsImF1dGhQ"
"refreshToken": "1745494429101-...-2834edf8"
}

4. Chúng tôi nhận dữ liệu mẫu từ Nền tảng OneEntry với Forms.getFormByMarker() để tạo một mẫu trên frontend

Ví dụ:

const formData = await Forms.getFormByMarker('tickets_form');
console.log(formData);
Kết quả:
{
"id": 9,
"attributeSetId": 12,
"type": "order",
"localizeInfos": {
"title": "Tickets",
"titleForSite": "Tickets",
"successMessage": "",
"unsuccessMessage": "",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 6,
"position": 1,
"identifier": "tickets_form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "timeInterval",
"marker": "schedule",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "Schedule",
"intervals": [
{
"id": "ef9cf848-7373-4b81-98bd-7ad33aa951e2",
"range": [
"2025-04-26T21:00:00.000Z",
"2025-04-26T21:00:00.000Z"
],
"external": [],
"intervals": [
{
"id": "f2042e47-c650-4fc6-ae1c-efdb109b450f",
"end": {
"hours": 21,
"minutes": 30
},
"start": {
"hours": 16,
"minutes": 30
},
"period": 90
}
],
"inEveryWeek": true,
"inEveryMonth": true,
"timeIntervals": [
[
"2025-04-05T16:30:00.000Z",
"2025-04-05T18:00:00.000Z"
],
[
"2025-04-05T18:00:00.000Z",
"2025-04-05T19:30:00.000Z"
],
[
"2025-04-05T19:30:00.000Z",
"2025-04-05T21:00:00.000Z"
],
[
"2025-04-12T16:30:00.000Z",
"2025-04-12T18:00:00.000Z"
],
[
"2025-04-12T18:00:00.000Z",
"2025-04-12T19:30:00.000Z"
],
[
"2025-04-12T19:30:00.000Z",
"2025-04-12T21:00:00.000Z"
],
[
"2025-04-19T16:30:00.000Z",
"2025-04-19T18:00:00.000Z"
],
[
"2025-04-19T18:00:00.000Z",
"2025-04-19T19:30:00.000Z"
],
[
"2025-04-19T19:30:00.000Z",
"2025-04-19T21:00:00.000Z"
],
[
"2025-04-26T16:30:00.000Z",
"2025-04-26T18:00:00.000Z"
],
[
"2025-04-26T18:00:00.000Z",
"2025-04-26T19:30:00.000Z"
],
[
"2025-04-26T19:30:00.000Z",
"2025-04-26T21:00:00.000Z"
],
[
"2025-05-03T16:30:00.000Z",
"2025-05-03T18:00:00.000Z"
],
[
"2025-05-03T18:00:00.000Z",
"2025-05-03T19:30:00.000Z"
],
[
"2025-05-03T19:30:00.000Z",
"2025-05-03T21:00:00.000Z"
],
[
"2025-05-10T16:30:00.000Z",
"2025-05-10T18:00:00.000Z"
],
[
"2025-05-10T18:00:00.000Z",
"2025-05-10T19:30:00.000Z"
],
[
"2025-05-10T19:30:00.000Z",
"2025-05-10T21:00:00.000Z"
],
[
"2025-05-17T16:30:00.000Z",
"2025-05-17T18:00:00.000Z"
],
[
"2025-05-17T18:00:00.000Z",
"2025-05-17T19:30:00.000Z"
],
[
"2025-05-17T19:30:00.000Z",
"2025-05-17T21:00:00.000Z"
],
[
"2025-05-24T16:30:00.000Z",
"2025-05-24T18:00:00.000Z"
],
[
"2025-05-24T18:00:00.000Z",
"2025-05-24T19:30:00.000Z"
],
[
"2025-05-24T19:30:00.000Z",
"2025-05-24T21:00:00.000Z"
],
[
"2025-05-31T16:30:00.000Z",
"2025-05-31T18:00:00.000Z"
],
[
"2025-05-31T18:00:00.000Z",
"2025-05-31T19:30:00.000Z"
],
[
"2025-05-31T19:30:00.000Z",
"2025-05-31T21:00:00.000Z"
],
[
"2025-06-07T16:30:00.000Z",
"2025-06-07T18:00:00.000Z"
],
[
"2025-06-07T18:00:00.000Z",
"2025-06-07T19:30:00.000Z"
],
[
"2025-06-07T19:30:00.000Z",
"2025-06-07T21:00:00.000Z"
],
[
"2025-06-14T16:30:00.000Z",
"2025-06-14T18:00:00.000Z"
],
[
"2025-06-14T18:00:00.000Z",
"2025-06-14T19:30:00.000Z"
],
[
"2025-06-14T19:30:00.000Z",
"2025-06-14T21:00:00.000Z"
],
[
"2025-06-21T16:30:00.000Z",
"2025-06-21T18:00:00.000Z"
],
[
"2025-06-21T18:00:00.000Z",
"2025-06-21T19:30:00.000Z"
],
[
"2025-06-21T19:30:00.000Z",
"2025-06-21T21:00:00.000Z"
],
[
"2025-06-28T16:30:00.000Z",
"2025-06-28T18:00:00.000Z"
],
[
"2025-06-28T18:00:00.000Z",
"2025-06-28T19:30:00.000Z"
],
[
"2025-06-28T19:30:00.000Z",
"2025-06-28T21:00:00.000Z"
],
[
"2025-07-05T16:30:00.000Z",
"2025-07-05T18:00:00.000Z"
],
[
"2025-07-05T18:00:00.000Z",
"2025-07-05T19:30:00.000Z"
],
[
"2025-07-05T19:30:00.000Z",
"2025-07-05T21:00:00.000Z"
],
[
"2025-07-12T16:30:00.000Z",
"2025-07-12T18:00:00.000Z"
],
[
"2025-07-12T18:00:00.000Z",
"2025-07-12T19:30:00.000Z"
],
[
"2025-07-12T19:30:00.000Z",
"2025-07-12T21:00:00.000Z"
],
[
"2025-07-19T16:30:00.000Z",
"2025-07-19T18:00:00.000Z"
],
[
"2025-07-19T18:00:00.000Z",
"2025-07-19T19:30:00.000Z"
],
[
"2025-07-19T19:30:00.000Z",
"2025-07-19T21:00:00.000Z"
],
[
"2025-07-26T16:30:00.000Z",
"2025-07-26T18:00:00.000Z"
],
[
"2025-07-26T18:00:00.000Z",
"2025-07-26T19:30:00.000Z"
],
[
"2025-07-26T19:30:00.000Z",
"2025-07-26T21:00:00.000Z"
],
[
"2025-08-02T16:30:00.000Z",
"2025-08-02T18:00:00.000Z"
],
[
"2025-08-02T18:00:00.000Z",
"2025-08-02T19:30:00.000Z"
],
[
"2025-08-02T19:30:00.000Z",
"2025-08-02T21:00:00.000Z"
],
[
"2025-08-09T16:30:00.000Z",
"2025-08-09T18:00:00.000Z"
],
[
"2025-08-09T18:00:00.000Z",
"2025-08-09T19:30:00.000Z"
],
[
"2025-08-09T19:30:00.000Z",
"2025-08-09T21:00:00.000Z"
],
[
"2025-08-16T16:30:00.000Z",
"2025-08-16T18:00:00.000Z"
],
[
"2025-08-16T18:00:00.000Z",
"2025-08-16T19:30:00.000Z"
],
[
"2025-08-16T19:30:00.000Z",
"2025-08-16T21:00:00.000Z"
],
[
"2025-08-23T16:30:00.000Z",
"2025-08-23T18:00:00.000Z"
],
[
"2025-08-23T18:00:00.000Z",
"2025-08-23T19:30:00.000Z"
],
[
"2025-08-23T19:30:00.000Z",
"2025-08-23T21:00:00.000Z"
],
[
"2025-08-30T16:30:00.000Z",
"2025-08-30T18:00:00.000Z"
],
[
"2025-08-30T18:00:00.000Z",
"2025-08-30T19:30:00.000Z"
],
[
"2025-08-30T19:30:00.000Z",
"2025-08-30T21:00:00.000Z"
],
[
"2025-09-06T16:30:00.000Z",
"2025-09-06T18:00:00.000Z"
],
[
"2025-09-06T18:00:00.000Z",
"2025-09-06T19:30:00.000Z"
],
[
"2025-09-06T19:30:00.000Z",
"2025-09-06T21:00:00.000Z"
],
[
"2025-09-13T16:30:00.000Z",
"2025-09-13T18:00:00.000Z"
],
[
"2025-09-13T18:00:00.000Z",
"2025-09-13T19:30:00.000Z"
],
[
"2025-09-13T19:30:00.000Z",
"2025-09-13T21:00:00.000Z"
],
[
"2025-09-20T16:30:00.000Z",
"2025-09-20T18:00:00.000Z"
],
[
"2025-09-20T18:00:00.000Z",
"2025-09-20T19:30:00.000Z"
],
[
"2025-09-20T19:30:00.000Z",
"2025-09-20T21:00:00.000Z"
],
[
"2025-09-27T16:30:00.000Z",
"2025-09-27T18:00:00.000Z"
],
[
"2025-09-27T18:00:00.000Z",
"2025-09-27T19:30:00.000Z"
],
[
"2025-09-27T19:30:00.000Z",
"2025-09-27T21:00:00.000Z"
],
[
"2025-10-04T16:30:00.000Z",
"2025-10-04T18:00:00.000Z"
],
[
"2025-10-04T18:00:00.000Z",
"2025-10-04T19:30:00.000Z"
],
[
"2025-10-04T19:30:00.000Z",
"2025-10-04T21:00:00.000Z"
],
[
"2025-10-11T16:30:00.000Z",
"2025-10-11T18:00:00.000Z"
],
[
"2025-10-11T18:00:00.000Z",
"2025-10-11T19:30:00.000Z"
],
[
"2025-10-11T19:30:00.000Z",
"2025-10-11T21:00:00.000Z"
],
[
"2025-10-18T16:30:00.000Z",
"2025-10-18T18:00:00.000Z"
],
[
"2025-10-18T18:00:00.000Z",
"2025-10-18T19:30:00.000Z"
],
[
"2025-10-18T19:30:00.000Z",
"2025-10-18T21:00:00.000Z"
],
[
"2025-10-25T16:30:00.000Z",
"2025-10-25T18:00:00.000Z"
],
[
"2025-10-25T18:00:00.000Z",
"2025-10-25T19:30:00.000Z"
],
[
"2025-10-25T19:30:00.000Z",
"2025-10-25T21:00:00.000Z"
],
[
"2025-11-01T16:30:00.000Z",
"2025-11-01T18:00:00.000Z"
],
[
"2025-11-01T18:00:00.000Z",
"2025-11-01T19:30:00.000Z"
],
[
"2025-11-01T19:30:00.000Z",
"2025-11-01T21:00:00.000Z"
],
[
"2025-11-08T16:30:00.000Z",
"2025-11-08T18:00:00.000Z"
],
[
"2025-11-08T18:00:00.000Z",
"2025-11-08T19:30:00.000Z"
],
[
"2025-11-08T19:30:00.000Z",
"2025-11-08T21:00:00.000Z"
],
[
"2025-11-15T16:30:00.000Z",
"2025-11-15T18:00:00.000Z"
],
[
"2025-11-15T18:00:00.000Z",
"2025-11-15T19:30:00.000Z"
],
[
"2025-11-15T19:30:00.000Z",
"2025-11-15T21:00:00.000Z"
],
[
"2025-11-22T16:30:00.000Z",
"2025-11-22T18:00:00.000Z"
],
[
"2025-11-22T18:00:00.000Z",
"2025-11-22T19:30:00.000Z"
],
[
"2025-11-22T19:30:00.000Z",
"2025-11-22T21:00:00.000Z"
],
[
"2025-11-29T16:30:00.000Z",
"2025-11-29T18:00:00.000Z"
],
[
"2025-11-29T18:00:00.000Z",
"2025-11-29T19:30:00.000Z"
],
[
"2025-11-29T19:30:00.000Z",
"2025-11-29T21:00:00.000Z"
],
[
"2025-12-06T16:30:00.000Z",
"2025-12-06T18:00:00.000Z"
],
[
"2025-12-06T18:00:00.000Z",
"2025-12-06T19:30:00.000Z"
],
[
"2025-12-06T19:30:00.000Z",
"2025-12-06T21:00:00.000Z"
],
[
"2025-12-13T16:30:00.000Z",
"2025-12-13T18:00:00.000Z"
],
[
"2025-12-13T18:00:00.000Z",
"2025-12-13T19:30:00.000Z"
],
[
"2025-12-13T19:30:00.000Z",
"2025-12-13T21:00:00.000Z"
],
[
"2025-12-20T16:30:00.000Z",
"2025-12-20T18:00:00.000Z"
],
[
"2025-12-20T18:00:00.000Z",
"2025-12-20T19:30:00.000Z"
],
[
"2025-12-20T19:30:00.000Z",
"2025-12-20T21:00:00.000Z"
],
[
"2025-12-27T16:30:00.000Z",
"2025-12-27T18:00:00.000Z"
],
[
"2025-12-27T18:00:00.000Z",
"2025-12-27T19:30:00.000Z"
],
[
"2025-12-27T19:30:00.000Z",
"2025-12-27T21:00:00.000Z"
],
[
"2026-01-03T16:30:00.000Z",
"2026-01-03T18:00:00.000Z"
],
[
"2026-01-03T18:00:00.000Z",
"2026-01-03T19:30:00.000Z"
],
[
"2026-01-03T19:30:00.000Z",
"2026-01-03T21:00:00.000Z"
],
[
"2026-01-10T16:30:00.000Z",
"2026-01-10T18:00:00.000Z"
],
[
"2026-01-10T18:00:00.000Z",
"2026-01-10T19:30:00.000Z"
],
[
"2026-01-10T19:30:00.000Z",
"2026-01-10T21:00:00.000Z"
],
[
"2026-01-17T16:30:00.000Z",
"2026-01-17T18:00:00.000Z"
],
[
"2026-01-17T18:00:00.000Z",
"2026-01-17T19:30:00.000Z"
],
[
"2026-01-17T19:30:00.000Z",
"2026-01-17T21:00:00.000Z"
],
[
"2026-01-24T16:30:00.000Z",
"2026-01-24T18:00:00.000Z"
],
[
"2026-01-24T18:00:00.000Z",
"2026-01-24T19:30:00.000Z"
],
[
"2026-01-24T19:30:00.000Z",
"2026-01-24T21:00:00.000Z"
],
[
"2026-01-31T16:30:00.000Z",
"2026-01-31T18:00:00.000Z"
],
[
"2026-01-31T18:00:00.000Z",
"2026-01-31T19:30:00.000Z"
],
[
"2026-01-31T19:30:00.000Z",
"2026-01-31T21:00:00.000Z"
],
[
"2026-02-07T16:30:00.000Z",
"2026-02-07T18:00:00.000Z"
],
[
"2026-02-07T18:00:00.000Z",
"2026-02-07T19:30:00.000Z"
],
[
"2026-02-07T19:30:00.000Z",
"2026-02-07T21:00:00.000Z"
],
[
"2026-02-14T16:30:00.000Z",
"2026-02-14T18:00:00.000Z"
],
[
"2026-02-14T18:00:00.000Z",
"2026-02-14T19:30:00.000Z"
],
[
"2026-02-14T19:30:00.000Z",
"2026-02-14T21:00:00.000Z"
],
[
"2026-02-21T16:30:00.000Z",
"2026-02-21T18:00:00.000Z"
],
[
"2026-02-21T18:00:00.000Z",
"2026-02-21T19:30:00.000Z"
],
[
"2026-02-21T19:30:00.000Z",
"2026-02-21T21:00:00.000Z"
],
[
"2026-02-28T16:30:00.000Z",
"2026-02-28T18:00:00.000Z"
],
[
"2026-02-28T18:00:00.000Z",
"2026-02-28T19:30:00.000Z"
],
[
"2026-02-28T19:30:00.000Z",
"2026-02-28T21:00:00.000Z"
],
[
"2026-03-07T16:30:00.000Z",
"2026-03-07T18:00:00.000Z"
],
[
"2026-03-07T18:00:00.000Z",
"2026-03-07T19:30:00.000Z"
],
[
"2026-03-07T19:30:00.000Z",
"2026-03-07T21:00:00.000Z"
],
[
"2026-03-14T16:30:00.000Z",
"2026-03-14T18:00:00.000Z"
],
[
"2026-03-14T18:00:00.000Z",
"2026-03-14T19:30:00.000Z"
],
[
"2026-03-14T19:30:00.000Z",
"2026-03-14T21:00:00.000Z"
],
[
"2026-03-21T16:30:00.000Z",
"2026-03-21T18:00:00.000Z"
],
[
"2026-03-21T18:00:00.000Z",
"2026-03-21T19:30:00.000Z"
],
[
"2026-03-21T19:30:00.000Z",
"2026-03-21T21:00:00.000Z"
],
[
"2026-03-28T16:30:00.000Z",
"2026-03-28T18:00:00.000Z"
],
[
"2026-03-28T18:00:00.000Z",
"2026-03-28T19:30:00.000Z"
],
[
"2026-03-28T19:30:00.000Z",
"2026-03-28T21:00:00.000Z"
]
]
}
]
},
"additionalFields": {}
},
{
"type": "entity",
"marker": "tickets",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [
{
"title": "Tickets",
"value": {
"id": 8,
"depth": 0,
"isPinned": false,
"parentId": null,
"position": "0|hzzzz3:"
}
},
{
"title": "Bronze",
"value": {
"id": "p-8-10",
"depth": 1,
"isPinned": false,
"parentId": 8,
"position": 1,
"selected": true
}
},
{
"title": "Silver",
"value": {
"id": "p-8-11",
"depth": 1,
"isPinned": false,
"parentId": 8,
"position": 2,
"selected": true
}
},
{
"title": "Gold",
"value": {
"id": "p-8-12",
"depth": 1,
"isPinned": false,
"parentId": 8,
"position": 3,
"selected": true
}
}
],
"validators": {
"requiredValidator": {
"strict": true
}
},
"initialValue": null,
"localizeInfos": {
"title": "Tickets"
},
"additionalFields": {}
}
],
"total": "1",
"moduleFormConfigs": []
}

5. Tạo một đơn hàng trong kho lưu trữ đơn hàng với Orders.createOrder()

Dữ liệu:

{
"formIdentifier": "tickets_form",
"paymentAccountIdentifier": "cash",
"formData": {
"en_US": [
{
"type": "entity",
"marker": "tickets",
"value": [
"p-8-10"
]
}
]
},
"products": [
{
"productId": 10,
"quantity": 1
}
]
}

Ví dụ:

const body = {
formIdentifier: 'tickets_form',
paymentAccountIdentifier: 'cash',
formData: [{ type: 'entity', marker: 'tickets', value: ['p-8-10'] }],
products: [{ productId: 10, quantity: 1 }],
};
const order = await Orders.createOrder('tickets', body);

if ('statusCode' in order) {
throw new Error(order.message);
}
Kết quả:
{
"id": 123,
"formIdentifier": "tickets_form",
"paymentAccountIdentifier": "cash",
"formData": [
{
"type": "entity",
"marker": "tickets",
"value": [
"p-8-10"
]
}
],
"products": [
{
"productId": 10,
"quantity": 1
}
],
"currency": "USD",
"totalSum": 100,
"bonusApplied": 0,
"totalDue": 100,
"discountConfig": {
"orderDiscounts": [],
"productDiscounts": [],
"coupon": null,
"settings": {
"allowStacking": false,
"maxDiscountValue": null,
"allowGiftStacking": false,
"maxBonusPaymentPercent": null,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"giftRefundPolicy": "KEEP_GIFT"
},
"additionalDiscountsMarkers": [],
"totalRaw": 100,
"totalSumWithDiscount": 100,
"excludedGiftProductIds": [],
"bonus": {
"availableBalance": 0,
"maxBonusDiscount": 0,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"bonusApplied": 0
},
"bonusApplied": 0,
"totalDue": 100
},
"statusIdentifier": "new",
"statusLocalizeInfos": {
"title": "new"
},
"createdDate": "2026-06-06T11:54:31.545Z"
}

6. Tạo phiên thanh toán với Payments.createSession()

Ví dụ:

const paymentSession = await Payments.createSession(order.id, 'session', false);
console.log(paymentSession);
Kết quả:
{
"id": 71,
"createdDate": "2026-06-06T11:54:31.857Z",
"updatedDate": "2026-06-06T11:54:31.857Z",
"type": "session",
"status": "waiting",
"paymentAccountId": 1,
"orderId": 123,
"amount": null,
"paymentUrl": null
}

7. Lấy một đối tượng phiên thanh toán theo định danh đơn hàng với Payments.getSessionByOrderId()

Ví dụ:

const sessionByOrderId = await Payments.getSessionByOrderId(order.id);
console.log(sessionByOrderId);
Kết quả:
[
{
"id": 71,
"createdDate": "2026-06-06T11:54:31.857Z",
"updatedDate": "2026-06-06T11:54:31.857Z",
"type": "session",
"status": "waiting",
"paymentAccountId": 1,
"orderId": 123,
"amount": null,
"paymentUrl": null
}
]

Ví dụ cuối cùng

// 1. Import defineOneEntry from SDK and define PROJECT_URL and APP_TOKEN
import { defineOneEntry } from 'oneentry';

const PROJECT_URL = 'your-project-url';
const APP_TOKEN = 'your-app-token';

// 2. Creating an API client with [defineOneEntry()](/docs/index/#Installation)
const { AuthProvider, Forms, Orders, Payments } = defineOneEntry(PROJECT_URL, {
token: APP_TOKEN,
});

// 3. User authorization with [AuthProvider.auth()](/docs/auth-provider/auth)
const authData = [
{ marker: 'email_reg', value: 'your-email' },
{ marker: 'password_reg', value: 'your-password' },
];
const authResponse = await AuthProvider.auth('email', { authData });
console.log(authResponse);

// 4. We receive form data from OneEntry Platform with Forms.getFormByMarker() to generate a form on the frontend
const formData = await Forms.getFormByMarker('tickets_form');
console.log(formData);

// 5. Creation of an order in the order storage with [Orders.createOrder()](/docs/orders/createOrder)
const body = {
formIdentifier: 'tickets_form',
paymentAccountIdentifier: 'cash',
formData: [{ type: 'entity', marker: 'tickets', value: ['p-8-10'] }],
products: [{ productId: 10, quantity: 1 }],
};
const order = await Orders.createOrder('tickets', body);

if ('statusCode' in order) {
throw new Error(order.message);
}

// 6. Creation of payment session with [Payments.createSession()](/docs/payments/createSession)
const paymentSession = await Payments.createSession(order.id, 'session', false);
console.log(paymentSession);

// 7. Get one payment session object by order identifier with [Payments.getSessionByOrderId()](/docs/payments/getSessionByOrderId)
const sessionByOrderId = await Payments.getSessionByOrderId(order.id);
console.log(sessionByOrderId);