GitHub Repository
Minimal Go + Dodo Payments boilerplate
अवलोकन
Go boilerplate आपके Go backend के साथ Dodo Payments को integrate करने के लिए production-ready शुरुआती आधार प्रदान करता है। इस template में checkout session handling, webhook verification, customer portal integration शामिल हैं और यह Go best practices का पालन करता है, ताकि आप जल्दी से payments स्वीकार करना शुरू कर सकें।यह boilerplate clean architecture patterns (
cmd, internal, templates), HTML templates और seamless API integration के लिए dodopayments-go SDK के साथ Go 1.21+ का उपयोग करता है।सुविधाएँ
- त्वरित Setup - 5 मिनट से कम समय में शुरुआत करें
- Payment Integration -
dodopayments-goSDK का उपयोग करने वाला pre-configured checkout flow - आधुनिक UI - HTML templates के साथ clean, dark-themed pricing page
- Webhook Handling - payment events को सुरक्षित रूप से verify और process करें
- Customer Portal - Self-serve subscription management
- Go Best Practices -
cmd,internalऔरtemplatesके साथ clean architecture - Pre-filled Checkout - बेहतर UX के लिए customer data पास करने का प्रदर्शन
आवश्यकताएँ
शुरू करने से पहले सुनिश्चित करें कि आपके पास ये हैं:- Go 1.21+
- Dodo Payments account (dashboard से API और Webhook Keys access करने के लिए)
Quick Start
1
Clone the Repository
2
Install Dependencies
3
Get API Credentials
Dodo Payments पर sign up करें और dashboard से अपने credentials प्राप्त करें:
- API Key: Dashboard → Developer → API Keys
- Webhook Key: Dashboard → Developer → Webhooks
4
Configure Environment Variables
Root directory में एक अपने Dodo Payments credentials के साथ values update करें:
.env file बनाएँ:.env
5
Add Your Products
internal/lib/products.go को Dodo Payments से प्राप्त वास्तविक product IDs के साथ update करें:6
Run the Development Server
आपको अपने products के purchase के लिए तैयार एक dark-themed pricing page दिखाई देना चाहिए।
Project Structure
API Endpoints
Boilerplate में निम्नलिखित pre-configured endpoints शामिल हैं:Customization
Product Information update करें
internal/lib/products.go को edit करके ये modify करें:
- Product IDs (अपने Dodo dashboard से)
- Pricing
- Features
- Descriptions
Customer Data पहले से भरें
templates/index.html में hardcoded customer data को अपने वास्तविक user data से replace करें:
Webhook Events
Boilerplateinternal/api/webhook.go में webhook events को handle करने का प्रदर्शन करता है। Supported events में शामिल हैं:
Webhook handler के अंदर अपनी business logic जोड़ें ताकि:
- अपने database में user permissions update करें
- confirmation emails भेजें
- digital products का access provision करें
- analytics और metrics track करें
Webhooks को Locally Test करना
Local development के लिए अपने local server को expose करने हेतु ngrok जैसे tools का उपयोग करें:Deployment
Production के लिए Build करें
Vercel पर Deploy करें
[Docker
एकDockerfile बनाएँ:
Production संबंधी विचार
Troubleshooting
Build errors or missing dependencies
Build errors or missing dependencies
सुनिश्चित करें कि Go modules ठीक से download किए गए हैं:
Checkout session creation fails
Checkout session creation fails
सामान्य कारण:
- Invalid product ID - verify करें कि यह आपके Dodo dashboard में मौजूद है
.envमें गलत API key या environment setting- Detailed error messages के लिए server logs देखें
Webhooks not receiving events
Webhooks not receiving events
Local testing के लिए अपने server को expose करने हेतु ngrok का उपयोग करें:अपने Dodo dashboard में webhook URL को ngrok URL पर update करें। अपने
.env file को सही webhook verification key के साथ update करना सुनिश्चित करें।Templates not loading
Templates not loading
सुनिश्चित करें कि आप server को project root directory से चला रहे हैं या आपके code में templates path सही तरीके से configured है।
और जानें
Go SDK
Complete Go SDK documentation
Webhooks Documentation
सभी webhook events और best practices के बारे में जानें
Checkout Sessions
checkout session configuration की विस्तृत जानकारी
API Reference
Complete Dodo Payments API documentation
Support
Boilerplate के साथ सहायता चाहिए?- Questions और discussions के लिए हमारी Discord community से जुड़ें
- Issues और updates के लिए GitHub repository देखें
- सहायता के लिए हमारी support team से संपर्क करें