cashclaw 1.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/LICENSE +21 -0
- package/README.md +281 -0
- package/bin/cashclaw.js +2 -0
- package/missions/blog-post-1500.json +21 -0
- package/missions/blog-post-500.json +19 -0
- package/missions/lead-list-50.json +20 -0
- package/missions/seo-audit-basic.json +19 -0
- package/missions/seo-audit-pro.json +23 -0
- package/missions/social-media-weekly.json +19 -0
- package/missions/whatsapp-setup.json +22 -0
- package/package.json +45 -0
- package/skills/cashclaw-content-writer/SKILL.md +245 -0
- package/skills/cashclaw-core/SKILL.md +251 -0
- package/skills/cashclaw-invoicer/SKILL.md +395 -0
- package/skills/cashclaw-invoicer/scripts/stripe-ops.js +441 -0
- package/skills/cashclaw-lead-generator/SKILL.md +246 -0
- package/skills/cashclaw-lead-generator/scripts/scraper.js +356 -0
- package/skills/cashclaw-seo-auditor/SKILL.md +240 -0
- package/skills/cashclaw-seo-auditor/scripts/audit.js +401 -0
- package/skills/cashclaw-social-media/SKILL.md +374 -0
- package/skills/cashclaw-whatsapp-manager/SKILL.md +357 -0
- package/src/cli/commands/dashboard.js +72 -0
- package/src/cli/commands/init.js +290 -0
- package/src/cli/commands/status.js +174 -0
- package/src/cli/index.js +496 -0
- package/src/cli/utils/banner.js +44 -0
- package/src/cli/utils/config.js +170 -0
- package/src/dashboard/public/app.js +329 -0
- package/src/dashboard/public/index.html +139 -0
- package/src/dashboard/public/style.css +464 -0
- package/src/dashboard/server.js +224 -0
- package/src/engine/earnings-tracker.js +184 -0
- package/src/engine/mission-runner.js +224 -0
- package/src/engine/scheduler.js +139 -0
- package/src/integrations/hyrve-bridge.js +213 -0
- package/src/integrations/openclaw-bridge.js +207 -0
- package/src/integrations/stripe-connect.js +204 -0
- package/templates/config.default.json +83 -0
- package/templates/invoice.html +260 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cashclaw-invoicer
|
|
3
|
+
description: Handles invoice creation, payment link generation, payment status tracking, and automated reminders via Stripe API. Supports multi-currency billing and recurring payments.
|
|
4
|
+
metadata:
|
|
5
|
+
{
|
|
6
|
+
"openclaw":
|
|
7
|
+
{
|
|
8
|
+
"emoji": "\U0001F4B3",
|
|
9
|
+
"requires": { "bins": ["node"], "env": ["STRIPE_SECRET_KEY"] },
|
|
10
|
+
"install":
|
|
11
|
+
[
|
|
12
|
+
{
|
|
13
|
+
"id": "npm",
|
|
14
|
+
"kind": "node",
|
|
15
|
+
"package": "cashclaw",
|
|
16
|
+
"bins": ["cashclaw"],
|
|
17
|
+
"label": "Install CashClaw via npm"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# CashClaw Invoicer
|
|
25
|
+
|
|
26
|
+
You handle all payment operations for CashClaw. You create invoices, generate
|
|
27
|
+
payment links, track payment status, and send automated reminders. Every dollar
|
|
28
|
+
earned must be tracked accurately. This is the skill that turns delivered work
|
|
29
|
+
into collected revenue.
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
1. **Stripe account** with API access enabled.
|
|
34
|
+
2. **STRIPE_SECRET_KEY** set in environment or `~/.cashclaw/config.json`.
|
|
35
|
+
3. Node.js 18+ installed (for the stripe-ops.js script).
|
|
36
|
+
|
|
37
|
+
Install the Stripe SDK:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install stripe
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Invoice Creation
|
|
44
|
+
|
|
45
|
+
### When to Invoice
|
|
46
|
+
|
|
47
|
+
- **Pre-payment model**: Create a payment link at ACCEPT stage. Client pays before work begins.
|
|
48
|
+
- **Post-payment model**: Create an invoice at DELIVER stage. Client pays after receiving deliverables.
|
|
49
|
+
- **Recurring services**: Create a Stripe subscription for monthly services (WhatsApp management, social media).
|
|
50
|
+
|
|
51
|
+
### Invoice Data Structure
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mission_id": "MISSION-20260223-001",
|
|
56
|
+
"client": {
|
|
57
|
+
"name": "Acme Corp",
|
|
58
|
+
"email": "billing@acme.com"
|
|
59
|
+
},
|
|
60
|
+
"items": [
|
|
61
|
+
{
|
|
62
|
+
"description": "SEO Audit - Standard Tier",
|
|
63
|
+
"quantity": 1,
|
|
64
|
+
"unit_amount": 2900,
|
|
65
|
+
"currency": "usd"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"due_date": "2026-03-02",
|
|
69
|
+
"notes": "Thank you for choosing CashClaw!",
|
|
70
|
+
"metadata": {
|
|
71
|
+
"mission_id": "MISSION-20260223-001",
|
|
72
|
+
"service": "seo-audit",
|
|
73
|
+
"tier": "standard"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Using the stripe-ops.js Script
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Create a payment link
|
|
82
|
+
node scripts/stripe-ops.js create-link \
|
|
83
|
+
--amount 2900 \
|
|
84
|
+
--currency usd \
|
|
85
|
+
--description "SEO Audit - Standard" \
|
|
86
|
+
--mission "MISSION-20260223-001"
|
|
87
|
+
|
|
88
|
+
# Create a full invoice
|
|
89
|
+
node scripts/stripe-ops.js create-invoice \
|
|
90
|
+
--email "billing@acme.com" \
|
|
91
|
+
--amount 2900 \
|
|
92
|
+
--currency usd \
|
|
93
|
+
--description "SEO Audit - Standard" \
|
|
94
|
+
--due-days 7
|
|
95
|
+
|
|
96
|
+
# Check payment status
|
|
97
|
+
node scripts/stripe-ops.js check-status \
|
|
98
|
+
--invoice "in_1234567890"
|
|
99
|
+
|
|
100
|
+
# Send payment reminder
|
|
101
|
+
node scripts/stripe-ops.js send-reminder \
|
|
102
|
+
--invoice "in_1234567890" \
|
|
103
|
+
--template "gentle"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Using Stripe API Directly (curl)
|
|
107
|
+
|
|
108
|
+
If the script is unavailable, use curl with the Stripe API:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Create a customer
|
|
112
|
+
curl https://api.stripe.com/v1/customers \
|
|
113
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
114
|
+
-d "email=client@example.com" \
|
|
115
|
+
-d "name=Client Name" \
|
|
116
|
+
-d "metadata[mission_id]=MISSION-20260223-001"
|
|
117
|
+
|
|
118
|
+
# Create an invoice item
|
|
119
|
+
curl https://api.stripe.com/v1/invoiceitems \
|
|
120
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
121
|
+
-d "customer=cus_xxxxx" \
|
|
122
|
+
-d "amount=2900" \
|
|
123
|
+
-d "currency=usd" \
|
|
124
|
+
-d "description=SEO Audit - Standard Tier"
|
|
125
|
+
|
|
126
|
+
# Create and send the invoice
|
|
127
|
+
curl https://api.stripe.com/v1/invoices \
|
|
128
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
129
|
+
-d "customer=cus_xxxxx" \
|
|
130
|
+
-d "collection_method=send_invoice" \
|
|
131
|
+
-d "days_until_due=7" \
|
|
132
|
+
-d "auto_advance=true"
|
|
133
|
+
|
|
134
|
+
# Finalize the invoice
|
|
135
|
+
curl -X POST https://api.stripe.com/v1/invoices/in_xxxxx/finalize \
|
|
136
|
+
-u "$STRIPE_SECRET_KEY:"
|
|
137
|
+
|
|
138
|
+
# Send the invoice
|
|
139
|
+
curl -X POST https://api.stripe.com/v1/invoices/in_xxxxx/send \
|
|
140
|
+
-u "$STRIPE_SECRET_KEY:"
|
|
141
|
+
|
|
142
|
+
# Create a payment link (one-time)
|
|
143
|
+
curl https://api.stripe.com/v1/payment_links \
|
|
144
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
145
|
+
-d "line_items[0][price_data][currency]=usd" \
|
|
146
|
+
-d "line_items[0][price_data][product_data][name]=SEO Audit" \
|
|
147
|
+
-d "line_items[0][price_data][unit_amount]=2900" \
|
|
148
|
+
-d "line_items[0][quantity]=1"
|
|
149
|
+
|
|
150
|
+
# Check invoice status
|
|
151
|
+
curl https://api.stripe.com/v1/invoices/in_xxxxx \
|
|
152
|
+
-u "$STRIPE_SECRET_KEY:"
|
|
153
|
+
|
|
154
|
+
# List unpaid invoices
|
|
155
|
+
curl "https://api.stripe.com/v1/invoices?status=open&limit=100" \
|
|
156
|
+
-u "$STRIPE_SECRET_KEY:"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Payment Reminder Flow
|
|
160
|
+
|
|
161
|
+
Automated reminders follow this exact schedule:
|
|
162
|
+
|
|
163
|
+
### Day 0: Invoice Sent
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Subject: Invoice #{number} from {Business Name}
|
|
167
|
+
|
|
168
|
+
Hi {name},
|
|
169
|
+
|
|
170
|
+
Please find your invoice for {service} attached.
|
|
171
|
+
|
|
172
|
+
Amount: {currency} {amount}
|
|
173
|
+
Due Date: {due_date}
|
|
174
|
+
|
|
175
|
+
Pay now: {payment_link}
|
|
176
|
+
|
|
177
|
+
Thank you for your business!
|
|
178
|
+
|
|
179
|
+
Best,
|
|
180
|
+
{Business Name}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Day 3: Gentle Reminder
|
|
184
|
+
|
|
185
|
+
Only send if invoice is still unpaid.
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Subject: Friendly reminder: Invoice #{number}
|
|
189
|
+
|
|
190
|
+
Hi {name},
|
|
191
|
+
|
|
192
|
+
Just a quick reminder that invoice #{number} for {amount} is
|
|
193
|
+
due on {due_date}.
|
|
194
|
+
|
|
195
|
+
You can pay securely here: {payment_link}
|
|
196
|
+
|
|
197
|
+
If you have already paid, please disregard this message.
|
|
198
|
+
|
|
199
|
+
Thanks!
|
|
200
|
+
{Business Name}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Day 7: Follow-up
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
Subject: Invoice #{number} - Payment due
|
|
207
|
+
|
|
208
|
+
Hi {name},
|
|
209
|
+
|
|
210
|
+
Your invoice #{number} for {amount} is now past due.
|
|
211
|
+
|
|
212
|
+
We would appreciate it if you could process payment at your
|
|
213
|
+
earliest convenience: {payment_link}
|
|
214
|
+
|
|
215
|
+
If there is an issue with the invoice or you need to discuss
|
|
216
|
+
payment arrangements, please let us know.
|
|
217
|
+
|
|
218
|
+
Best regards,
|
|
219
|
+
{Business Name}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Day 14: Final Notice
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
Subject: Final notice: Invoice #{number} overdue
|
|
226
|
+
|
|
227
|
+
Hi {name},
|
|
228
|
+
|
|
229
|
+
This is our final reminder regarding invoice #{number} for
|
|
230
|
+
{amount}, which is now 14 days past due.
|
|
231
|
+
|
|
232
|
+
Please process payment immediately: {payment_link}
|
|
233
|
+
|
|
234
|
+
If we do not receive payment or hear from you within 48 hours,
|
|
235
|
+
we may need to pause any ongoing services.
|
|
236
|
+
|
|
237
|
+
If there are any issues, please reach out so we can work
|
|
238
|
+
something out.
|
|
239
|
+
|
|
240
|
+
Regards,
|
|
241
|
+
{Business Name}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Reminder Rules
|
|
245
|
+
|
|
246
|
+
1. Never send more than 1 reminder per day.
|
|
247
|
+
2. Stop reminders immediately once payment is received.
|
|
248
|
+
3. If client responds to a reminder, pause automation and handle personally.
|
|
249
|
+
4. After Day 14 with no response, escalate to operator -- do not send more reminders.
|
|
250
|
+
5. Track all reminder events in `~/.cashclaw/ledger.jsonl`.
|
|
251
|
+
|
|
252
|
+
## Multi-Currency Support
|
|
253
|
+
|
|
254
|
+
Supported currencies and their Stripe codes:
|
|
255
|
+
|
|
256
|
+
| Currency | Code | Smallest Unit | Example |
|
|
257
|
+
|----------|------|---------------|---------|
|
|
258
|
+
| US Dollar | usd | cents | $29.00 = 2900 |
|
|
259
|
+
| Euro | eur | cents | 29.00 EUR = 2900 |
|
|
260
|
+
| British Pound | gbp | pence | 29.00 GBP = 2900 |
|
|
261
|
+
| Turkish Lira | try | kurus | 29.00 TRY = 2900 |
|
|
262
|
+
| Canadian Dollar | cad | cents | $29.00 CAD = 2900 |
|
|
263
|
+
| Australian Dollar | aud | cents | $29.00 AUD = 2900 |
|
|
264
|
+
|
|
265
|
+
**Important**: Stripe uses the smallest currency unit (cents, pence, etc.).
|
|
266
|
+
Always multiply the display amount by 100 before sending to Stripe.
|
|
267
|
+
|
|
268
|
+
### Currency Detection
|
|
269
|
+
|
|
270
|
+
- Default to USD unless client specifies otherwise.
|
|
271
|
+
- Detect from client's location or previous invoices.
|
|
272
|
+
- Always confirm currency with client before invoicing.
|
|
273
|
+
|
|
274
|
+
## Payment Tracking
|
|
275
|
+
|
|
276
|
+
### Ledger Entry Format
|
|
277
|
+
|
|
278
|
+
Every payment event is logged to `~/.cashclaw/ledger.jsonl`:
|
|
279
|
+
|
|
280
|
+
```json
|
|
281
|
+
{"ts":"2026-02-23T12:00:00Z","event":"invoice_created","mission_id":"MISSION-20260223-001","invoice_id":"in_xxx","amount":2900,"currency":"usd"}
|
|
282
|
+
{"ts":"2026-02-23T12:01:00Z","event":"invoice_sent","mission_id":"MISSION-20260223-001","invoice_id":"in_xxx"}
|
|
283
|
+
{"ts":"2026-02-23T14:30:00Z","event":"payment_received","mission_id":"MISSION-20260223-001","invoice_id":"in_xxx","amount":2900,"currency":"usd","payment_id":"pi_xxx"}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Dashboard Update
|
|
287
|
+
|
|
288
|
+
After every payment event, update `~/.cashclaw/dashboard.json`:
|
|
289
|
+
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"pending_payments": [
|
|
293
|
+
{
|
|
294
|
+
"invoice_id": "in_xxx",
|
|
295
|
+
"mission_id": "MISSION-20260223-001",
|
|
296
|
+
"amount": 2900,
|
|
297
|
+
"currency": "usd",
|
|
298
|
+
"status": "open",
|
|
299
|
+
"due_date": "2026-03-02",
|
|
300
|
+
"reminder_stage": 0
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"recent_payments": [
|
|
304
|
+
{
|
|
305
|
+
"invoice_id": "in_yyy",
|
|
306
|
+
"amount": 900,
|
|
307
|
+
"currency": "usd",
|
|
308
|
+
"paid_at": "2026-02-22T10:00:00Z"
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Refund Handling
|
|
315
|
+
|
|
316
|
+
If a client requests a refund:
|
|
317
|
+
|
|
318
|
+
1. Verify the original payment in Stripe.
|
|
319
|
+
2. Determine refund type:
|
|
320
|
+
- **Full refund**: Client unhappy with deliverable. Process immediately.
|
|
321
|
+
- **Partial refund**: Scope reduced or partial delivery. Calculate pro-rata.
|
|
322
|
+
3. Process via Stripe:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Full refund
|
|
326
|
+
curl https://api.stripe.com/v1/refunds \
|
|
327
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
328
|
+
-d "payment_intent=pi_xxxxx"
|
|
329
|
+
|
|
330
|
+
# Partial refund
|
|
331
|
+
curl https://api.stripe.com/v1/refunds \
|
|
332
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
333
|
+
-d "payment_intent=pi_xxxxx" \
|
|
334
|
+
-d "amount=1500"
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
4. Log the refund event in the ledger.
|
|
338
|
+
5. Update mission status to `refunded`.
|
|
339
|
+
6. Send confirmation to client.
|
|
340
|
+
|
|
341
|
+
## Recurring Billing
|
|
342
|
+
|
|
343
|
+
For monthly services (WhatsApp Manager, Social Media):
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Create a product
|
|
347
|
+
curl https://api.stripe.com/v1/products \
|
|
348
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
349
|
+
-d "name=Social Media Management - Monthly Full" \
|
|
350
|
+
-d "metadata[service]=social-media" \
|
|
351
|
+
-d "metadata[tier]=monthly-full"
|
|
352
|
+
|
|
353
|
+
# Create a recurring price
|
|
354
|
+
curl https://api.stripe.com/v1/prices \
|
|
355
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
356
|
+
-d "product=prod_xxxxx" \
|
|
357
|
+
-d "unit_amount=4900" \
|
|
358
|
+
-d "currency=usd" \
|
|
359
|
+
-d "recurring[interval]=month"
|
|
360
|
+
|
|
361
|
+
# Create a subscription
|
|
362
|
+
curl https://api.stripe.com/v1/subscriptions \
|
|
363
|
+
-u "$STRIPE_SECRET_KEY:" \
|
|
364
|
+
-d "customer=cus_xxxxx" \
|
|
365
|
+
-d "items[0][price]=price_xxxxx"
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Error Handling
|
|
369
|
+
|
|
370
|
+
| Stripe Error | Meaning | Action |
|
|
371
|
+
|-------------|---------|--------|
|
|
372
|
+
| `card_declined` | Card was declined | Ask client for alternative payment method |
|
|
373
|
+
| `expired_card` | Card has expired | Notify client to update card |
|
|
374
|
+
| `incorrect_cvc` | Wrong CVC | Ask client to retry with correct CVC |
|
|
375
|
+
| `processing_error` | Stripe processing issue | Retry after 5 minutes |
|
|
376
|
+
| `rate_limit` | Too many API calls | Wait 60 seconds, then retry |
|
|
377
|
+
|
|
378
|
+
Never expose raw Stripe error messages to clients. Translate them to
|
|
379
|
+
human-friendly messages.
|
|
380
|
+
|
|
381
|
+
## Example Commands
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Create and send an invoice
|
|
385
|
+
cashclaw invoice --client "billing@acme.com" --amount 29 --service "SEO Audit" --due 7
|
|
386
|
+
|
|
387
|
+
# Check all unpaid invoices
|
|
388
|
+
cashclaw invoice --list --status unpaid
|
|
389
|
+
|
|
390
|
+
# Send reminders for overdue invoices
|
|
391
|
+
cashclaw invoice --remind --overdue
|
|
392
|
+
|
|
393
|
+
# Process a refund
|
|
394
|
+
cashclaw invoice --refund --invoice "in_xxxxx" --amount 29
|
|
395
|
+
```
|