zuplo 6.69.1 → 6.69.3
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.
|
@@ -35,9 +35,9 @@ Track the total number of API requests:
|
|
|
35
35
|
|
|
36
36
|
```json
|
|
37
37
|
{
|
|
38
|
-
"slug": "
|
|
38
|
+
"slug": "api_requests",
|
|
39
39
|
"name": "API Requests",
|
|
40
|
-
"eventType": "
|
|
40
|
+
"eventType": "api_requests",
|
|
41
41
|
"aggregation": "SUM",
|
|
42
42
|
"valueProperty": "$.total"
|
|
43
43
|
}
|
|
@@ -50,7 +50,7 @@ Each event contains the `subscription` ID linking it to a subscription and a
|
|
|
50
50
|
{
|
|
51
51
|
"id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
|
|
52
52
|
"specversion": "1.0",
|
|
53
|
-
"type": "
|
|
53
|
+
"type": "api_requests",
|
|
54
54
|
"source": "monetization-policy",
|
|
55
55
|
"subject": "customer-id",
|
|
56
56
|
"subscription": "01KNVXHQG356VA7T7W0V9N21GH",
|
|
@@ -142,9 +142,9 @@ curl \
|
|
|
142
142
|
--header "Content-Type: application/json" \
|
|
143
143
|
--data @- << EOF
|
|
144
144
|
{
|
|
145
|
-
"slug": "
|
|
145
|
+
"slug": "api_requests",
|
|
146
146
|
"name": "API Requests",
|
|
147
|
-
"eventType": "
|
|
147
|
+
"eventType": "api_requests",
|
|
148
148
|
"aggregation": "SUM",
|
|
149
149
|
"valueProperty": "$.total"
|
|
150
150
|
}
|
|
@@ -84,7 +84,8 @@ Add the monetization plugin to your Developer Portal configuration.
|
|
|
84
84
|
## Step 3: Configure the Monetization Service
|
|
85
85
|
|
|
86
86
|
1. Navigate to the **Services** tab in your project.
|
|
87
|
-
2. Select the environment you want to configure
|
|
87
|
+
2. Select the environment you want to configure. We will use **Working Copy**
|
|
88
|
+
for this quickstart.
|
|
88
89
|
3. Click **Configure** on the **Monetization Service** card.
|
|
89
90
|
|
|
90
91
|
## Step 4: Create a meter
|
|
@@ -93,11 +94,11 @@ Meters track what you want to measure — API calls, tokens processed, data
|
|
|
93
94
|
transferred, etc.
|
|
94
95
|
|
|
95
96
|
1. In the Monetization Service, click the **Meters** tab.
|
|
96
|
-
2. Click **Add Meter** and select **
|
|
97
|
-
3.
|
|
98
|
-
- **Name**: `Requests`
|
|
99
|
-
- **Event**: `
|
|
100
|
-
- **Description**: `API
|
|
97
|
+
2. Click **Add Meter** and select **API Requests** from the template list.
|
|
98
|
+
3. Verify the pre-filled meter details:
|
|
99
|
+
- **Name**: `API Requests`
|
|
100
|
+
- **Event**: `api_requests` — the type of event this meter listens for.
|
|
101
|
+
- **Description**: `Counts all incoming API requests`
|
|
101
102
|
- **Aggregation**: `SUM` — how values are combined (other options include
|
|
102
103
|
`COUNT`, `MAX`, etc.).
|
|
103
104
|
- **Value Property**: `$.total` — a JSONPath expression that extracts the
|
|
@@ -115,15 +116,18 @@ Feature** for each of the following:
|
|
|
115
116
|
|
|
116
117
|
| Name | Key | Linked Meter | Purpose |
|
|
117
118
|
| ---------------- | ------------------ | ------------ | ----------------------------- |
|
|
118
|
-
| API Requests | `
|
|
119
|
+
| API Requests | `api_requests` | API Requests | Usage-based (linked to meter) |
|
|
119
120
|
| Monthly Fee | `monthly_fee` | — | Flat-rate billing |
|
|
120
121
|
| Metadata Support | `metadata_support` | — | Boolean on/off feature |
|
|
121
122
|
|
|
122
123
|
:::tip{title="Key Naming Conventions"}
|
|
123
124
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
The meter key, the feature key, and the key in the monetization policy's
|
|
126
|
+
`meters` configuration must all match. For example, the API Requests meter key
|
|
127
|
+
is `api_requests`, the feature key must also be `api_requests`, and the policy
|
|
128
|
+
must use `"meters": { "api_requests": 1 }`.
|
|
129
|
+
|
|
130
|
+
See [Naming Consistency](./meters.mdx#naming-consistency) for the full rule.
|
|
127
131
|
|
|
128
132
|
:::
|
|
129
133
|
|
|
@@ -243,10 +247,13 @@ charges.
|
|
|
243
247
|
|
|
244
248
|
:::warning
|
|
245
249
|
|
|
246
|
-
Always use your Stripe **test** key (`sk_test_...`)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
Always use your Stripe **test** key (`sk_test_...`) in the **Working Copy**
|
|
251
|
+
environment while following this guide. Stripe test keys run in a sandbox
|
|
252
|
+
environment where you can safely test subscriptions and payments without
|
|
253
|
+
processing real transactions. When you're ready for production, configure the
|
|
254
|
+
**Production** environment with a live key (`sk_live_...`). Do not replace a
|
|
255
|
+
test key with a live key in the same environment — use one key type per
|
|
256
|
+
environment.
|
|
250
257
|
|
|
251
258
|
:::
|
|
252
259
|
|
|
@@ -265,9 +272,9 @@ directory.
|
|
|
265
272
|
|
|
266
273
|

|
|
267
274
|
|
|
268
|
-
3. In the **Meters** configuration field,
|
|
269
|
-
|
|
270
|
-
|
|
275
|
+
3. In the **Meters** configuration field, set the key to `api_requests` with a
|
|
276
|
+
value of `1` to match the meter you created in _Step 4_. This field maps the
|
|
277
|
+
meter slug to the number of units each request consumes.
|
|
271
278
|
|
|
272
279
|
```json
|
|
273
280
|
{
|
|
@@ -276,7 +283,7 @@ directory.
|
|
|
276
283
|
"options": {
|
|
277
284
|
"cacheTtlSeconds": 60,
|
|
278
285
|
"meters": {
|
|
279
|
-
"
|
|
286
|
+
"api_requests": 1
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
289
|
}
|
|
@@ -54,13 +54,15 @@ Connect with a Stripe **test** key (`sk_test_...`) first to validate your
|
|
|
54
54
|
configuration end-to-end. Test mode uses Stripe's test card numbers (e.g.,
|
|
55
55
|
`4242 4242 4242 4242`) and never charges real money.
|
|
56
56
|
|
|
57
|
-
When you're ready to go live,
|
|
57
|
+
When you're ready to go live, configure a separate Zuplo environment (e.g.,
|
|
58
|
+
**Production**) with your live key (`sk_live_...`).
|
|
58
59
|
|
|
59
60
|
:::caution
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
Use one Stripe key type per Zuplo environment — do not replace a test key with a
|
|
63
|
+
live key in the same environment. Test mode and live mode are separate
|
|
64
|
+
environments in Stripe. Products, customers, and subscriptions created in test
|
|
65
|
+
mode don't transfer to live mode and vice versa.
|
|
64
66
|
|
|
65
67
|
:::
|
|
66
68
|
|
|
@@ -22,6 +22,26 @@ A tunnel is a way to expose your _internal services_ to the Zuplo gateway
|
|
|
22
22
|
without exposing it to the public internet. Your Zuplo Gateway accesses those
|
|
23
23
|
services through the `service://` protocol.
|
|
24
24
|
|
|
25
|
+
## Create the tunnel
|
|
26
|
+
|
|
27
|
+
Before you deploy the tunnel container, create the tunnel in Zuplo using the
|
|
28
|
+
CLI. This gives you the tunnel record in your account and the token that you
|
|
29
|
+
will later provide to the container as `TUNNEL_TOKEN`.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
zuplo tunnel create --tunnel-name <your-tunnel-name>
|
|
33
|
+
zuplo tunnel list
|
|
34
|
+
zuplo tunnel describe --tunnel-id <your-tunnel-id>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use these commands as follows:
|
|
38
|
+
|
|
39
|
+
1. Run `zuplo tunnel create` to create the tunnel.
|
|
40
|
+
1. Run `zuplo tunnel list` to see the tunnels in your account and identify the
|
|
41
|
+
tunnel ID if you need it.
|
|
42
|
+
1. Run `zuplo tunnel describe` with the tunnel ID to retrieve the tunnel details
|
|
43
|
+
and copy the token value you will use for `TUNNEL_TOKEN`.
|
|
44
|
+
|
|
25
45
|
The easiest way to deploy your tunnel is using a Docker container. The three
|
|
26
46
|
basic requirements for deploying a secure tunnel with Docker are:
|
|
27
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zuplo",
|
|
3
|
-
"version": "6.69.
|
|
3
|
+
"version": "6.69.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The programmable API Gateway",
|
|
6
6
|
"author": "Zuplo, Inc.",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"zuplo": "zuplo.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@zuplo/cli": "6.69.
|
|
23
|
-
"@zuplo/core": "6.69.
|
|
24
|
-
"@zuplo/runtime": "6.69.
|
|
22
|
+
"@zuplo/cli": "6.69.3",
|
|
23
|
+
"@zuplo/core": "6.69.3",
|
|
24
|
+
"@zuplo/runtime": "6.69.3",
|
|
25
25
|
"@zuplo/test": "1.4.0"
|
|
26
26
|
}
|
|
27
27
|
}
|