@mhome/app-facade-protocol 1.110.0 → 1.112.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ # Billing v1
2
+
3
+ All three read App Facades run in the cloud under UserRead, using the authenticated user's identity. They accept no userId, tenantId or Space selector. A Space/background principal cannot read an owner's private account. These reads do not require an active Space.
4
+
5
+ | Target | Input | Business output |
6
+ | --- | --- | --- |
7
+ | `/app/billing/summary/get` | `{}` | Current plan, subscription status, balance and used credits (`Summary`) |
8
+ | `/app/billing/payment/list` | `{}` | `{payments}` ordered newest first; signed currency minor units and Unix milliseconds |
9
+ | `/app/billing/credit/usage` | `{fromDate?,toDate?}` | Personal payer's UTC daily credits by source, including tracking coverage |
10
+
11
+ Summary retains the existing consistent plan/balance read; it does not query payments or daily history. Payment list retains successful invoices and refunds. Daily usage defaults to the 30 days ending today in UTC, permits ordered ranges of at most 366 inclusive days, and clamps the start to tracking availability. Errors are not replaced with zero usage. The existing `/app/agent/credit/usage` is Space-wide and remains distinct.
12
+
13
+ ## Account units and plan codes
14
+
15
+ `totalBalance` is the period's credit allowance, not the remaining balance. The
16
+ remaining credits are `totalBalance - usedAutomation - usedChat - usedIntegration`.
17
+ These four summary fields and daily `rows[].credits` are raw account credit units:
18
+ **100 credits = 1 product token displayed by the App**. For example, `100000`
19
+ credits is 1000 product tokens; 100 used credits is 1 used product token. These
20
+ product tokens are not an LLM's input/output tokens. Keep the wire values intact;
21
+ convert only when explaining the product-token amounts to a user.
22
+
23
+ The current tier codes are `E` (Internal), `T` (shown as Free), `V0` (Free), `V1`
24
+ (Go), and `V2` (Plus). `currentTier` describes the current plan; `refreshTier`
25
+ describes the plan at the next refresh. Either field and
26
+ `stripeSubscriptionStatus` can be null; null means unavailable/absent, not a
27
+ confirmed Free plan or active subscription. `nextRefreshTimestamp` is Unix
28
+ milliseconds. Product names such as `plus` are not tier codes.
29
+
30
+ Payment `amount` uses Stripe invoice/refund minor units for the returned
31
+ `currency`, independently of account credits. Preserve the refund sign. Follow
32
+ [Stripe's currency rules](https://docs.stripe.com/currencies), including zero-
33
+ decimal currencies and the ISK/UGX two-decimal API exceptions; do not assume USD
34
+ or divide all amounts by 100.
35
+
36
+ Full returns the business DTO. Essential encodes the same DTO as YAML without extra reads. UI, Agent, MCP and CLI use these same targets and identity rules. Schemas and fictional examples are in `schema/billing.v1.schema.json` and `fixtures/billing.conformance.json`.
37
+
38
+ ## Subscription commands
39
+
40
+ These cloud-only UserWrite Facades use the authenticated user's account without an active Space. Input cannot select another user. The current UI exposes these commands on Web/desktop, with confirmation before submission; native mobile keeps its existing hidden purchase controls. Agent/MCP tool catalogs and delegated execution do not expose these commands.
41
+
42
+ | Target | Input | Business output |
43
+ | --- | --- | --- |
44
+ | `/app/billing/subscription/checkout/create` | `{productId}` | `{url}` for navigation to Stripe Checkout |
45
+ | `/app/billing/subscription/cancel` | `{}` | Subscription state; cancellation takes effect at period end |
46
+ | `/app/billing/subscription/resume` | `{}` | Subscription state; automatic renewal restored |
47
+ | `/app/billing/subscription/change` | `{productId}` | Subscription state; upgrades start immediately, downgrades start next period, choosing the current tier removes a pending change |
48
+
49
+ Product IDs retain the existing case-insensitive `go`/`plus` and legacy `pro`/`max` aliases. Subscription output contains `currentTier`, `cancelAtPeriodEnd`, `currentPeriodEndTimestamp`, `scheduledTier` and `scheduledTierStartTimestamp`; timestamps are Unix milliseconds. The standard Facade envelope carries success/failure, without a second business `success` flag. Full and Essential project the same command result without additional reads.
50
+
51
+ The UI does not automatically replay writes on reconnect or timeout. Checkout keeps its persistent attempt, frozen parameters, Stripe idempotency key and recoverable session URL. Once accepted, Checkout continues after caller disconnect; a lost response does not prove payment creation failed. Existing subscription management, proration and reconciliation stay owned by the Stripe manager. Stripe SDK calls, hosted Checkout navigation and signed `POST /webhook/stripe` delivery remain HTTP(S); the retired `/api/v1/payment/stripe/*` user command controllers are not webhook endpoints.
@@ -0,0 +1,129 @@
1
+ {
2
+ "summary": {
3
+ "userId": "fictional-user",
4
+ "currentTier": "V2",
5
+ "refreshTier": "V2",
6
+ "stripeSubscriptionStatus": "active",
7
+ "totalBalance": 300000,
8
+ "usedAutomation": 100,
9
+ "usedChat": 200,
10
+ "usedIntegration": 300,
11
+ "nextRefreshTimestamp": 1796083200000
12
+ },
13
+ "payments": {
14
+ "payments": [
15
+ {
16
+ "description": "Fictional refund",
17
+ "amount": -500,
18
+ "currency": "usd",
19
+ "timestamp": 1794009600000
20
+ }
21
+ ]
22
+ },
23
+ "creditUsage": {
24
+ "audience": "personal",
25
+ "timezone": "UTC",
26
+ "fromDate": "2026-11-01",
27
+ "toDate": "2026-11-07",
28
+ "trackedFrom": "2026-11-01T00:00:00Z",
29
+ "rows": [
30
+ {
31
+ "date": "2026-11-07",
32
+ "source": "agent",
33
+ "credits": 20
34
+ }
35
+ ]
36
+ },
37
+ "emptyInput": {
38
+ "valid": [
39
+ {}
40
+ ],
41
+ "invalid": [
42
+ {
43
+ "userId": "other"
44
+ },
45
+ {
46
+ "spaceId": "home"
47
+ },
48
+ {
49
+ "fromDate": "2026-11-01"
50
+ }
51
+ ]
52
+ },
53
+ "usageInput": {
54
+ "valid": [
55
+ {},
56
+ {
57
+ "fromDate": "2026-11-01",
58
+ "toDate": "2026-11-07"
59
+ }
60
+ ],
61
+ "invalid": [
62
+ {
63
+ "userId": "other"
64
+ },
65
+ {
66
+ "scopeId": "home"
67
+ },
68
+ {
69
+ "fromDate": 42
70
+ }
71
+ ]
72
+ },
73
+ "productInput": {
74
+ "valid": [
75
+ {
76
+ "productId": "go"
77
+ },
78
+ {
79
+ "productId": "plus"
80
+ },
81
+ {
82
+ "productId": "pro"
83
+ },
84
+ {
85
+ "productId": "max"
86
+ },
87
+ {
88
+ "productId": "Go"
89
+ },
90
+ {
91
+ "productId": "PLUS"
92
+ }
93
+ ],
94
+ "invalid": [
95
+ {},
96
+ null,
97
+ {
98
+ "productId": null
99
+ },
100
+ {
101
+ "productId": 42
102
+ },
103
+ {
104
+ "productId": ""
105
+ },
106
+ {
107
+ "productId": "free"
108
+ },
109
+ {
110
+ "productId": "go",
111
+ "userId": "other"
112
+ },
113
+ {
114
+ "productId": "go",
115
+ "scopeId": "home"
116
+ }
117
+ ]
118
+ },
119
+ "checkout": {
120
+ "url": "https://checkout.stripe.com/c/pay/cs_test_fictional"
121
+ },
122
+ "subscription": {
123
+ "currentTier": "V2",
124
+ "cancelAtPeriodEnd": false,
125
+ "currentPeriodEndTimestamp": 1796083200000,
126
+ "scheduledTier": "V1",
127
+ "scheduledTierStartTimestamp": 1796083200000
128
+ }
129
+ }
@@ -894,5 +894,229 @@
894
894
  "hubReady": false,
895
895
  "cloudReady": false,
896
896
  "entry": "unavailable"
897
+ },
898
+ {
899
+ "target": "/app/billing/summary/get",
900
+ "execution": "cloud",
901
+ "placement": null,
902
+ "hubReady": true,
903
+ "cloudReady": true,
904
+ "entry": "cloud"
905
+ },
906
+ {
907
+ "target": "/app/billing/summary/get",
908
+ "execution": "cloud",
909
+ "placement": null,
910
+ "hubReady": true,
911
+ "cloudReady": false,
912
+ "entry": "unavailable"
913
+ },
914
+ {
915
+ "target": "/app/billing/summary/get",
916
+ "execution": "cloud",
917
+ "placement": null,
918
+ "hubReady": false,
919
+ "cloudReady": true,
920
+ "entry": "cloud"
921
+ },
922
+ {
923
+ "target": "/app/billing/summary/get",
924
+ "execution": "cloud",
925
+ "placement": null,
926
+ "hubReady": false,
927
+ "cloudReady": false,
928
+ "entry": "unavailable"
929
+ },
930
+ {
931
+ "target": "/app/billing/payment/list",
932
+ "execution": "cloud",
933
+ "placement": null,
934
+ "hubReady": true,
935
+ "cloudReady": true,
936
+ "entry": "cloud"
937
+ },
938
+ {
939
+ "target": "/app/billing/payment/list",
940
+ "execution": "cloud",
941
+ "placement": null,
942
+ "hubReady": true,
943
+ "cloudReady": false,
944
+ "entry": "unavailable"
945
+ },
946
+ {
947
+ "target": "/app/billing/payment/list",
948
+ "execution": "cloud",
949
+ "placement": null,
950
+ "hubReady": false,
951
+ "cloudReady": true,
952
+ "entry": "cloud"
953
+ },
954
+ {
955
+ "target": "/app/billing/payment/list",
956
+ "execution": "cloud",
957
+ "placement": null,
958
+ "hubReady": false,
959
+ "cloudReady": false,
960
+ "entry": "unavailable"
961
+ },
962
+ {
963
+ "target": "/app/billing/credit/usage",
964
+ "execution": "cloud",
965
+ "placement": null,
966
+ "hubReady": true,
967
+ "cloudReady": true,
968
+ "entry": "cloud"
969
+ },
970
+ {
971
+ "target": "/app/billing/credit/usage",
972
+ "execution": "cloud",
973
+ "placement": null,
974
+ "hubReady": true,
975
+ "cloudReady": false,
976
+ "entry": "unavailable"
977
+ },
978
+ {
979
+ "target": "/app/billing/credit/usage",
980
+ "execution": "cloud",
981
+ "placement": null,
982
+ "hubReady": false,
983
+ "cloudReady": true,
984
+ "entry": "cloud"
985
+ },
986
+ {
987
+ "target": "/app/billing/credit/usage",
988
+ "execution": "cloud",
989
+ "placement": null,
990
+ "hubReady": false,
991
+ "cloudReady": false,
992
+ "entry": "unavailable"
993
+ },
994
+ {
995
+ "target": "/app/billing/subscription/checkout/create",
996
+ "execution": "cloud",
997
+ "placement": null,
998
+ "hubReady": true,
999
+ "cloudReady": true,
1000
+ "entry": "cloud"
1001
+ },
1002
+ {
1003
+ "target": "/app/billing/subscription/checkout/create",
1004
+ "execution": "cloud",
1005
+ "placement": null,
1006
+ "hubReady": true,
1007
+ "cloudReady": false,
1008
+ "entry": "unavailable"
1009
+ },
1010
+ {
1011
+ "target": "/app/billing/subscription/checkout/create",
1012
+ "execution": "cloud",
1013
+ "placement": null,
1014
+ "hubReady": false,
1015
+ "cloudReady": true,
1016
+ "entry": "cloud"
1017
+ },
1018
+ {
1019
+ "target": "/app/billing/subscription/checkout/create",
1020
+ "execution": "cloud",
1021
+ "placement": null,
1022
+ "hubReady": false,
1023
+ "cloudReady": false,
1024
+ "entry": "unavailable"
1025
+ },
1026
+ {
1027
+ "target": "/app/billing/subscription/cancel",
1028
+ "execution": "cloud",
1029
+ "placement": null,
1030
+ "hubReady": true,
1031
+ "cloudReady": true,
1032
+ "entry": "cloud"
1033
+ },
1034
+ {
1035
+ "target": "/app/billing/subscription/cancel",
1036
+ "execution": "cloud",
1037
+ "placement": null,
1038
+ "hubReady": true,
1039
+ "cloudReady": false,
1040
+ "entry": "unavailable"
1041
+ },
1042
+ {
1043
+ "target": "/app/billing/subscription/cancel",
1044
+ "execution": "cloud",
1045
+ "placement": null,
1046
+ "hubReady": false,
1047
+ "cloudReady": true,
1048
+ "entry": "cloud"
1049
+ },
1050
+ {
1051
+ "target": "/app/billing/subscription/cancel",
1052
+ "execution": "cloud",
1053
+ "placement": null,
1054
+ "hubReady": false,
1055
+ "cloudReady": false,
1056
+ "entry": "unavailable"
1057
+ },
1058
+ {
1059
+ "target": "/app/billing/subscription/resume",
1060
+ "execution": "cloud",
1061
+ "placement": null,
1062
+ "hubReady": true,
1063
+ "cloudReady": true,
1064
+ "entry": "cloud"
1065
+ },
1066
+ {
1067
+ "target": "/app/billing/subscription/resume",
1068
+ "execution": "cloud",
1069
+ "placement": null,
1070
+ "hubReady": true,
1071
+ "cloudReady": false,
1072
+ "entry": "unavailable"
1073
+ },
1074
+ {
1075
+ "target": "/app/billing/subscription/resume",
1076
+ "execution": "cloud",
1077
+ "placement": null,
1078
+ "hubReady": false,
1079
+ "cloudReady": true,
1080
+ "entry": "cloud"
1081
+ },
1082
+ {
1083
+ "target": "/app/billing/subscription/resume",
1084
+ "execution": "cloud",
1085
+ "placement": null,
1086
+ "hubReady": false,
1087
+ "cloudReady": false,
1088
+ "entry": "unavailable"
1089
+ },
1090
+ {
1091
+ "target": "/app/billing/subscription/change",
1092
+ "execution": "cloud",
1093
+ "placement": null,
1094
+ "hubReady": true,
1095
+ "cloudReady": true,
1096
+ "entry": "cloud"
1097
+ },
1098
+ {
1099
+ "target": "/app/billing/subscription/change",
1100
+ "execution": "cloud",
1101
+ "placement": null,
1102
+ "hubReady": true,
1103
+ "cloudReady": false,
1104
+ "entry": "unavailable"
1105
+ },
1106
+ {
1107
+ "target": "/app/billing/subscription/change",
1108
+ "execution": "cloud",
1109
+ "placement": null,
1110
+ "hubReady": false,
1111
+ "cloudReady": true,
1112
+ "entry": "cloud"
1113
+ },
1114
+ {
1115
+ "target": "/app/billing/subscription/change",
1116
+ "execution": "cloud",
1117
+ "placement": null,
1118
+ "hubReady": false,
1119
+ "cloudReady": false,
1120
+ "entry": "unavailable"
897
1121
  }
898
1122
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.v1",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "callSchema": "schema/facade-call.v1.schema.json",
5
5
  "routing": "manifest/routing.v1.json",
6
6
  "routingSchema": "schema/routing.v1.schema.json",
@@ -399,6 +399,19 @@
399
399
  "/app/widget/button/trigger",
400
400
  "/app/widget/delete"
401
401
  ]
402
+ },
403
+ "billing": {
404
+ "contract": "contract/billing-v1.md",
405
+ "schema": "schema/billing.v1.schema.json",
406
+ "requestTargets": [
407
+ "/app/billing/summary/get",
408
+ "/app/billing/payment/list",
409
+ "/app/billing/credit/usage",
410
+ "/app/billing/subscription/checkout/create",
411
+ "/app/billing/subscription/cancel",
412
+ "/app/billing/subscription/resume",
413
+ "/app/billing/subscription/change"
414
+ ]
402
415
  }
403
416
  },
404
417
  "authorization": "manifest/authorization.v1.json",
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractVersion": "1.110.0",
2
+ "contractVersion": "1.112.1",
3
3
  "operations": {
4
4
  "/app/agent/context/get": "spaceRead",
5
5
  "/app/agent/credit/usage": "spaceRead",
@@ -46,6 +46,9 @@
46
46
  "/app/automation/status": "spaceRead",
47
47
  "/app/automation/stop": "spaceWrite",
48
48
  "/app/automation/verify": "spaceWrite",
49
+ "/app/billing/credit/usage": "userRead",
50
+ "/app/billing/payment/list": "userRead",
51
+ "/app/billing/summary/get": "userRead",
49
52
  "/app/capability/invoke": "spaceWrite",
50
53
  "/app/capability/invoke/json": "spaceWrite",
51
54
  "/app/client/appearance/report": "spaceRead",
@@ -88,7 +91,6 @@
88
91
  "/app/entity/detail/get": "spaceRead",
89
92
  "/app/entity/history/list": "spaceRead",
90
93
  "/app/entity/list": "spaceRead",
91
- "/app/presentation/entity/get": "spaceRead",
92
94
  "/app/graph/relations/get": "spaceRead",
93
95
  "/app/group/create": "spaceWrite",
94
96
  "/app/group/delete": "spaceWrite",
@@ -115,8 +117,6 @@
115
117
  "/app/hub/remove": "spaceManage",
116
118
  "/app/hub/restart": "spaceManage",
117
119
  "/app/hub/status": "spaceRead",
118
- "/app/inspire/search": "spaceRead",
119
- "/app/inspire/verify": "spaceWrite",
120
120
  "/app/integration/capability/detail/get": "spaceRead",
121
121
  "/app/integration/connect": "spaceWrite",
122
122
  "/app/integration/detail/batch": "spaceRead",
@@ -129,7 +129,6 @@
129
129
  "/app/integration/installed/list": "spaceRead",
130
130
  "/app/integration/list": "spaceRead",
131
131
  "/app/integration/official/list": "spaceRead",
132
- "/app/presentation/integration/get": "spaceRead",
133
132
  "/app/integration/preview/apply": "spaceWrite",
134
133
  "/app/integration/preview/status": "spaceRead",
135
134
  "/app/integration/scope/list": "spaceRead",
@@ -230,6 +229,9 @@
230
229
  "/app/presentation/automation/placements/get": "spaceRead",
231
230
  "/app/presentation/automation/share": "spaceWrite",
232
231
  "/app/presentation/automation/summaries/get": "spaceRead",
232
+ "/app/presentation/entity/get": "spaceRead",
233
+ "/app/presentation/entity/meta/get": "spaceRead",
234
+ "/app/presentation/integration/get": "spaceRead",
233
235
  "/app/presentation/reference/item/list": "spaceRead",
234
236
  "/app/presentation/reference/type/list": "spaceRead",
235
237
  "/app/presentation/space/get": "spaceRead",
@@ -354,7 +356,10 @@
354
356
  "/pod/talk/speech/prepare": "spaceWrite",
355
357
  "/pod/talk/turn/submit": "spaceWrite",
356
358
  "/pod/talk/view/get": "spaceRead",
357
- "/app/presentation/entity/meta/get": "spaceRead"
359
+ "/app/billing/subscription/checkout/create": "userWrite",
360
+ "/app/billing/subscription/cancel": "userWrite",
361
+ "/app/billing/subscription/resume": "userWrite",
362
+ "/app/billing/subscription/change": "userWrite"
358
363
  },
359
364
  "nodePrefix": "/app/plugin/",
360
365
  "serviceOperations": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.host-provision.targets.v1",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "contract": "contract/host-provisioning-v1.md",
5
5
  "localTargets": [
6
6
  "/local/host/provision/start",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.hub.targets.v1",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "appTargets": [
5
5
  "/app/hub/get",
6
6
  "/app/hub/remove",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.pod.targets.v1",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "contract": "contract/pod-commissioning-v1.md",
5
5
  "localTargets": [
6
6
  "/local/pod/discovery/start",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.app-facade.routing.v1",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "targetPrefix": "/app/",
5
5
  "default": {
6
6
  "execution": "scopeMode"
@@ -10,7 +10,6 @@
10
10
  "rules": {
11
11
  "cloudPrefixes": [
12
12
  "/app/space/",
13
- "/app/inspire/",
14
13
  "/app/user/",
15
14
  "/app/ui/customize/cards/catalog/"
16
15
  ],
@@ -39,7 +38,14 @@
39
38
  "/app/presentation/space/list",
40
39
  "/app/presentation/space/get",
41
40
  "/app/resource/transfer/prepare",
42
- "/app/nfc/sources/list"
41
+ "/app/nfc/sources/list",
42
+ "/app/billing/summary/get",
43
+ "/app/billing/payment/list",
44
+ "/app/billing/credit/usage",
45
+ "/app/billing/subscription/checkout/create",
46
+ "/app/billing/subscription/cancel",
47
+ "/app/billing/subscription/resume",
48
+ "/app/billing/subscription/change"
43
49
  ],
44
50
  "scopeModeTargets": [
45
51
  "/app/artifact/resolve",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": "mhome.messaging.targets.v1",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "requestTargets": [
5
5
  "/app/messaging/provider/list",
6
6
  "/app/messaging/provider-account/list",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhome/app-facade-protocol",
3
- "version": "1.110.0",
3
+ "version": "1.112.1",
4
4
  "description": "Build-time protocol artifacts for mhome.app-facade",
5
5
  "license": "MIT",
6
6
  "repository": {
package/protocol.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "protocol": "mhome.app-facade",
3
- "contractVersion": "1.110.0",
3
+ "contractVersion": "1.112.1",
4
4
  "manifest": "manifest/app-facade.v1.json",
5
5
  "schemas": {
6
6
  "storage": "schema/storage.v1.schema.json",
7
7
  "nowAttention": "schema/now-attention.v1.schema.json",
8
+ "billing": "schema/billing.v1.schema.json",
8
9
  "pluginInstall": "schema/plugin-install.v1.schema.json",
9
10
  "hostAuthorization": "schema/host-authorization.v1.schema.json",
10
11
  "hostAccess": "schema/host-access.v1.schema.json",
@@ -35,6 +36,7 @@
35
36
  "fixtures": {
36
37
  "attention": "fixtures/attention/conformance.json",
37
38
  "agentLlm": "fixtures/agent-llm.conformance.json",
39
+ "billing": "fixtures/billing.conformance.json",
38
40
  "entityPresentation": "fixtures/entity-presentation.conformance.json",
39
41
  "integrationPresentation": "fixtures/integration-presentation.conformance.json",
40
42
  "group": "fixtures/group.conformance.json",
@@ -0,0 +1,235 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://meowlink.app/protocol/billing.v1.schema.json",
4
+ "$defs": {
5
+ "emptyInput": {
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {},
9
+ "required": []
10
+ },
11
+ "usageInput": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "fromDate": {
16
+ "type": [
17
+ "string",
18
+ "null"
19
+ ]
20
+ },
21
+ "toDate": {
22
+ "type": [
23
+ "string",
24
+ "null"
25
+ ]
26
+ }
27
+ },
28
+ "required": []
29
+ },
30
+ "summary": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "userId": {
35
+ "type": "string"
36
+ },
37
+ "currentTier": {
38
+ "type": [
39
+ "string",
40
+ "null"
41
+ ]
42
+ },
43
+ "refreshTier": {
44
+ "type": [
45
+ "string",
46
+ "null"
47
+ ]
48
+ },
49
+ "stripeSubscriptionStatus": {
50
+ "type": [
51
+ "string",
52
+ "null"
53
+ ]
54
+ },
55
+ "totalBalance": {
56
+ "type": "integer"
57
+ },
58
+ "usedAutomation": {
59
+ "type": "integer"
60
+ },
61
+ "usedChat": {
62
+ "type": "integer"
63
+ },
64
+ "usedIntegration": {
65
+ "type": "integer"
66
+ },
67
+ "nextRefreshTimestamp": {
68
+ "type": "integer"
69
+ }
70
+ },
71
+ "required": [
72
+ "userId",
73
+ "currentTier",
74
+ "refreshTier",
75
+ "stripeSubscriptionStatus",
76
+ "totalBalance",
77
+ "usedAutomation",
78
+ "usedChat",
79
+ "usedIntegration",
80
+ "nextRefreshTimestamp"
81
+ ]
82
+ },
83
+ "payments": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "properties": {
87
+ "payments": {
88
+ "type": "array",
89
+ "items": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "properties": {
93
+ "description": {
94
+ "type": [
95
+ "string",
96
+ "null"
97
+ ]
98
+ },
99
+ "amount": {
100
+ "type": "integer"
101
+ },
102
+ "currency": {
103
+ "type": "string"
104
+ },
105
+ "timestamp": {
106
+ "type": "integer"
107
+ }
108
+ },
109
+ "required": [
110
+ "description",
111
+ "amount",
112
+ "currency",
113
+ "timestamp"
114
+ ]
115
+ }
116
+ }
117
+ },
118
+ "required": [
119
+ "payments"
120
+ ]
121
+ },
122
+ "creditUsage": {
123
+ "type": "object",
124
+ "additionalProperties": false,
125
+ "properties": {
126
+ "audience": {
127
+ "type": "string"
128
+ },
129
+ "timezone": {
130
+ "type": "string"
131
+ },
132
+ "fromDate": {
133
+ "type": "string"
134
+ },
135
+ "toDate": {
136
+ "type": "string"
137
+ },
138
+ "trackedFrom": {
139
+ "type": "string"
140
+ },
141
+ "rows": {
142
+ "type": "array",
143
+ "items": {
144
+ "type": "object",
145
+ "additionalProperties": false,
146
+ "properties": {
147
+ "date": {
148
+ "type": "string"
149
+ },
150
+ "source": {
151
+ "type": "string"
152
+ },
153
+ "credits": {
154
+ "type": "integer"
155
+ }
156
+ },
157
+ "required": [
158
+ "date",
159
+ "source",
160
+ "credits"
161
+ ]
162
+ }
163
+ }
164
+ },
165
+ "required": [
166
+ "audience",
167
+ "timezone",
168
+ "fromDate",
169
+ "toDate",
170
+ "trackedFrom",
171
+ "rows"
172
+ ]
173
+ },
174
+ "productInput": {
175
+ "type": "object",
176
+ "additionalProperties": false,
177
+ "properties": {
178
+ "productId": {
179
+ "type": "string",
180
+ "pattern": "^([gG][oO]|[pP][rR][oO]|[pP][lL][uU][sS]|[mM][aA][xX])$"
181
+ }
182
+ },
183
+ "required": [
184
+ "productId"
185
+ ]
186
+ },
187
+ "checkout": {
188
+ "type": "object",
189
+ "additionalProperties": false,
190
+ "properties": {
191
+ "url": {
192
+ "type": "string",
193
+ "minLength": 1
194
+ }
195
+ },
196
+ "required": [
197
+ "url"
198
+ ]
199
+ },
200
+ "subscription": {
201
+ "type": "object",
202
+ "additionalProperties": false,
203
+ "properties": {
204
+ "currentTier": {
205
+ "type": [
206
+ "string",
207
+ "null"
208
+ ]
209
+ },
210
+ "cancelAtPeriodEnd": {
211
+ "type": "boolean"
212
+ },
213
+ "currentPeriodEndTimestamp": {
214
+ "type": "integer"
215
+ },
216
+ "scheduledTier": {
217
+ "type": [
218
+ "string",
219
+ "null"
220
+ ]
221
+ },
222
+ "scheduledTierStartTimestamp": {
223
+ "type": "integer"
224
+ }
225
+ },
226
+ "required": [
227
+ "currentTier",
228
+ "cancelAtPeriodEnd",
229
+ "currentPeriodEndTimestamp",
230
+ "scheduledTier",
231
+ "scheduledTierStartTimestamp"
232
+ ]
233
+ }
234
+ }
235
+ }