@dodopayments/express 0.1.2 → 0.1.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.
package/README.md CHANGED
@@ -18,25 +18,30 @@ npm install @dodopayments/express
18
18
 
19
19
  ## Quick Start
20
20
 
21
-
22
21
  ### 1. Checkout
23
22
 
24
23
  ```typescript
25
- import { checkoutHandler } from '@dodopayments/express';
26
-
27
- app.get('/api/checkout', checkoutHandler({
28
- bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
29
- returnUrl: process.env.RETURN_URL!,
30
- environment: "test_mode",
31
- type: "static"
32
- }))
33
-
34
- app.post('/api/checkout', checkoutHandler({
35
- bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
36
- returnUrl: process.env.RETURN_URL!,
37
- environment: "test_mode",
38
- type: "dynamic"
39
- }))
24
+ import { checkoutHandler } from "@dodopayments/express";
25
+
26
+ app.get(
27
+ "/api/checkout",
28
+ checkoutHandler({
29
+ bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
30
+ returnUrl: process.env.RETURN_URL!,
31
+ environment: "test_mode",
32
+ type: "static",
33
+ }),
34
+ );
35
+
36
+ app.post(
37
+ "/api/checkout",
38
+ checkoutHandler({
39
+ bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
40
+ returnUrl: process.env.RETURN_URL!,
41
+ environment: "test_mode",
42
+ type: "dynamic",
43
+ }),
44
+ );
40
45
  ```
41
46
 
42
47
  ---
@@ -46,11 +51,13 @@ app.post('/api/checkout', checkoutHandler({
46
51
  ```typescript
47
52
  import { CustomerPortal } from "@dodopayments/express";
48
53
 
49
- app.get('/api/customer-portal', CustomerPortal({
50
- bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
51
- environment: "test_mode",
52
- }))
53
-
54
+ app.get(
55
+ "/api/customer-portal",
56
+ CustomerPortal({
57
+ bearerToken: process.env.DODO_PAYMENTS_API_KEY!,
58
+ environment: "test_mode",
59
+ }),
60
+ );
54
61
  ```
55
62
 
56
63
  #### Query Parameters
@@ -68,14 +75,16 @@ Returns 400 if `customer_id` is missing.
68
75
  // app/api/webhook/dodo-payments/route.ts
69
76
  import { Webhooks } from "@dodopayments/express";
70
77
 
71
- app.post('/api/webhook',
78
+ app.post(
79
+ "/api/webhook",
72
80
  Webhooks({
73
- webhookKey: process.env.DODO_PAYMENTS_WEBHOOK_SECRET!,
74
- onPayload: async (payload) => {
75
- // handle the payload
76
- },
77
- // ... other event handlers for granular control
78
- }))
81
+ webhookKey: process.env.DODO_PAYMENTS_WEBHOOK_SECRET!,
82
+ onPayload: async (payload) => {
83
+ // handle the payload
84
+ },
85
+ // ... other event handlers for granular control
86
+ }),
87
+ );
79
88
  ```
80
89
 
81
90
  ---
@@ -240,4 +249,5 @@ Use these inside your code as:
240
249
  process.env.DODO_PAYMENTS_API_KEY!
241
250
  process.env.DODO_PAYMENTS_WEBHOOK_SECRET!
242
251
 
243
- Security Note: Do NOT commit secrets to version control. Use .env files locally and secrets managers in deployment environments (e.g., AWS, Vercel, Heroku, etc.).
252
+ Security Note: Do NOT commit secrets to version control. Use .env files locally and secrets managers in deployment environments (e.g., AWS, Vercel, Heroku, etc.).
253
+ ```
package/dist/index.cjs CHANGED
@@ -1824,7 +1824,7 @@ var checkoutQuerySchema = zod.z.object({
1824
1824
  showDiscounts: zod.z.string().optional(),
1825
1825
  // Metadata (allow any key starting with metadata_)
1826
1826
  // We'll handle metadata separately in the handler
1827
- });
1827
+ }).catchall(zod.z.unknown());
1828
1828
  // Add Zod schema for dynamic checkout body
1829
1829
  var dynamicCheckoutBodySchema = zod.z
1830
1830
  .object({