API Integration Guide
This guide will help you integrate the Dodo Payments API into your website.
Prerequisites
To integrate the Dodo Payments API, you’ll need:
- A Dodo Payments merchant account
- API Credentials (API key and webhook secret key) from dashboard
If you don’t have an account yet, you can get your business approved by contacting the founder or by filling out this form.
Dashboard Setup
-
Navigate to the Dodo Payments Dashboard
-
Create a product (one-time payment or subscription)
-
Test the checkout flow:
- Click the share button on the product page
- Open the link in your browser
- Use test card number:
4242 4242 4242 4242
- Enter any future expiration date and any 3-digit CVV
-
Generate your API key:
- Go to Settings > API
- Detailed Guide
- Copy the API key the in env named DODO_PAYMENTS_API_KEY
-
Configure webhooks:
- Go to Settings > Webhooks
- Create a webhook URL for payment notifications
- Detailed Guide
- Copy the webhook secret key in env
API Integration
Payment Links
Dodo Payments supports two types of payment links:
1. Static Payment Links
Simple to create by appending your product ID to the base URL:
This link will accept the following query parameters:
quantity
: The quantity of the product to be purchased. The default is 1.redirect_url
: The URL to redirect the customer to after the payment is completed.firstName
: The first name of the customer.lastName
: The last name of the customer.email
: The email address of the customer.country
: The country of the customer.addressLine
: The address of the customer.city
: The city of the customer.zipCode
: The postal/ZIP code of the customer.
Optional Disable Flags
The following flags can be used to disable specific fields in the form:
disableFirstName
: Set to true to disable the firstName field.disableLastName
: Set to true to disable the lastName field.disableEmail
: Set to true to disable the email field.disableCountry
: Set to true to disable the country field.disableAddressLine
: Set to true to disable the addressLine field.disableCity
: Set to true to disable the city field.disableZipCode
: Set to true to disable the zipCode field.
You can directly use this link to redirect your customers to the checkout page from your website.
2. Dynamic Payment Links
Created via API call or our sdk with customer details. Here’s an example:
There are two APIs for creating dynamic payment links:
- One-time Payment Link API API reference
- Subscription Payment Link API API reference
The guide below is for one-time payment link creation.
For detailed instructions on integrating subscriptions, refer to this Subscription Integration Guide.
payment_link = true
to get payment link Node.js SDK is available on GitHub.
Python SDK is available on GitHub.
Go SDK is available on GitHub.
For detailed API request body requirements, consult our API Reference.
Implementing Webhooks
Set up an API endpoint to receive payment notifications. Here’s an example using Next.js:
Our webhook implementation follows the Standard Webhooks specification. For webhook type definitions, refer to our API Reference.
You can refer to this project with demo implementation on GitHub using Next.js and TypeScript.
You can check out the live implementation here.