--- title: Let customers decide what to pay subtitle: Accept tips and donations, or sell pay-what-you-want products and services. route: /payments/checkout/pay-what-you-want --- # Let customers decide what to pay Accept tips and donations, or sell pay-what-you-want products and services. # Stripe-hosted page > This is a Stripe-hosted page for when payment-ui is stripe-hosted. View the original doc at https://docs.stripe.com/payments/checkout/pay-what-you-want?payment-ui=stripe-hosted. If you maintain your product catalog outside of Stripe, you might want to use [inline pricing](https://docs.stripe.com/products-prices/pricing-models.md#inline-pricing). With inline pricing, you set inline prices for products or services when you create a Checkout Session. You can also use inline pricing to collect donations. However, unlike pay-what-you-want pricing, you can’t reuse or update inline prices, and they’re only available through the API. You can use this feature to collect a tip for a service provided, accept donations for a cause, or give your customers the option to pay what they want for your product or service. Go to Stripe Support to learn more about Stripe’s [requirements for accepting tips or donations](https://support.stripe.com/questions/requirements-for-accepting-tips-or-donations). Pay-what-you-want payments have the following limitations: - You can’t add any other line items and the quantity can only be 1. - You can’t use promotion codes or discounts with them. - They don’t support recurring payments or optional items. ![Custom amounts](images/no-code/custom-amount.png) ## Set up your product catalog Stripe Checkout uses *Products* and *Prices* to structure pay-what-you-want payments. In the following example, Togethere is selling tickets to a fundraising dinner and wants to allow their customers to pay what they want for their tickets. To create a pay-what-you-want model on Stripe through the Dashboard, complete these steps: 1. Create the `Fundraising dinner` product. 1. Go to **More** > **Product catalog**. 1. Click **+Add product**. 1. Enter the **Name** of the product (`Fundraising dinner`). 1. _(Optional)_ Add a **Description**. The customer sees the description at checkout. 1. Create the price for the `Fundraising dinner` product: 1. Click on **More pricing options** at the bottom. 1. Select **One-off**. 1. Select **Customer chooses price** in the **Choose your pricing model** dropdown. 1. _(Optional)_ Add a suggested price. 1. _(Optional)_ Specify limits that the customer can input. 1. Click **Next** and **Add product**. To create a pay-what-you-want pricing model on Stripe through the [Products](https://docs.stripe.com/api/products.md) and [Prices](https://docs.stripe.com/api/prices.md) APIs: 1. Create the `Fundraising dinner` product. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new ProductCreateOptions { Name = "Fundraising dinner" }; var service = new ProductService(); Product product = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.ProductParams{Name: stripe.String("Fundraising dinner")}; result, err := product.New(params); ``` ```java Stripe.apiKey = "<>"; ProductCreateParams params = ProductCreateParams.builder().setName("Fundraising dinner").build(); Product product = Product.create(params); ``` ```node const stripe = require('stripe')('<>'); const product = await stripe.products.create({ name: 'Fundraising dinner', }); ``` ```python import stripe stripe.api_key = "<>" product = stripe.Product.create(name="Fundraising dinner") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $product = $stripe->products->create(['name' => 'Fundraising dinner']); ``` ```ruby Stripe.api_key = '<>' product = Stripe::Product.create({name: 'Fundraising dinner'}) ``` 2. Create a price for the customer input. You can optionally specify a `preset` price, which is the initial amount on the payment page that your customer can update. You can also set a `minimum` and `maximum` bound for the price. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Currency = "usd", CustomUnitAmount = new PriceCustomUnitAmountOptions { Enabled = true }, Product = "<>", }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Currency: stripe.String(string(stripe.CurrencyUSD)), CustomUnitAmount: &stripe.PriceCustomUnitAmountParams{Enabled: stripe.Bool(true)}, Product: stripe.String("<>"), }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setCurrency("usd") .setCustomUnitAmount(PriceCreateParams.CustomUnitAmount.builder().setEnabled(true).build()) .setProduct("<>") .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ currency: 'usd', custom_unit_amount: { enabled: true, }, product: '<>', }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( currency="usd", custom_unit_amount={"enabled": True}, product="<>", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'currency' => 'usd', 'custom_unit_amount' => ['enabled' => true], 'product' => '<>', ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ currency: 'usd', custom_unit_amount: {enabled: true}, product: '<>', }) ``` ## Create a Checkout Session To enable customers to change the amount on the payment page, use the price ID when you create a Checkout Session. If you select **Customer chooses price** as your pricing model, you can’t add any other line items and the quantity can only be 1. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new Stripe.Checkout.SessionCreateOptions { CancelUrl = "https://example.com", LineItems = new List { new Stripe.Checkout.SessionLineItemOptions { Price = "<>", Quantity = 1 }, }, Mode = "payment", SuccessUrl = "https://example.com/success", }; var service = new Stripe.Checkout.SessionService(); Stripe.Checkout.Session session = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.CheckoutSessionParams{ CancelURL: stripe.String("https://example.com"), LineItems: []*stripe.CheckoutSessionLineItemParams{ &stripe.CheckoutSessionLineItemParams{ Price: stripe.String("<>"), Quantity: stripe.Int64(1), }, }, Mode: stripe.String(string(stripe.CheckoutSessionModePayment)), SuccessURL: stripe.String("https://example.com/success"), }; result, err := session.New(params); ``` ```java Stripe.apiKey = "<>"; SessionCreateParams params = SessionCreateParams.builder() .setCancelUrl("https://example.com") .addLineItem( SessionCreateParams.LineItem.builder().setPrice("<>").setQuantity(1L).build() ) .setMode(SessionCreateParams.Mode.PAYMENT) .setSuccessUrl("https://example.com/success") .build(); Session session = Session.create(params); ``` ```node const stripe = require('stripe')('<>'); const session = await stripe.checkout.sessions.create({ cancel_url: 'https://example.com', line_items: [ { price: '<>', quantity: 1, }, ], mode: 'payment', success_url: 'https://example.com/success', }); ``` ```python import stripe stripe.api_key = "<>" session = stripe.checkout.Session.create( cancel_url="https://example.com", line_items=[{"price": "<>", "quantity": 1}], mode="payment", success_url="https://example.com/success", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $session = $stripe->checkout->sessions->create([ 'cancel_url' => 'https://example.com', 'line_items' => [ [ 'price' => '<>', 'quantity' => 1, ], ], 'mode' => 'payment', 'success_url' => 'https://example.com/success', ]); ``` ```ruby Stripe.api_key = '<>' session = Stripe::Checkout::Session.create({ cancel_url: 'https://example.com', line_items: [ { price: '<>', quantity: 1, }, ], mode: 'payment', success_url: 'https://example.com/success', }) ``` # Embedded form > This is a Embedded form for when payment-ui is embedded-form. View the original doc at https://docs.stripe.com/payments/checkout/pay-what-you-want?payment-ui=embedded-form. If you maintain your product catalog outside of Stripe, you might want to use [inline pricing](https://docs.stripe.com/products-prices/pricing-models.md#inline-pricing). With inline pricing, you set inline prices for products or services when you create a Checkout Session. You can also use inline pricing to collect donations. However, unlike pay-what-you-want pricing, you can’t reuse or update inline prices, and they’re only available through the API. You can use this feature to collect a tip for a service provided, accept donations for a cause, or give your customers the option to pay what they want for your product or service. Go to Stripe Support to learn more about Stripe’s [requirements for accepting tips or donations](https://support.stripe.com/questions/requirements-for-accepting-tips-or-donations). Pay-what-you-want payments have the following limitations: - You can’t add any other line items and the quantity can only be 1. - You can’t use promotion codes or discounts with them. - They don’t support recurring payments or optional items. ![Custom amounts](images/no-code/custom-amount.png) ## Set up your product catalog Stripe Checkout uses *Products* and *Prices* to structure pay-what-you-want payments. In the following example, Togethere is selling tickets to a fundraising dinner and wants to allow their customers to pay what they want for their tickets. To create a pay-what-you-want model on Stripe through the Dashboard, complete these steps: 1. Create the `Fundraising dinner` product. 1. Go to **More** > **Product catalog**. 1. Click **+Add product**. 1. Enter the **Name** of the product (`Fundraising dinner`). 1. _(Optional)_ Add a **Description**. The customer sees the description at checkout. 1. Create the price for the `Fundraising dinner` product: 1. Click on **More pricing options** at the bottom. 1. Select **One-off**. 1. Select **Customer chooses price** in the **Choose your pricing model** dropdown. 1. _(Optional)_ Add a suggested price. 1. _(Optional)_ Specify limits that the customer can input. 1. Click **Next** and **Add product**. To create a pay-what-you-want pricing model on Stripe through the [Products](https://docs.stripe.com/api/products.md) and [Prices](https://docs.stripe.com/api/prices.md) APIs: 1. Create the `Fundraising dinner` product. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new ProductCreateOptions { Name = "Fundraising dinner" }; var service = new ProductService(); Product product = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.ProductParams{Name: stripe.String("Fundraising dinner")}; result, err := product.New(params); ``` ```java Stripe.apiKey = "<>"; ProductCreateParams params = ProductCreateParams.builder().setName("Fundraising dinner").build(); Product product = Product.create(params); ``` ```node const stripe = require('stripe')('<>'); const product = await stripe.products.create({ name: 'Fundraising dinner', }); ``` ```python import stripe stripe.api_key = "<>" product = stripe.Product.create(name="Fundraising dinner") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $product = $stripe->products->create(['name' => 'Fundraising dinner']); ``` ```ruby Stripe.api_key = '<>' product = Stripe::Product.create({name: 'Fundraising dinner'}) ``` 2. Create a price for the customer input. You can optionally specify a `preset` price, which is the initial amount on the payment page that your customer can update. You can also set a `minimum` and `maximum` bound for the price. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Currency = "usd", CustomUnitAmount = new PriceCustomUnitAmountOptions { Enabled = true }, Product = "<>", }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Currency: stripe.String(string(stripe.CurrencyUSD)), CustomUnitAmount: &stripe.PriceCustomUnitAmountParams{Enabled: stripe.Bool(true)}, Product: stripe.String("<>"), }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setCurrency("usd") .setCustomUnitAmount(PriceCreateParams.CustomUnitAmount.builder().setEnabled(true).build()) .setProduct("<>") .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ currency: 'usd', custom_unit_amount: { enabled: true, }, product: '<>', }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( currency="usd", custom_unit_amount={"enabled": True}, product="<>", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'currency' => 'usd', 'custom_unit_amount' => ['enabled' => true], 'product' => '<>', ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ currency: 'usd', custom_unit_amount: {enabled: true}, product: '<>', }) ``` ## Create a Checkout Session To enable customers to change the amount on the payment page, use the price ID when you create a Checkout Session. If you select **Customer chooses price** as your pricing model, you can’t add any other line items and the quantity can only be 1. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new Stripe.Checkout.SessionCreateOptions { LineItems = new List { new Stripe.Checkout.SessionLineItemOptions { Price = "<>", Quantity = 1 }, }, Mode = "payment", UiMode = "embedded", ReturnUrl = "https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}", }; var service = new Stripe.Checkout.SessionService(); Stripe.Checkout.Session session = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.CheckoutSessionParams{ LineItems: []*stripe.CheckoutSessionLineItemParams{ &stripe.CheckoutSessionLineItemParams{ Price: stripe.String("<>"), Quantity: stripe.Int64(1), }, }, Mode: stripe.String(string(stripe.CheckoutSessionModePayment)), UIMode: stripe.String(string(stripe.CheckoutSessionUIModeEmbedded)), ReturnURL: stripe.String("https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}"), }; result, err := session.New(params); ``` ```java Stripe.apiKey = "<>"; SessionCreateParams params = SessionCreateParams.builder() .addLineItem( SessionCreateParams.LineItem.builder().setPrice("<>").setQuantity(1L).build() ) .setMode(SessionCreateParams.Mode.PAYMENT) .setUiMode(SessionCreateParams.UiMode.EMBEDDED) .setReturnUrl("https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}") .build(); Session session = Session.create(params); ``` ```node const stripe = require('stripe')('<>'); const session = await stripe.checkout.sessions.create({ line_items: [ { price: '<>', quantity: 1, }, ], mode: 'payment', ui_mode: 'embedded', return_url: 'https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}', }); ``` ```python import stripe stripe.api_key = "<>" session = stripe.checkout.Session.create( line_items=[{"price": "<>", "quantity": 1}], mode="payment", ui_mode="embedded", return_url="https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $session = $stripe->checkout->sessions->create([ 'line_items' => [ [ 'price' => '<>', 'quantity' => 1, ], ], 'mode' => 'payment', 'ui_mode' => 'embedded', 'return_url' => 'https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}', ]); ``` ```ruby Stripe.api_key = '<>' session = Stripe::Checkout::Session.create({ line_items: [ { price: '<>', quantity: 1, }, ], mode: 'payment', ui_mode: 'embedded', return_url: 'https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}', }) ``` # Embedded components > This is a Embedded components for when payment-ui is embedded-components. View the original doc at https://docs.stripe.com/payments/checkout/pay-what-you-want?payment-ui=embedded-components. Custom amounts aren’t supported when using Elements.