Overview
The Astro minimal boilerplate provides a ready-to-use starting point for integrating Dodo Payments with your Astro application. This template includes authentication, webhook handling, and basic payment setup to help you start accepting payments quickly.This boilerplate uses Astro with TypeScript and includes example implementations for checkout sessions and webhook verification.
Quick Start
1
Clone the Repository
Clone the boilerplate repository and navigate to the project directory:
2
3
Configure Environment Variables
Create a Add your Dodo Payments credentials:
.env file in the root directory:.env
4
Configure Webhook Localhost
When testing webhooks locally, expose your localhost using tools like ngrok:Add the ngrok URL to the
allowed_hosts list in astro.config.mjs for webhook delivery:astro.config.mjs
This step is required for webhooks to be delivered to your local development environment.
5
Install Dependencies
Install the required npm packages:
6
Run the Development Server
Start the Astro development server:Your application will be available at
http://localhost:4321.You’re ready to start building! The boilerplate includes example routes and components to help you understand the integration.
What’s Included
The boilerplate comes with pre-configured essentials:Checkout Integration
Example implementation for creating and handling checkout sessions
Webhook Handler
Secure webhook endpoint with signature verification
TypeScript Support
Full TypeScript configuration with proper type definitions
Tailwind CSS
Pre-configured styling with Tailwind CSS
Project Structure
Next Steps
Once you have the boilerplate running:1
Create Your Products
Add products in your Dodo Payments dashboard to enable checkout functionality.
2
Test Webhooks Locally
Use ngrok to expose your local webhook endpoint and update the Add the ngrok URL to your webhook settings in the dashboard.
allowed_hosts in astro.config.mjs:3
Customize the Integration
Adapt the example code to match your application’s needs and design.
4
Go Live
When ready, switch to Live Mode API keys and deploy your application.
Additional Resources
Astro Adapter
Learn about our comprehensive Astro adapter for advanced integrations
Integration Guide
Detailed guide for implementing one-time payments
Webhook Events
Complete reference for all webhook event types
API Reference
Explore the full Dodo Payments API documentation
Support
Need help with the boilerplate?- Join our Discord community for questions and discussions
- Check the GitHub repository for issues and updates
- Contact our support team for assistance