# Customize checkout behavior Customize the behavior of the checkout process to increase conversion and revenue. # Stripe-hosted page > This is a Stripe-hosted page for when payment-ui is stripe-hosted. View the full page at https://docs.stripe.com/payments/checkout/customization/behavior?payment-ui=stripe-hosted. ## Filter card brands You can specify which card brands you want to block from your customers in the Checkout Session. To block specific card brands, you can include the `brands_blocked` parameter when creating a Checkout Session. Pass an array with any of the following card brand values: - `visa` - `mastercard` - `american_express` - `discover_global_network` The `discover_global_network` value encompasses all of the cards that are part of the Discover Global Network, including Discover, Diners, JCB, UnionPay, and Elo. The following code example initializes the Checkout Session with the `brands_blocked` parameter set to `['american_express']`, which prevents customers from using American Express cards. ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "line_items[0][price]"="{{PRICE_ID}}" \ -d "line_items[0][quantity]"=1 \ -d mode=payment \ --data-urlencode return_url="https://example.com/return" \ -d "payment_method_options[card][restrictions][brands_blocked][0]"=american_express ``` ```cli stripe checkout sessions create \ -d "line_items[0][price]"="{{PRICE_ID}}" \ -d "line_items[0][quantity]"=1 \ --mode=payment \ --return-url="https://example.com/return" \ -d "payment_method_options[card][restrictions][brands_blocked][0]"=american_express ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") session = client.v1.checkout.sessions.create({ line_items: [ { price: '{{PRICE_ID}}', quantity: 1, }, ], mode: 'payment', return_url: 'https://example.com/return', payment_method_options: {card: {restrictions: {brands_blocked: ['american_express']}}}, }) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. session = client.v1.checkout.sessions.create({ "line_items": [{"price": "{{PRICE_ID}}", "quantity": 1}], "mode": "payment", "return_url": "https://example.com/return", "payment_method_options": { "card": {"restrictions": {"brands_blocked": ["american_express"]}}, }, }) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $session = $stripe->checkout->sessions->create([ 'line_items' => [ [ 'price' => '{{PRICE_ID}}', 'quantity' => 1, ], ], 'mode' => 'payment', 'return_url' => 'https://example.com/return', 'payment_method_options' => [ 'card' => ['restrictions' => ['brands_blocked' => ['american_express']]], ], ]); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); SessionCreateParams params = SessionCreateParams.builder() .addLineItem( SessionCreateParams.LineItem.builder() .setPrice("{{PRICE_ID}}") .setQuantity(1L) .build() ) .setMode(SessionCreateParams.Mode.PAYMENT) .setReturnUrl("https://example.com/return") .setPaymentMethodOptions( SessionCreateParams.PaymentMethodOptions.builder() .setCard(SessionCreateParams.PaymentMethodOptions.Card.builder().build()) .build() ) .putExtraParam( "payment_method_options[card][restrictions][brands_blocked][0]", "american_express" ) .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. Session session = client.v1().checkout().sessions().create(params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const session = await stripe.checkout.sessions.create({ line_items: [ { price: '{{PRICE_ID}}', quantity: 1, }, ], mode: 'payment', return_url: 'https://example.com/return', payment_method_options: { card: { restrictions: { brands_blocked: ['american_express'], }, }, }, }); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.CheckoutSessionCreateParams{ LineItems: []*stripe.CheckoutSessionCreateLineItemParams{ &stripe.CheckoutSessionCreateLineItemParams{ Price: stripe.String("{{PRICE_ID}}"), Quantity: stripe.Int64(1), }, }, Mode: stripe.String(stripe.CheckoutSessionModePayment), ReturnURL: stripe.String("https://example.com/return"), PaymentMethodOptions: &stripe.CheckoutSessionCreatePaymentMethodOptionsParams{ Card: &stripe.CheckoutSessionCreatePaymentMethodOptionsCardParams{}, }, } params.AddExtra( "payment_method_options[card][restrictions][brands_blocked][0]", "american_express") result, err := sc.V1CheckoutSessions.Create(context.TODO(), params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new Stripe.Checkout.SessionCreateOptions { LineItems = new List { new Stripe.Checkout.SessionLineItemOptions { Price = "{{PRICE_ID}}", Quantity = 1, }, }, Mode = "payment", ReturnUrl = "https://example.com/return", PaymentMethodOptions = new Stripe.Checkout.SessionPaymentMethodOptionsOptions { Card = new Stripe.Checkout.SessionPaymentMethodOptionsCardOptions { Restrictions = new Stripe.Checkout.SessionPaymentMethodOptionsCardRestrictionsOptions { BrandsBlocked = new List { "american_express" }, }, }, }, }; var client = new StripeClient("<>"); var service = client.V1.Checkout.Sessions; Stripe.Checkout.Session session = service.Create(options); ``` If a customer enters an unsupported card number in Checkout, an error message notifies them that their card brand isn’t accepted. ![Card brand filtering on Checkout](https://b.stripecdn.com/docs-statics-srv/assets/card-brand-filtering-on-form.e3a1bab1800020eefd977e093863d208.png) An error surfaces informing the customer that you don’t accept Visa (or whatever card brand you have blocked). Additionally, [Link](https://docs.stripe.com/payments/link/checkout-link.md) also disables saved cards for returning users if the saved card is blocked. ![Card brand filtering on Checkout with Link](https://b.stripecdn.com/docs-statics-srv/assets/card-brand-filtering-link.eb5ed48829c0b18a59dadf2a77cd6a66.png) If a Link user’s saved card is blocked, it is disabled. Checkout also filters cards in Apple and Google Pay wallets, customer’s [saved payment methods](https://docs.stripe.com/payments/checkout/save-during-payment.md), and [networks from co-badged cards](https://docs.stripe.com/co-badged-cards-compliance.md). # Embedded form > This is a Embedded form for when payment-ui is embedded-form. View the full page at https://docs.stripe.com/payments/checkout/customization/behavior?payment-ui=embedded-form. ## Filter card brands You can specify which card brands you want to block from your customers in the Checkout Session. To block specific card brands, you can include the `brands_blocked` parameter when creating a Checkout Session. Pass an array with any of the following card brand values: - `visa` - `mastercard` - `american_express` - `discover_global_network` The `discover_global_network` value encompasses all of the cards that are part of the Discover Global Network, including Discover, Diners, JCB, UnionPay, and Elo. The following code example initializes the Checkout Session with the `brands_blocked` parameter set to `['american_express']`, which prevents customers from using American Express cards. ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "line_items[0][price]"="{{PRICE_ID}}" \ -d "line_items[0][quantity]"=1 \ -d mode=payment \ --data-urlencode return_url="https://example.com/return" \ -d "payment_method_options[card][restrictions][brands_blocked][0]"=american_express ``` ```cli stripe checkout sessions create \ -d "line_items[0][price]"="{{PRICE_ID}}" \ -d "line_items[0][quantity]"=1 \ --mode=payment \ --return-url="https://example.com/return" \ -d "payment_method_options[card][restrictions][brands_blocked][0]"=american_express ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") session = client.v1.checkout.sessions.create({ line_items: [ { price: '{{PRICE_ID}}', quantity: 1, }, ], mode: 'payment', return_url: 'https://example.com/return', payment_method_options: {card: {restrictions: {brands_blocked: ['american_express']}}}, }) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. session = client.v1.checkout.sessions.create({ "line_items": [{"price": "{{PRICE_ID}}", "quantity": 1}], "mode": "payment", "return_url": "https://example.com/return", "payment_method_options": { "card": {"restrictions": {"brands_blocked": ["american_express"]}}, }, }) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $session = $stripe->checkout->sessions->create([ 'line_items' => [ [ 'price' => '{{PRICE_ID}}', 'quantity' => 1, ], ], 'mode' => 'payment', 'return_url' => 'https://example.com/return', 'payment_method_options' => [ 'card' => ['restrictions' => ['brands_blocked' => ['american_express']]], ], ]); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); SessionCreateParams params = SessionCreateParams.builder() .addLineItem( SessionCreateParams.LineItem.builder() .setPrice("{{PRICE_ID}}") .setQuantity(1L) .build() ) .setMode(SessionCreateParams.Mode.PAYMENT) .setReturnUrl("https://example.com/return") .setPaymentMethodOptions( SessionCreateParams.PaymentMethodOptions.builder() .setCard(SessionCreateParams.PaymentMethodOptions.Card.builder().build()) .build() ) .putExtraParam( "payment_method_options[card][restrictions][brands_blocked][0]", "american_express" ) .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. Session session = client.v1().checkout().sessions().create(params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const session = await stripe.checkout.sessions.create({ line_items: [ { price: '{{PRICE_ID}}', quantity: 1, }, ], mode: 'payment', return_url: 'https://example.com/return', payment_method_options: { card: { restrictions: { brands_blocked: ['american_express'], }, }, }, }); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.CheckoutSessionCreateParams{ LineItems: []*stripe.CheckoutSessionCreateLineItemParams{ &stripe.CheckoutSessionCreateLineItemParams{ Price: stripe.String("{{PRICE_ID}}"), Quantity: stripe.Int64(1), }, }, Mode: stripe.String(stripe.CheckoutSessionModePayment), ReturnURL: stripe.String("https://example.com/return"), PaymentMethodOptions: &stripe.CheckoutSessionCreatePaymentMethodOptionsParams{ Card: &stripe.CheckoutSessionCreatePaymentMethodOptionsCardParams{}, }, } params.AddExtra( "payment_method_options[card][restrictions][brands_blocked][0]", "american_express") result, err := sc.V1CheckoutSessions.Create(context.TODO(), params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new Stripe.Checkout.SessionCreateOptions { LineItems = new List { new Stripe.Checkout.SessionLineItemOptions { Price = "{{PRICE_ID}}", Quantity = 1, }, }, Mode = "payment", ReturnUrl = "https://example.com/return", PaymentMethodOptions = new Stripe.Checkout.SessionPaymentMethodOptionsOptions { Card = new Stripe.Checkout.SessionPaymentMethodOptionsCardOptions { Restrictions = new Stripe.Checkout.SessionPaymentMethodOptionsCardRestrictionsOptions { BrandsBlocked = new List { "american_express" }, }, }, }, }; var client = new StripeClient("<>"); var service = client.V1.Checkout.Sessions; Stripe.Checkout.Session session = service.Create(options); ``` If a customer enters an unsupported card number in Checkout, an error message notifies them that their card brand isn’t accepted. ![Card brand filtering on Checkout](https://b.stripecdn.com/docs-statics-srv/assets/card-brand-filtering-on-form.e3a1bab1800020eefd977e093863d208.png) An error surfaces informing the customer that you don’t accept Visa (or whatever card brand you have blocked). Additionally, [Link](https://docs.stripe.com/payments/link/checkout-link.md) also disables saved cards for returning users if the saved card is blocked. ![Card brand filtering on Checkout with Link](https://b.stripecdn.com/docs-statics-srv/assets/card-brand-filtering-link.eb5ed48829c0b18a59dadf2a77cd6a66.png) If a Link user’s saved card is blocked, it is disabled. Checkout also filters cards in Apple and Google Pay wallets, customer’s [saved payment methods](https://docs.stripe.com/payments/checkout/save-during-payment.md), and [networks from co-badged cards](https://docs.stripe.com/co-badged-cards-compliance.md).