@dodopayments/express 0.1.1 → 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 +42 -30
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A typescript library that exports Handlers for Checkout, Customer Portal, and We
|
|
|
6
6
|
|
|
7
7
|
## Documentation
|
|
8
8
|
|
|
9
|
-
Detailed documentation can be found at [Dodo Payments
|
|
9
|
+
Detailed documentation can be found at [Dodo Payments Express adaptor](https://docs.dodopayments.com/developer-resources/express-adaptor)
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -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
|
|
26
|
-
|
|
27
|
-
app.get(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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(
|
|
50
|
-
|
|
51
|
-
|
|
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,18 +75,22 @@ 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(
|
|
78
|
+
app.post(
|
|
79
|
+
"/api/webhook",
|
|
72
80
|
Webhooks({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
---
|
|
82
91
|
|
|
92
|
+
## Prompt for LLM
|
|
93
|
+
|
|
83
94
|
```
|
|
84
95
|
You are an expert Express.js developer assistant. Your task is to guide a user through integrating the @dodopayments/express adapter into their existing Express.js project.
|
|
85
96
|
|
|
@@ -238,4 +249,5 @@ Use these inside your code as:
|
|
|
238
249
|
process.env.DODO_PAYMENTS_API_KEY!
|
|
239
250
|
process.env.DODO_PAYMENTS_WEBHOOK_SECRET!
|
|
240
251
|
|
|
241
|
-
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({
|