1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "offers": [
12 {
13 "id": "EXAMPLE-HOTEL",
14 "title": "Example beach hotel, 2 nights",
15 "listingType": "lodging",
16 "displayedPrice": 189,
17 "priceUnit": "per night",
18 "nights": 2,
19 "fees": [
20 {
21 "name": "Resort fee",
22 "amount": 35,
23 "per": "night",
24 "mandatory": true
25 },
26 {
27 "name": "Taxes",
28 "amount": 51.03,
29 "government": true
30 }
31 ],
32 "description": "Resort fee collected at the property."
33 },
34 {
35 "id": "EXAMPLE-TICKET",
36 "title": "Example concert, 2 tickets",
37 "listingType": "ticket",
38 "displayedPrice": 79,
39 "priceUnit": "per ticket",
40 "quantity": 2,
41 "fees": [
42 {
43 "name": "Service fee",
44 "amount": 18.5,
45 "per": "ticket",
46 "mandatory": true
47 },
48 {
49 "name": "Facility charge",
50 "amount": 4,
51 "per": "ticket",
52 "mandatory": true
53 },
54 {
55 "name": "Taxes and fees",
56 "amount": 9.6
57 }
58 ]
59 },
60 {
61 "id": "EXAMPLE-CABIN",
62 "title": "Example cabin, 3 nights (all-in price)",
63 "listingType": "lodging",
64 "displayedPrice": 642,
65 "totalPrice": 642,
66 "nights": 3,
67 "fees": [
68 {
69 "name": "Cleaning fee",
70 "amount": 90,
71 "mandatory": true,
72 "includedInPrice": true
73 }
74 ],
75 "description": "Total price includes all fees, before taxes."
76 }
77 ]
78};
79
80
81const run = await client.actor("ultimatemc/hidden-fee-price-checker").call(input);
82
83
84console.log('Results from dataset');
85console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
86const { items } = await client.dataset(run.defaultDatasetId).listItems();
87items.forEach((item) => {
88 console.dir(item);
89});
90
91