Dynamic Payment Links: Programmatically generate payment links with custom details using the API or SDKs.
For a seamless in-page experience, you can use our Overlay Checkout integration, which embeds the Dodo Payments checkout on your site by leveraging these payment links.
Static payment links let you quickly accept payments by sharing a simple URL. You can customize the checkout experience by passing query parameters to pre-fill customer details, control form fields, and add custom metadata.
1
Construct your payment link
Start with the base URL and append your product ID:
You can disable specific fields to make them read-only for the customer. This is useful when you already have the customer’s details (e.g., logged-in users).
To disable a field, provide its value and set the corresponding disable… flag to true:
Send the completed payment link to your customer. When they visit, all query parameters are collected and stored with a session ID. The URL is then simplified to include just the session parameter (e.g., ?session=sess_1a2b3c4d). The stored information persists through page refreshes and is accessible throughout the checkout process.
The customer’s checkout experience is now streamlined and personalized based on your parameters.
Make sure you are passing payment_link = true to get payment link
Copy
import DodoPayments from 'dodopayments';const client = new DodoPayments({bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted});async function main() {const payment = await client.payments.create({payment_link: true,billing: { city: 'city', country: 'AF', state: 'state', street: 'street', zipcode: 0 },customer: { email: '[email protected]', name: 'name' },product_cart: [{ product_id: 'product_id', quantity: 0 }],});console.log(payment.payment_id);}main();
Copy
import DodoPayments from 'dodopayments';const client = new DodoPayments({bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted});async function main() {const payment = await client.payments.create({payment_link: true,billing: { city: 'city', country: 'AF', state: 'state', street: 'street', zipcode: 0 },customer: { email: '[email protected]', name: 'name' },product_cart: [{ product_id: 'product_id', quantity: 0 }],});console.log(payment.payment_id);}main();
Copy
import osfrom dodopayments import DodoPaymentsclient = DodoPayments(bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted (if using same name `DODO_PAYMENTS_API_KEY`))payment = client.payments.create(payment_link=True,billing={ "city": "city", "country": "AF", "state": "state", "street": "street", "zipcode": 0,},customer={ "email": "[email protected]", "name": "name",},product_cart=[{ "product_id": "product_id", "quantity": 0,}],)print(payment.payment_link)
For a seamless in-page checkout experience, explore our Overlay Checkout integration that allows customers to complete payments without leaving your website.