dodopayments-cli 2.0.0
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/.github/ISSUE_TEMPLATE/bug_report.yml +125 -0
- package/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +88 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +69 -0
- package/.github/workflows/publish.yml +63 -0
- package/CODE_OF_CONDUCT.md +133 -0
- package/CONTRIBUTING.md +200 -0
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/SECURITY.md +98 -0
- package/build-binaries.ts +22 -0
- package/dist/index.js +28 -0
- package/dodo-webhooks/functions/generate-dispute-data.ts +123 -0
- package/dodo-webhooks/functions/generate-licence-data.ts +39 -0
- package/dodo-webhooks/functions/generate-payment-data.ts +101 -0
- package/dodo-webhooks/functions/generate-refund-data.ts +44 -0
- package/dodo-webhooks/functions/generate-subscription-data.ts +153 -0
- package/dodo-webhooks/functions/supported-events.ts +24 -0
- package/dodo-webhooks/index.ts +207 -0
- package/dodo-webhooks/types/baseArgs.ts +9 -0
- package/index.ts +438 -0
- package/package.json +41 -0
- package/tsconfig.json +29 -0
- package/utils/currency-to-symbol-map.ts +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dodo Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Dodo Payments CLI
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>A powerful Command Line Interface for Dodo Payments</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/dodopayments-cli">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/dodopayments-cli?color=cb3837&label=npm&logo=npm" alt="npm version" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://discord.gg/bYqAp4ayYh">
|
|
12
|
+
<img src="https://img.shields.io/discord/1305511580854779984?label=Discord&logo=discord&color=5865F2" alt="Discord" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="LICENSE">
|
|
15
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT" />
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="#installation">Installation</a> •
|
|
21
|
+
<a href="#authentication">Authentication</a> •
|
|
22
|
+
<a href="#usage">Usage</a> •
|
|
23
|
+
<a href="#webhook-testing">Webhooks</a> •
|
|
24
|
+
<a href="#contributing">Contributing</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Manage your [Dodo Payments](https://dodopayments.com/) resources and test webhooks directly from the terminal. Built for developers who prefer the command line.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
We provide various ways to install the CLI:
|
|
34
|
+
|
|
35
|
+
> **Note:** If you have Node or Bun installed, it's highly recommended to use that installation method.
|
|
36
|
+
|
|
37
|
+
### Using npm (Recommended)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g dodopayments-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Using Bun
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun install -g dodopayments-cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Manual Installation
|
|
50
|
+
|
|
51
|
+
1. Download the latest release from [GitHub Releases](https://github.com/dodopayments/dodopayments-cli/releases) that matches your system.
|
|
52
|
+
|
|
53
|
+
2. Extract the downloaded file to a directory of your choice.
|
|
54
|
+
|
|
55
|
+
3. Rename the binary file to `dodo`:
|
|
56
|
+
- **Linux/macOS:** `mv ./dodopayments-cli-* ./dodo`
|
|
57
|
+
- **Windows:** `ren .\dodopayments-cli-* .\dodo`
|
|
58
|
+
|
|
59
|
+
4. Move the binary to a directory in your system's PATH:
|
|
60
|
+
- **Linux/macOS:** `sudo mv ./dodo /usr/local/bin/`
|
|
61
|
+
- **Windows:** `move .\dodo C:\Windows\System32\dodo` (requires admin mode)
|
|
62
|
+
|
|
63
|
+
## Authentication
|
|
64
|
+
|
|
65
|
+
Before using the CLI, you must authenticate:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
dodo login
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This command will:
|
|
72
|
+
1. Open your browser to the Dodo Payments API Keys page
|
|
73
|
+
2. Prompt you to enter your API Key
|
|
74
|
+
3. Ask you to select the environment (**Test Mode** or **Live Mode**)
|
|
75
|
+
4. Store your credentials locally to `~/.dodopayments/api-key`
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
The general syntax is:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
dodo <category> <sub-command>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Products
|
|
86
|
+
|
|
87
|
+
Manage your products catalog.
|
|
88
|
+
|
|
89
|
+
| Command | Description |
|
|
90
|
+
|---------|-------------|
|
|
91
|
+
| `dodo products list` | List all products |
|
|
92
|
+
| `dodo products create` | Open dashboard to create a product |
|
|
93
|
+
| `dodo products info` | View details for a specific product |
|
|
94
|
+
|
|
95
|
+
### Payments
|
|
96
|
+
|
|
97
|
+
View payment transactions.
|
|
98
|
+
|
|
99
|
+
| Command | Description |
|
|
100
|
+
|---------|-------------|
|
|
101
|
+
| `dodo payments list` | List all payments |
|
|
102
|
+
| `dodo payments info` | Get information about a specific payment |
|
|
103
|
+
|
|
104
|
+
### Customers
|
|
105
|
+
|
|
106
|
+
Manage your customer base.
|
|
107
|
+
|
|
108
|
+
| Command | Description |
|
|
109
|
+
|---------|-------------|
|
|
110
|
+
| `dodo customers list` | List all customers |
|
|
111
|
+
| `dodo customers create` | Create a new customer profile |
|
|
112
|
+
| `dodo customers update` | Update an existing customer's details |
|
|
113
|
+
|
|
114
|
+
### Discounts
|
|
115
|
+
|
|
116
|
+
Manage coupons and discounts.
|
|
117
|
+
|
|
118
|
+
| Command | Description |
|
|
119
|
+
|---------|-------------|
|
|
120
|
+
| `dodo discounts list` | List all discounts |
|
|
121
|
+
| `dodo discounts create` | Create a new percentage-based discount |
|
|
122
|
+
| `dodo discounts delete` | Remove a discount by ID |
|
|
123
|
+
|
|
124
|
+
### Licenses
|
|
125
|
+
|
|
126
|
+
Manage software licenses.
|
|
127
|
+
|
|
128
|
+
| Command | Description |
|
|
129
|
+
|---------|-------------|
|
|
130
|
+
| `dodo licences list` | List all licenses |
|
|
131
|
+
|
|
132
|
+
## Webhook Testing
|
|
133
|
+
|
|
134
|
+
The CLI includes a robust tool for testing webhooks by simulating events.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
dodo wh
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
> **Note:** The webhook testing tool doesn't support signing requests yet. Please disable webhook signature verification while testing. A simple way to do this is using `unsafe_unwrap()` instead of `unwrap()` in the webhook endpoint **during testing only**.
|
|
141
|
+
|
|
142
|
+
This interactive tool guides you through:
|
|
143
|
+
1. Setting a destination **endpoint URL**
|
|
144
|
+
2. Configuring **Business ID**, **Product ID**, and **Metadata**
|
|
145
|
+
3. Selecting a specific **Event** to trigger
|
|
146
|
+
|
|
147
|
+
### Supported Webhook Events
|
|
148
|
+
|
|
149
|
+
| Category | Events |
|
|
150
|
+
|----------|--------|
|
|
151
|
+
| **Subscription** | `active`, `updated`, `on_hold`, `renewed`, `plan_changed`, `cancelled`, `failed`, `expired` |
|
|
152
|
+
| **Payment** | `success`, `failed`, `processing`, `cancelled` |
|
|
153
|
+
| **Refund** | `success`, `failed` |
|
|
154
|
+
| **Dispute** | `opened`, `expired`, `accepted`, `cancelled`, `challenged`, `won`, `lost` |
|
|
155
|
+
| **License** | `created` |
|
|
156
|
+
|
|
157
|
+
## Contributing
|
|
158
|
+
|
|
159
|
+
We welcome contributions from the community! Whether you're fixing bugs, adding new features, or improving documentation, your help is appreciated.
|
|
160
|
+
|
|
161
|
+
Please read our [Contributing Guide](./CONTRIBUTING.md) to get started. We also have a [Code of Conduct](./CODE_OF_CONDUCT.md) that we expect all contributors to follow.
|
|
162
|
+
|
|
163
|
+
### Ways to Contribute
|
|
164
|
+
|
|
165
|
+
- Report bugs and suggest features
|
|
166
|
+
- Improve documentation
|
|
167
|
+
- Add new CLI commands
|
|
168
|
+
- Write tests
|
|
169
|
+
- Review pull requests
|
|
170
|
+
|
|
171
|
+
## Support
|
|
172
|
+
|
|
173
|
+
- [Discord Community](https://discord.gg/bYqAp4ayYh) - Get help and discuss with the community
|
|
174
|
+
- [GitHub Issues](https://github.com/dodopayments/dodopayments-cli/issues) - Report bugs or request features
|
|
175
|
+
- [Documentation](https://docs.dodopayments.com) - Learn more about Dodo Payments
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
<p align="center">
|
|
184
|
+
Made with ❤️ by <a href="https://dodopayments.com">Dodo Payments</a>
|
|
185
|
+
</p>
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We actively support the following versions with security updates:
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 0.1.x | :white_check_mark: |
|
|
10
|
+
|
|
11
|
+
## Reporting a Vulnerability
|
|
12
|
+
|
|
13
|
+
We take the security of Dodo Payments CLI seriously. If you believe you have found a security vulnerability, please report it to us responsibly.
|
|
14
|
+
|
|
15
|
+
### How to Report
|
|
16
|
+
|
|
17
|
+
**Please do NOT report security vulnerabilities through public GitHub issues.**
|
|
18
|
+
|
|
19
|
+
Instead, please report them via one of the following methods:
|
|
20
|
+
|
|
21
|
+
1. **GitHub Security Advisories** (Preferred): [Create a security advisory](https://github.com/dodopayments/dodopayments-cli/security/advisories/new)
|
|
22
|
+
|
|
23
|
+
2. **Email**: Send an email to [security@dodopayments.com](mailto:security@dodopayments.com)
|
|
24
|
+
|
|
25
|
+
### What to Include
|
|
26
|
+
|
|
27
|
+
Please include the following information in your report:
|
|
28
|
+
|
|
29
|
+
- Type of vulnerability (e.g., credential exposure, code injection, etc.)
|
|
30
|
+
- Full paths of source file(s) related to the vulnerability
|
|
31
|
+
- The location of the affected source code (tag/branch/commit or direct URL)
|
|
32
|
+
- Any special configuration required to reproduce the issue
|
|
33
|
+
- Step-by-step instructions to reproduce the issue
|
|
34
|
+
- Proof-of-concept or exploit code (if possible)
|
|
35
|
+
- Impact of the issue, including how an attacker might exploit it
|
|
36
|
+
|
|
37
|
+
### What to Expect
|
|
38
|
+
|
|
39
|
+
- **Acknowledgment**: We will acknowledge receipt of your vulnerability report within 48 hours.
|
|
40
|
+
|
|
41
|
+
- **Communication**: We will keep you informed of our progress throughout the process.
|
|
42
|
+
|
|
43
|
+
- **Resolution Timeline**: We aim to investigate and address security issues within 90 days, depending on complexity.
|
|
44
|
+
|
|
45
|
+
- **Disclosure**: We will coordinate with you on the timing of public disclosure.
|
|
46
|
+
|
|
47
|
+
- **Credit**: We will credit you for the discovery in our release notes and security advisory (unless you prefer to remain anonymous).
|
|
48
|
+
|
|
49
|
+
## Security Best Practices for Users
|
|
50
|
+
|
|
51
|
+
When using Dodo Payments CLI, please follow these security best practices:
|
|
52
|
+
|
|
53
|
+
### API Keys
|
|
54
|
+
|
|
55
|
+
- **Never share your API keys** with anyone
|
|
56
|
+
- **Use test mode keys** for development and testing
|
|
57
|
+
- **Rotate keys** if you suspect they may have been compromised
|
|
58
|
+
- The CLI stores your API key locally at `~/.dodopayments/api-key` - ensure this file has appropriate permissions
|
|
59
|
+
|
|
60
|
+
### Running the CLI
|
|
61
|
+
|
|
62
|
+
- **Download only from official sources**: npm, GitHub releases, or bun
|
|
63
|
+
- **Verify the package** before installation when possible
|
|
64
|
+
- **Keep the CLI updated** to the latest version
|
|
65
|
+
|
|
66
|
+
### Webhook Testing
|
|
67
|
+
|
|
68
|
+
- **Only test webhooks** against endpoints you control
|
|
69
|
+
- **Use test mode** for webhook testing when possible
|
|
70
|
+
- **Re-enable signature verification** after testing
|
|
71
|
+
|
|
72
|
+
## Local Storage
|
|
73
|
+
|
|
74
|
+
The CLI stores the following data locally:
|
|
75
|
+
|
|
76
|
+
| Data | Location | Purpose |
|
|
77
|
+
|------|----------|---------|
|
|
78
|
+
| API Key | `~/.dodopayments/api-key` | Authentication |
|
|
79
|
+
|
|
80
|
+
Ensure your home directory has appropriate access controls to protect this sensitive data.
|
|
81
|
+
|
|
82
|
+
## Vulnerability Disclosure Policy
|
|
83
|
+
|
|
84
|
+
We follow a coordinated vulnerability disclosure process:
|
|
85
|
+
|
|
86
|
+
1. Reporter submits vulnerability privately
|
|
87
|
+
2. We acknowledge and begin investigation
|
|
88
|
+
3. We develop and test a fix
|
|
89
|
+
4. We release the fix and publish a security advisory
|
|
90
|
+
5. We credit the reporter (if desired)
|
|
91
|
+
|
|
92
|
+
We ask that you:
|
|
93
|
+
|
|
94
|
+
- Give us reasonable time to address the issue before public disclosure
|
|
95
|
+
- Make a good faith effort to avoid privacy violations, destruction of data, and interruption of services
|
|
96
|
+
- Do not access or modify data that does not belong to you
|
|
97
|
+
|
|
98
|
+
Thank you for helping keep Dodo Payments CLI and our users safe!
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const targets: any = [
|
|
2
|
+
"bun-darwin-x64",
|
|
3
|
+
"bun-darwin-arm64",
|
|
4
|
+
"bun-linux-x64",
|
|
5
|
+
"bun-linux-arm64",
|
|
6
|
+
"bun-windows-x64"
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
// Loop through all targets and build them
|
|
10
|
+
for (const target of targets) {
|
|
11
|
+
await Bun.build({
|
|
12
|
+
entrypoints: ["./index.ts"],
|
|
13
|
+
outdir: `./dist/dodopayments-cli-${target.replace('bun-', '')}`,
|
|
14
|
+
target: "bun",
|
|
15
|
+
compile: {
|
|
16
|
+
// `as any` cause Bun doesn't provide type of exact platforms
|
|
17
|
+
target: target as any,
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
console.log(`Build complete! Binaries are in ./dist`);
|