Create flexible checkout links with variable pricing using a single product. Enable Pay What You Want to let customers choose their price or set dynamic amounts programmatically.
Dynamic pricing allows you to offer variable pricing for your products without creating multiple product entries. By enabling Pay What You Want (PWYW) on a single product, you can set minimum and maximum price bounds, then pass dynamic amounts when creating checkout session links.This approach is ideal when you need:
Variable pricing without managing multiple products
Customer-driven pricing where buyers choose their amount
Programmatic price control where you set the amount dynamically via API
Flexible pricing models for digital products, donations, or experimental launches
Pay What You Want is only available for Single Payment (one-time) products. It cannot be used with subscription products.
Set price bounds: Define a minimum price (required) and optionally a maximum price
Pass dynamic amounts: Include an amount field in the product cart when creating checkout sessions
Let customers choose: If no amount is provided, customers can enter their own price (within your bounds)
When you pass an amount in the product cart, that amount is used for the checkout. If you omit the amount field, customers can select their own price during checkout (subject to your minimum/maximum settings).
First, create a one-time product in your Dodo Payments dashboard and enable Pay What You Want pricing.
1
Create a new product
Navigate to Products in your Dodo Payments dashboard and click Add Product.
2
Configure product details
Fill in the required product information:
Product Name: Display name for your product
Product Description: Clear description of what customers are purchasing
Product Image: Upload an image (PNG/JPG/WebP, up to 3 MB)
Tax Category: Select the appropriate tax category
3
Set pricing type
Select Pricing Type as Single Payment (one-time payment).
4
Enable Pay What You Want
In the Pricing section, enable the Pay What You Want toggle.
5
Set minimum price
Enter the Minimum Price that customers must pay. This is required and ensures you maintain a revenue floor.Example: If your minimum is $5.00, enter 5.00 (or 500 cents).
6
Set maximum price (optional)
Optionally, set a Maximum Price to cap the amount customers can pay.
7
Set suggested price (optional)
Optionally, enter a Suggested Price that will be displayed to guide customers. This helps anchor expectations and can improve average order value.
8
Save the product
Click Add Product to save. Note your product ID (e.g., pdt_123abc456def) for use in checkout sessions.
You can find your product ID in the dashboard under Products → View Details, or by using the List Products API.
Step 2: Create Checkout Sessions with Dynamic Pricing
Once your product is configured with Pay What You Want, you can create checkout sessions with dynamic amounts. The amount field in the product cart allows you to set the price programmatically for each checkout session.
import osfrom dodopayments import DodoPayments# Initialize the Dodo Payments clientclient = DodoPayments( bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"),)def create_dynamic_pricing_checkout( product_id: str, amount_in_cents: int, return_url: str): """ Create a checkout session with dynamic pricing. Args: product_id: The product ID with Pay What You Want enabled amount_in_cents: The amount in cents (e.g., 2500 for $25.00) return_url: URL to redirect after payment completion Returns: Session object with checkout_url and session_id """ try: session = client.checkout_sessions.create( product_cart=[ { "product_id": product_id, "quantity": 1, # Dynamic amount in cents (e.g., 1500 = $15.00) "amount": amount_in_cents } ], return_url=return_url, # Optional: Pre-fill customer information customer={ "email": "customer@example.com", "name": "John Doe" }, # Optional: Add metadata for tracking metadata={ "order_id": "order_123", "pricing_tier": "custom" } ) print(f"Checkout URL: {session.checkout_url}") print(f"Session ID: {session.session_id}") return session except Exception as error: print(f"Failed to create checkout session: {error}") raise error# Example: Create checkout with $25.00 (2500 cents)session = create_dynamic_pricing_checkout( "prod_123abc456def", 2500, # $25.00 in cents "https://yoursite.com/checkout/success")# Example: Create checkout with $10.00 (1000 cents)session2 = create_dynamic_pricing_checkout( "prod_123abc456def", 1000, # $10.00 in cents "https://yoursite.com/checkout/success")
Amount Format: The amount field must be in the lowest denomination of the currency. For USD, this means cents (e.g., $25.00 = 2500). For other currencies, use the smallest unit (e.g., paise for INR).
If you want customers to select their own price during checkout, simply omit the amount field from the product cart. The checkout page will display an input field where customers can enter any amount within your minimum and maximum bounds.
async function createCustomerChoiceCheckout( productId: string, returnUrl: string) { try { const session = await client.checkoutSessions.create({ product_cart: [ { product_id: productId, quantity: 1 // No amount field - customer will choose their price } ], return_url: returnUrl, customer: { email: 'customer@example.com', name: 'John Doe' } }); return session; } catch (error) { console.error('Failed to create checkout session:', error); throw error; }}
def create_customer_choice_checkout( product_id: str, return_url: str): """ Create a checkout session where customers choose their own price. """ try: session = client.checkout_sessions.create( product_cart=[ { "product_id": product_id, "quantity": 1 # No amount field - customer will choose their price } ], return_url=return_url, customer={ "email": "customer@example.com", "name": "John Doe" } ) return session except Exception as error: print(f"Failed to create checkout session: {error}") raise error
If your amount field is being ignored, verify that:
The product has Pay What You Want enabled in the dashboard
The product is a Single Payment (one-time) product, not a subscription
The amount is in the correct format (lowest currency denomination, e.g., cents for USD)
Amount exceeds maximum or is below minimum
The API will reject checkout sessions where the amount violates your product’s price bounds. Always validate amounts before creating checkout sessions, or let customers choose their price by omitting the amount field.
Customer can't enter their own price
If customers aren’t seeing the price input field, ensure you’ve omitted the amount field from the product cart. When amount is provided, the checkout uses that exact amount.