ugarapi-mcp-server 1.1.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/DEPLOYMENT_GUIDE.md +343 -0
- package/GITHUB_SETUP_GUIDE.md +189 -0
- package/MARKETING_STRATEGY.md +418 -0
- package/OPENNODE_DEPLOY_GUIDE.md +191 -0
- package/OPENNODE_MANUAL_INTEGRATION.md +185 -0
- package/README.md +165 -0
- package/ai_service_business_plan.md +200 -0
- package/claude_desktop_config.json +14 -0
- package/main-v1.2-opennode.cpython-312.pyc +0 -0
- package/main-v1.2-opennode.py +588 -0
- package/main.py +395 -0
- package/package.json +29 -0
- package/requirements.txt +9 -0
- package/test_agent_simulator.py +296 -0
- package/ugarapi-banner.html +441 -0
- package/ugarapi-complete-package.zip +0 -0
- package/ugarapi-mcp-server.js +335 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
# Marketing to AI Agents - Complete Strategy
|
|
2
|
+
|
|
3
|
+
## Why This Is Different from Normal Marketing
|
|
4
|
+
|
|
5
|
+
AI agents don't browse Instagram or watch YouTube ads. They:
|
|
6
|
+
- Scan structured data (JSON, XML, OpenAPI specs)
|
|
7
|
+
- Follow programmatic discovery protocols
|
|
8
|
+
- Make decisions based on pricing, uptime, and API quality
|
|
9
|
+
- Share information through agent networks and marketplaces
|
|
10
|
+
|
|
11
|
+
Your marketing must be **machine-readable and discoverable**.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Phase 1: Make Your Service Discoverable (Week 1)
|
|
16
|
+
|
|
17
|
+
### 1. Structured Data Markup
|
|
18
|
+
|
|
19
|
+
**Already implemented in your code:**
|
|
20
|
+
- `/.well-known/ai-services.json` - AI agents check this URL
|
|
21
|
+
- OpenAPI/Swagger at `/docs` - auto-generated by FastAPI
|
|
22
|
+
- JSON-LD schema for service metadata
|
|
23
|
+
|
|
24
|
+
**Additional SEO for AI:**
|
|
25
|
+
```html
|
|
26
|
+
<!-- Add to a simple index.html if you create one -->
|
|
27
|
+
<script type="application/ld+json">
|
|
28
|
+
{
|
|
29
|
+
"@context": "https://schema.org",
|
|
30
|
+
"@type": "WebAPI",
|
|
31
|
+
"name": "AgentHub API",
|
|
32
|
+
"description": "Automated services for AI agents",
|
|
33
|
+
"documentation": "https://yourdomain.com/docs",
|
|
34
|
+
"termsOfService": "https://yourdomain.com/terms",
|
|
35
|
+
"provider": {
|
|
36
|
+
"@type": "Organization",
|
|
37
|
+
"name": "AgentHub"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Register with AI Agent Directories
|
|
44
|
+
|
|
45
|
+
**Free Directories (Register ASAP):**
|
|
46
|
+
|
|
47
|
+
1. **ToolHub.ai**
|
|
48
|
+
- List your API
|
|
49
|
+
- Tags: automation, data-extraction, blockchain
|
|
50
|
+
- Include pricing in BTC
|
|
51
|
+
|
|
52
|
+
2. **AIPlugins.io**
|
|
53
|
+
- Submit as API service
|
|
54
|
+
- Category: Business Services
|
|
55
|
+
- Highlight Lightning payments
|
|
56
|
+
|
|
57
|
+
3. **LangChain Integrations**
|
|
58
|
+
- Create custom tool wrapper
|
|
59
|
+
- Submit to community tools
|
|
60
|
+
- Code template:
|
|
61
|
+
```python
|
|
62
|
+
from langchain.tools import BaseTool
|
|
63
|
+
|
|
64
|
+
class AgentHubTool(BaseTool):
|
|
65
|
+
name = "agenthub_extract"
|
|
66
|
+
description = "Extract data from websites - pays via Bitcoin Lightning"
|
|
67
|
+
|
|
68
|
+
def _run(self, url, selectors):
|
|
69
|
+
# Call your API
|
|
70
|
+
pass
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
4. **AutoGPT Plugin Directory**
|
|
74
|
+
- Fork AutoGPT plugins repo
|
|
75
|
+
- Add your service
|
|
76
|
+
- Submit pull request
|
|
77
|
+
|
|
78
|
+
**Paid Directories (Month 2+):**
|
|
79
|
+
|
|
80
|
+
5. **RapidAPI Hub** ($0 - they take commission)
|
|
81
|
+
- Massive API marketplace
|
|
82
|
+
- AI agents search here
|
|
83
|
+
- Add Lightning as payment option
|
|
84
|
+
|
|
85
|
+
6. **Apify Store**
|
|
86
|
+
- List as automation tool
|
|
87
|
+
- They have AI agent customers
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Phase 2: MCP (Model Context Protocol) Integration (Week 2)
|
|
92
|
+
|
|
93
|
+
MCP is THE standard for AI agents to discover services. Critical for success.
|
|
94
|
+
|
|
95
|
+
### Create MCP Server
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"name": "agenthub",
|
|
100
|
+
"version": "1.0.0",
|
|
101
|
+
"description": "AI services with Bitcoin Lightning payments",
|
|
102
|
+
"tools": [
|
|
103
|
+
{
|
|
104
|
+
"name": "extract_web_data",
|
|
105
|
+
"description": "Extract structured data from any URL",
|
|
106
|
+
"inputSchema": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"url": {"type": "string"},
|
|
110
|
+
"selectors": {"type": "object"}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"resources": [
|
|
116
|
+
{
|
|
117
|
+
"uri": "https://yourdomain.com/.well-known/ai-services.json",
|
|
118
|
+
"name": "Service Manifest"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Submit to:**
|
|
125
|
+
- MCP Registry (mcp.run or equivalent)
|
|
126
|
+
- Claude MCP integrations
|
|
127
|
+
- Anthropic developer forum
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Phase 3: Content Marketing (Ongoing)
|
|
132
|
+
|
|
133
|
+
### Technical Blog Posts
|
|
134
|
+
|
|
135
|
+
AI agents (and their developers) search for solutions. Write:
|
|
136
|
+
|
|
137
|
+
1. **"How to Accept Bitcoin Lightning Payments in Your API"**
|
|
138
|
+
- Attracts developers building similar services
|
|
139
|
+
- They might integrate YOUR service
|
|
140
|
+
|
|
141
|
+
2. **"Web Scraping API: AI Agents vs Traditional Tools"**
|
|
142
|
+
- SEO for "web scraping API"
|
|
143
|
+
- Show why AI agents choose you
|
|
144
|
+
|
|
145
|
+
3. **"Building AI-to-AI Commerce with Smart Contracts"**
|
|
146
|
+
- Thought leadership
|
|
147
|
+
- Links to your service
|
|
148
|
+
|
|
149
|
+
**Publish on:**
|
|
150
|
+
- dev.to (developer audience)
|
|
151
|
+
- Medium (broader reach)
|
|
152
|
+
- Your own blog (SEO)
|
|
153
|
+
|
|
154
|
+
### GitHub Presence
|
|
155
|
+
|
|
156
|
+
Create **public repo** with:
|
|
157
|
+
```
|
|
158
|
+
agenthub-examples/
|
|
159
|
+
├── python/
|
|
160
|
+
│ ├── basic_usage.py
|
|
161
|
+
│ ├── langchain_integration.py
|
|
162
|
+
│ └── autogpt_plugin.py
|
|
163
|
+
├── nodejs/
|
|
164
|
+
│ └── example.js
|
|
165
|
+
├── curl/
|
|
166
|
+
│ └── examples.sh
|
|
167
|
+
└── README.md
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**GitHub tags:** `ai-agents`, `bitcoin-lightning`, `api`, `web-scraping`, `automation`
|
|
171
|
+
|
|
172
|
+
AI developers will find this and integrate.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Phase 4: Strategic Partnerships (Month 1-2)
|
|
177
|
+
|
|
178
|
+
### Partner with AI Agent Platforms
|
|
179
|
+
|
|
180
|
+
**Reach out to:**
|
|
181
|
+
|
|
182
|
+
1. **LangChain** (langchain.com)
|
|
183
|
+
- Offer free tier for their users
|
|
184
|
+
- Get featured as integration
|
|
185
|
+
- Email: partnerships@langchain.com
|
|
186
|
+
|
|
187
|
+
2. **AgentGPT** (agentgpt.reworkd.ai)
|
|
188
|
+
- Autonomous agent platform
|
|
189
|
+
- They need web extraction
|
|
190
|
+
- Twitter DM: @ReworkdAI
|
|
191
|
+
|
|
192
|
+
3. **AutoGPT**
|
|
193
|
+
- Most popular autonomous agent
|
|
194
|
+
- Submit as official plugin
|
|
195
|
+
- GitHub: Significant-Gravitas/Auto-GPT
|
|
196
|
+
|
|
197
|
+
4. **Zapier / Make.com**
|
|
198
|
+
- They're adding AI agents
|
|
199
|
+
- Apply to integration program
|
|
200
|
+
- Your API becomes a Zap action
|
|
201
|
+
|
|
202
|
+
### Developer Communities
|
|
203
|
+
|
|
204
|
+
**Post in:**
|
|
205
|
+
- r/LangChain (Reddit)
|
|
206
|
+
- r/AutoGPT (Reddit)
|
|
207
|
+
- HackerNews "Show HN: Bitcoin Lightning API for AI Agents"
|
|
208
|
+
- IndieHackers.com
|
|
209
|
+
- Twitter: #buildinpublic #aiagents
|
|
210
|
+
|
|
211
|
+
**Template announcement:**
|
|
212
|
+
```
|
|
213
|
+
🤖 Just launched: API services for AI agents
|
|
214
|
+
|
|
215
|
+
Problem: AI agents need reliable web extraction,
|
|
216
|
+
document timestamping, and API aggregation
|
|
217
|
+
|
|
218
|
+
Solution: Pay-per-use via Bitcoin Lightning ⚡
|
|
219
|
+
- No API keys to manage
|
|
220
|
+
- Instant micropayments
|
|
221
|
+
- 99.9% uptime SLA
|
|
222
|
+
|
|
223
|
+
Free tier: 100 requests
|
|
224
|
+
https://ugarapi.com
|
|
225
|
+
|
|
226
|
+
Built this in a weekend. AMA!
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Phase 5: Direct AI Agent Outreach (Month 2+)
|
|
232
|
+
|
|
233
|
+
### Programmatic Discovery
|
|
234
|
+
|
|
235
|
+
AI agents will find you automatically if you:
|
|
236
|
+
|
|
237
|
+
1. **Rank on Google for:**
|
|
238
|
+
- "web scraping API bitcoin"
|
|
239
|
+
- "AI agent services"
|
|
240
|
+
- "lightning payment API"
|
|
241
|
+
- Use these exact phrases in your site content
|
|
242
|
+
|
|
243
|
+
2. **Answer on Stack Overflow:**
|
|
244
|
+
- Search: "AI agent web scraping"
|
|
245
|
+
- Answer with: "I built an API for this..."
|
|
246
|
+
- Include link
|
|
247
|
+
|
|
248
|
+
3. **List on Comparison Sites:**
|
|
249
|
+
- AlternativeTo.net
|
|
250
|
+
- Product Hunt
|
|
251
|
+
- BetaList
|
|
252
|
+
|
|
253
|
+
### AI Agent "SEO"
|
|
254
|
+
|
|
255
|
+
Create a **sitemap.xml** specifically for AI agents:
|
|
256
|
+
```xml
|
|
257
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
258
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
259
|
+
<url>
|
|
260
|
+
<loc>https://yourdomain.com/.well-known/ai-services.json</loc>
|
|
261
|
+
<priority>1.0</priority>
|
|
262
|
+
</url>
|
|
263
|
+
<url>
|
|
264
|
+
<loc>https://yourdomain.com/docs</loc>
|
|
265
|
+
<priority>0.9</priority>
|
|
266
|
+
</url>
|
|
267
|
+
</urlset>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Metrics to Track
|
|
273
|
+
|
|
274
|
+
### Discovery Metrics
|
|
275
|
+
- API documentation pageviews
|
|
276
|
+
- `/docs` endpoint hits
|
|
277
|
+
- `/.well-known/ai-services.json` requests
|
|
278
|
+
- GitHub stars on examples repo
|
|
279
|
+
|
|
280
|
+
### Conversion Metrics
|
|
281
|
+
- Payment requests created
|
|
282
|
+
- Payment completion rate
|
|
283
|
+
- Service usage by endpoint
|
|
284
|
+
- Repeat usage rate
|
|
285
|
+
|
|
286
|
+
### Growth Metrics
|
|
287
|
+
- New AI agents per week
|
|
288
|
+
- Total requests per day
|
|
289
|
+
- Revenue per AI agent
|
|
290
|
+
- Service usage patterns
|
|
291
|
+
|
|
292
|
+
**Tool:** Set up PostHog or Mixpanel (free tier)
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## The Flywheel Effect
|
|
297
|
+
|
|
298
|
+
Once you get 10-20 AI agents using you regularly:
|
|
299
|
+
|
|
300
|
+
1. **AI agents talk to each other** (via shared memory, logs)
|
|
301
|
+
2. **Developers see your service** in their agent's usage logs
|
|
302
|
+
3. **They tell other developers** (GitHub, Twitter)
|
|
303
|
+
4. **More AI agents discover you** automatically
|
|
304
|
+
5. **Repeat**
|
|
305
|
+
|
|
306
|
+
This compounds FAST in AI agent ecosystems.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Quick Wins (Do These First)
|
|
311
|
+
|
|
312
|
+
**Week 1 checklist:**
|
|
313
|
+
- [ ] Register on ToolHub.ai
|
|
314
|
+
- [ ] Register on AIPlugins.io
|
|
315
|
+
- [ ] Create GitHub examples repo
|
|
316
|
+
- [ ] Post on r/LangChain
|
|
317
|
+
- [ ] Submit MCP server config
|
|
318
|
+
- [ ] Add structured data to homepage
|
|
319
|
+
|
|
320
|
+
**Week 2 checklist:**
|
|
321
|
+
- [ ] Write "Show HN" post
|
|
322
|
+
- [ ] Email LangChain partnerships
|
|
323
|
+
- [ ] Create AutoGPT plugin
|
|
324
|
+
- [ ] Answer 3 StackOverflow questions
|
|
325
|
+
- [ ] Tweet with #buildinpublic
|
|
326
|
+
|
|
327
|
+
**Month 1 checklist:**
|
|
328
|
+
- [ ] 10+ AI agents using service
|
|
329
|
+
- [ ] Listed on RapidAPI
|
|
330
|
+
- [ ] Featured in 1 newsletter/blog
|
|
331
|
+
- [ ] GitHub examples repo has 10+ stars
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Budget Allocation ($293 marketing budget)
|
|
336
|
+
|
|
337
|
+
| Channel | Budget | Expected Return |
|
|
338
|
+
|---------|--------|----------------|
|
|
339
|
+
| Directory listings | $50 | 2-5 AI agents |
|
|
340
|
+
| Twitter/X ads | $100 | 100+ developer impressions |
|
|
341
|
+
| Dev.to sponsored post | $50 | 500+ views |
|
|
342
|
+
| HackerNews boost | $0 | Organic reach |
|
|
343
|
+
| GitHub sponsors badge | $0 | Credibility |
|
|
344
|
+
| Reserve for testing | $93 | A/B test ads |
|
|
345
|
+
|
|
346
|
+
**Don't spend until Week 3** - organic first!
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Expected Timeline
|
|
351
|
+
|
|
352
|
+
### Week 1-2: Zero Revenue
|
|
353
|
+
- Building discovery
|
|
354
|
+
- Getting listed
|
|
355
|
+
- Testing with simulated agents
|
|
356
|
+
|
|
357
|
+
### Week 3-4: First Real AI Agent
|
|
358
|
+
- From directory or GitHub
|
|
359
|
+
- Likely $5-20 total
|
|
360
|
+
- CELEBRATE THIS! 🎉
|
|
361
|
+
|
|
362
|
+
### Month 2: 5-10 AI Agents
|
|
363
|
+
- $100-500/month
|
|
364
|
+
- Break even on costs
|
|
365
|
+
|
|
366
|
+
### Month 3: 20-50 AI Agents
|
|
367
|
+
- $1,000-5,000/month
|
|
368
|
+
- Flywheel starting
|
|
369
|
+
|
|
370
|
+
### Month 6: 100+ AI Agents
|
|
371
|
+
- $10,000-30,000/month
|
|
372
|
+
- Consider raising prices
|
|
373
|
+
- Add more services
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## Common Mistakes to Avoid
|
|
378
|
+
|
|
379
|
+
❌ **Trying to sell to humans first** - focus on AI agents
|
|
380
|
+
❌ **Complex pricing** - keep it simple: sats per request
|
|
381
|
+
❌ **Requiring API keys** - Bitcoin payment IS the auth
|
|
382
|
+
❌ **Slow response times** - AI agents will abandon >2s
|
|
383
|
+
❌ **No uptime SLA** - AI agents choose reliable services
|
|
384
|
+
❌ **Marketing on Facebook/Instagram** - waste of money
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Success Signals
|
|
389
|
+
|
|
390
|
+
You're on the right track when:
|
|
391
|
+
|
|
392
|
+
✅ AI agents find you WITHOUT you telling them
|
|
393
|
+
✅ GitHub examples repo gets stars from strangers
|
|
394
|
+
✅ You're mentioned in AI agent Discord/Slack channels
|
|
395
|
+
✅ Repeat usage rate >50%
|
|
396
|
+
✅ New AI agents every week without marketing spend
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Emergency Pivot Plan
|
|
401
|
+
|
|
402
|
+
If not working after Month 2:
|
|
403
|
+
|
|
404
|
+
1. **Survey your users** - which service do they use most?
|
|
405
|
+
2. **Double down** on that one service
|
|
406
|
+
3. **Drop** the other two temporarily
|
|
407
|
+
4. **Lower prices** 50% to get volume
|
|
408
|
+
5. **Partner** with one big AI platform exclusively
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
Remember: AI agents make decisions programmatically. They WILL find you if:
|
|
413
|
+
1. Your service solves a real problem
|
|
414
|
+
2. Your pricing is competitive
|
|
415
|
+
3. Your uptime is reliable
|
|
416
|
+
4. You're easily discoverable
|
|
417
|
+
|
|
418
|
+
Focus on those four things and the rest follows!
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# OpenNode Integration - Quick Deploy Guide
|
|
2
|
+
|
|
3
|
+
## You're 10 Minutes Away From Real Bitcoin Payments! ⚡
|
|
4
|
+
|
|
5
|
+
Follow these steps EXACTLY:
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1: Get OpenNode API Key (5 mins)
|
|
10
|
+
|
|
11
|
+
1. Go to **opennode.com**
|
|
12
|
+
2. Click **"Sign Up"** or **"Get Started"**
|
|
13
|
+
3. Enter email + password
|
|
14
|
+
4. **CHECK YOUR EMAIL** → verify account
|
|
15
|
+
5. Log into OpenNode dashboard
|
|
16
|
+
6. Click **"Integrations"** → **"API Tokens"**
|
|
17
|
+
7. Click **"Generate New Key"**
|
|
18
|
+
8. Give it a name: `UgarAPI Production`
|
|
19
|
+
9. **COPY THE API KEY** (starts with `sk_live_...`)
|
|
20
|
+
|
|
21
|
+
**SAVE THIS KEY SOMEWHERE SAFE - You'll need it in Step 2!**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Step 2: Update Railway Environment Variables (2 mins)
|
|
26
|
+
|
|
27
|
+
1. Go to **railway.app** → your project
|
|
28
|
+
2. Click **"Variables"** tab (right side)
|
|
29
|
+
3. **DELETE these old variables:**
|
|
30
|
+
- `BTCPAY_SERVER_URL`
|
|
31
|
+
- `BTCPAY_STORE_ID`
|
|
32
|
+
- `BTCPAY_API_KEY`
|
|
33
|
+
|
|
34
|
+
4. **ADD this new variable:**
|
|
35
|
+
- Name: `OPENNODE_API_KEY`
|
|
36
|
+
- Value: `[paste your API key from Step 1]`
|
|
37
|
+
|
|
38
|
+
5. Click **"Add"** or **"Save"**
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Step 3: Update main.py (3 mins)
|
|
43
|
+
|
|
44
|
+
The updated main.py with OpenNode is ready!
|
|
45
|
+
|
|
46
|
+
**In GitHub:**
|
|
47
|
+
1. Go to your `ugarapi-service` repo
|
|
48
|
+
2. Click `main.py`
|
|
49
|
+
3. Click pencil icon (edit)
|
|
50
|
+
4. **Delete everything**
|
|
51
|
+
5. **Paste the new code** from `main-with-opennode.py`
|
|
52
|
+
6. Commit message: `v1.2 - Real Bitcoin Lightning payments via OpenNode`
|
|
53
|
+
7. Click **"Commit changes"**
|
|
54
|
+
|
|
55
|
+
**Railway auto-deploys in ~2 minutes!**
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 4: Configure OpenNode Webhook (2 mins)
|
|
60
|
+
|
|
61
|
+
1. In OpenNode dashboard
|
|
62
|
+
2. Go to **"Settings"** → **"Webhooks"**
|
|
63
|
+
3. Click **"Add Webhook"**
|
|
64
|
+
4. URL: `https://ugarapi.com/api/v1/payment/webhook`
|
|
65
|
+
5. Events: Select **"Charge Completed"**
|
|
66
|
+
6. Click **"Save"**
|
|
67
|
+
|
|
68
|
+
This tells OpenNode to notify your API when payments are confirmed!
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 5: Test It! (3 mins)
|
|
73
|
+
|
|
74
|
+
Once Railway deploys (watch the logs), test:
|
|
75
|
+
|
|
76
|
+
### Create a Real Invoice:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
curl -X POST https://ugarapi.com/api/v1/payment/create \
|
|
80
|
+
-H "Content-Type: application/json" \
|
|
81
|
+
-d '{
|
|
82
|
+
"service": "web_extraction",
|
|
83
|
+
"amount_sats": 1000
|
|
84
|
+
}'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**You should get back:**
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"invoice_id": "...",
|
|
91
|
+
"payment_request": "lnbc10000n...",
|
|
92
|
+
"amount_sats": 1000,
|
|
93
|
+
"expires_at": 1234567890,
|
|
94
|
+
"checkout_url": "https://checkout.opennode.com/..."
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Pay the Invoice:
|
|
99
|
+
|
|
100
|
+
Open the `checkout_url` in your browser!
|
|
101
|
+
|
|
102
|
+
You'll see OpenNode's payment page where you can pay with:
|
|
103
|
+
- Lightning wallet
|
|
104
|
+
- On-chain Bitcoin
|
|
105
|
+
- Or test mode (if in sandbox)
|
|
106
|
+
|
|
107
|
+
**Pay 1000 sats (~$1) and you'll have your first REAL payment! 🎉**
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Step 6: Verify Payment Worked
|
|
112
|
+
|
|
113
|
+
After paying, check:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
curl https://ugarapi.com/api/v1/payment/INVOICE_ID
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Should show:
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"status": "paid",
|
|
123
|
+
"paid_at": "2026-02-13T...",
|
|
124
|
+
...
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**IT WORKS! You just processed a real Bitcoin Lightning payment! ⚡**
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## What Changed:
|
|
133
|
+
|
|
134
|
+
**Before (Simulated):**
|
|
135
|
+
- Fake invoices
|
|
136
|
+
- Manual webhook calls
|
|
137
|
+
- No real money
|
|
138
|
+
|
|
139
|
+
**After (Real):**
|
|
140
|
+
- Real Lightning invoices via OpenNode
|
|
141
|
+
- Automatic payment confirmation
|
|
142
|
+
- Real Bitcoin in your OpenNode account
|
|
143
|
+
- You can withdraw to your wallet anytime
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Costs:
|
|
148
|
+
|
|
149
|
+
- **OpenNode fee:** 1% per transaction
|
|
150
|
+
- **Example:** 1000 sats = 990 sats to you, 10 sats to OpenNode
|
|
151
|
+
- **Worth it?** YES - until you're doing $10K+/month
|
|
152
|
+
|
|
153
|
+
When you scale, migrate to BTCPay (0% fees).
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Troubleshooting:
|
|
158
|
+
|
|
159
|
+
**"Invalid API key"**
|
|
160
|
+
- Make sure you copied the FULL key (starts with `sk_live_` or `sk_test_`)
|
|
161
|
+
- Check no extra spaces
|
|
162
|
+
|
|
163
|
+
**"Webhook not receiving"**
|
|
164
|
+
- Verify URL is exactly: `https://ugarapi.com/api/v1/payment/webhook`
|
|
165
|
+
- Check Railway logs for incoming webhook calls
|
|
166
|
+
|
|
167
|
+
**"Invoice expired"**
|
|
168
|
+
- Invoices expire after 15 mins
|
|
169
|
+
- Create a fresh one
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## YOU'RE DONE! 🎉
|
|
174
|
+
|
|
175
|
+
You now have:
|
|
176
|
+
- ✅ Real Bitcoin Lightning payments
|
|
177
|
+
- ✅ Automatic confirmation
|
|
178
|
+
- ✅ MCP integration ready
|
|
179
|
+
- ✅ Full autonomous payment loop
|
|
180
|
+
|
|
181
|
+
**Next:** Test the FULL flow:
|
|
182
|
+
1. Create invoice
|
|
183
|
+
2. Pay it
|
|
184
|
+
3. Use the service
|
|
185
|
+
4. Verify you got paid!
|
|
186
|
+
|
|
187
|
+
Then announce it on Twitter: "UgarAPI now accepting REAL Bitcoin Lightning payments!"
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
**Questions? Come back and I'll help debug!**
|