Customizing Checkout

    Learn about the different ways you can customize your Stripe Checkout integration.

    Billing address collection Client-onlyClient and server

    You can specify whether Checkout should collect the customer’s billing address by setting billingAddressCollection in the redirectToCheckout call. If set to required, Checkout will always collect the customer’s billing address. If left blank or set to auto Checkout will only collect the billing address when necessary.

    stripe.redirectToCheckout({
      items: [
        // Replace with the ID of your SKU
        {sku: 'sku_123', quantity: 1}
      ],
      successUrl: 'https://example.com/success',
      cancelUrl: 'https://example.com/cancel',
      billingAddressCollection: 'required',
    }).then(function (result) {
      // If `redirectToCheckout` fails due to a browser or network
      // error, display the localized error message to your customer
      // using `result.error.message`.
    });
    
    stripe.redirectToCheckout({
      items: [
        // Replace with the ID of your SKU
        {sku: 'sku_123', quantity: 1}
      ],
      successUrl: 'https://example.com/success',
      cancelUrl: 'https://example.com/cancel',
      billingAddressCollection: 'required',
    }).then((result) => {
      // If `redirectToCheckout` fails due to a browser or network
      // error, display the localized error message to your customer
      // using `result.error.message`.
    });
    

    You can specify whether Checkout should collect the customer’s billing address by setting billing_address_collection when creating a Checkout Session. If set to required, Checkout will always collect the customer’s billing address. If left blank or set to auto Checkout will only collect the billing address when necessary.

    curl https://api.stripe.com/v1/checkout/sessions \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d billing_address_collection=required \
      -d "payment_method_types[]=card" \
      -d "line_items[][name]=T-shirt" \
      -d "line_items[][description]=Comfortable cotton t-shirt" \
      -d "line_items[][images][]=https://example.com/t-shirt.png" \
      -d "line_items[][amount]=500" \
      -d "line_items[][currency]=usd" \
      -d "line_items[][quantity]=1" \
      -d success_url="https://example.com/success" \
      -d cancel_url="https://example.com/cancel"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = Stripe::Checkout::Session.create(
      billing_address_collection: 'required',
      payment_method_types: ['card'],
      line_items: [{
        name: 'T-shirt',
        description: 'Comfortable cotton t-shirt',
        images: ['https://example.com/t-shirt.png'],
        amount: 500,
        currency: 'usd',
        quantity: 1,
      }],
      success_url: 'https://example.com/success',
      cancel_url: 'https://example.com/cancel',
    )
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = stripe.checkout.Session.create(
      billing_address_collection='required',
      payment_method_types=['card'],
      line_items=[{
        'name': 'T-shirt',
        'description': 'Comfortable cotton t-shirt',
        'images': ['https://example.com/t-shirt.png'],
        'amount': 500,
        'currency': 'usd',
        'quantity': 1,
      }],
      success_url='https://example.com/success',
      cancel_url='https://example.com/cancel',
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    $session = \Stripe\Checkout\Session::create([
      'billing_address_collection' => 'required',
      'payment_method_types' => ['card'],
      'line_items' => [[
        'name' => 'T-shirt',
        'description' => 'Comfortable cotton t-shirt',
        'images' => ['https://example.com/t-shirt.png'],
        'amount' => 500,
        'currency' => 'usd',
        'quantity' => 1,
      ]],
      'success_url' => 'https://example.com/success',
      'cancel_url' => 'https://example.com/cancel',
    ]);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    Map<String, Object> params = new HashMap<String, Object>();
    
    params.put("billing_address_collection", "required");
    
    ArrayList<String> paymentMethodTypes = new ArrayList<>();
    paymentMethodTypes.add("card");
    params.put("payment_method_types", paymentMethodTypes);
    
    ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
    HashMap<String, Object> lineItem = new HashMap<String, Object>();
    lineItem.put("name", "T-shirt");
    lineItem.put("description", "Comfortable cotton t-shirt");
    lineItem.put("amount", 500);
    lineItem.put("currency", "usd");
    lineItem.put("quantity", 1);
    lineItems.add(lineItem);
    params.put("line_items", lineItems);
    
    params.put("success_url", "https://example.com/success");
    params.put("cancel_url", "https://example.com/cancel");
    
    Session session = Session.create(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const session = await stripe.checkout.sessions.create({
        billing_address_collection: 'required',
        payment_method_types: ['card'],
        line_items: [{
          name: 'T-shirt',
          description: 'Comfortable cotton t-shirt',
          images: ['https://example.com/t-shirt.png'],
          amount: 500,
          currency: 'usd',
          quantity: 1,
        }],
        success_url: 'https://example.com/success',
        cancel_url: 'https://example.com/cancel',
      });
    })();
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.CheckoutSessionParams{
        BillingAddressCollection: stripe.String("required"),
        PaymentMethodTypes: stripe.StringSlice([]string{
            "card",
        }),
        LineItems: []*stripe.CheckoutSessionLineItemParams{
            &stripe.CheckoutSessionLineItemParams{
                Name: stripe.String("T-shirt"),
                Description: stripe.String("Comfortable cotton t-shirt"),
                Amount: stripe.Int64(500),
                Currency: stripe.String(string(stripe.CurrencyUSD)),
                Quantity: stripe.Int64(1),
            },
        },
        SuccessURL: stripe.String("https://example.com/success"),
        CancelURL: stripe.String("https://example.com/cancel"),
    }
    
    session, err := session.New(params)
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    var options = new SessionCreateOptions {
        BillingAddressCollection = "required",
        PaymentMethodTypes = new List<string> {
            "card",
        },
        LineItems = new List<SessionLineItemOptions> {
            new SessionLineItemOptions {
                Name = "T-shirt",
                Description = "Comfortable cotton t-shirt",
                Amount = 500,
                Currency = "usd",
                Quantity = 1,
            },
        },
        SuccessUrl = "https://example.com/success",
        CancelUrl = "https://example.com/cancel",
    };
    
    var service = new SessionService();
    Session session = service.Create(options);
    

    Branding Client-onlyClient and server

    You can customize the look and feel of Checkout via the Stripe Dashboard. Go to Branding Settings where you can:

    • Upload a logo or icon
    • Customize the accent color of the Checkout page

    Branding for Connect platforms Client and server

    Platforms and Standard Connect accounts control their own branding via the Branding settings in the Dashboard. Platforms may configure the branding settings for Express and Custom accounts via the Accounts API.

    The account update API accepts the following parameters for branding:

    • icon is displayed alongside the business name in the header of the Checkout page.
    • If specified, logois displayed instead of the icon and business name in the header of the Checkout page.
    • primary_color is used as the accent color of various UI elements on the Checkout page.
    curl https://api.stripe.com/v1/accounts/{{CONNECTED_STRIPE_ACCOUNT_ID}} \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d "settings[branding][icon]=file_123" \
      -d "settings[branding][logo]=file_456" \
      -d "settings[branding][primary_color]=#663399"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    Stripe::Account.update(
      '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
      {
        settings: {
          branding: {
            icon: 'file_123',
            logo: 'file_456',
            primary_color: '#663399',
          },
        },
      },
    )
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    stripe.Account.modify(
      '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
      settings={
        branding: {
          icon: 'file_123',
          logo: 'file_456',
          primary_color: '#663399',
        },
      },
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    StripeAccount::update(
      '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
      [
        'settings' => [
          'branding' => [
            'icon' => 'file_123',
            'logo' => 'file_456',
            'primary_color' => '#663399',
          ],
        ],
      ],
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    Account account = Account.retrieve('{{CONNECTED_STRIPE_ACCOUNT_ID}}');
    HashMap<String, Object> params = new HashMap<String, Object>();
    HashMap<String, Object> settings = new HashMap<String, Object>();
    HashMap<String, Object> branding = new HashMap<String, Object>();
    branding.put("icon", "file_123");
    branding.put("logo", "file_456");
    branding.put("primary_color", "#663399");
    settings.put("branding", branding);
    params.put("settings", settings);
    account.update(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    stripe.accounts.update(
      '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
      {
        settings: {
          branding: {
            icon: 'file_123',
            logo: 'file_456',
            primary_color: '#663399',
          },
        },
      },
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.AccountParams{
      Settings: &stripe.AccountSettingsParams{
        Branding: &stripe.AccountSettingsBrandingParams{
          Icon: stripe.String("file_123"),
          Logo: stripe.String("file_456"),
          PrimaryColor: stripe.String("#663399"),
        },
      },
    }
    account.Update("{{CONNECTED_STRIPE_ACCOUNT_ID}}", params)
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    var options = new AccountUpdateOptions {
      Settings = new AccountUpdateSettingsOptions {
        Branding = new AccountUpdateSettingsBrandingOptions {
          IconFileId = "file_123",
          LogoFileId = "file_456",
          PrimaryColor = "#663399",
        },
      },
    };
    var accountService = new AccountService();
    accountService.Update("{{CONNECTED_STRIPE_ACCOUNT_ID}}", options);
    

    Customizing the Submit button Client-onlyClient and server

    You can also inform Checkout as to what kind of transaction your customer is performing for SKU and line item Checkout Sessions. By doing this, Checkout can display more relevant copy to your user for the Submit button.

    Provide a submitType in the redirectToCheckout call:

    stripe.redirectToCheckout({
      items: [
        // Replace with the ID of your SKU
        {sku: 'sku_123', quantity: 1}
      ],
      successUrl: 'https://example.com/success',
      cancelUrl: 'https://example.com/cancel',
      submitType: 'donate',
    }).then(function (result) {
      // If `redirectToCheckout` fails due to a browser or network
      // error, display the localized error message to your customer
      // using `result.error.message`.
    });
    
    stripe.redirectToCheckout({
      items: [
        // Replace with the ID of your SKU
        {sku: 'sku_123', quantity: 1}
      ],
      successUrl: 'https://example.com/success',
      cancelUrl: 'https://example.com/cancel',
      submitType: 'donate',
    }).then((result) => {
      // If `redirectToCheckout` fails due to a browser or network
      // error, display the localized error message to your customer
      // using `result.error.message`.
    });
    

    In this example (for a 5 USD donation), your customized Checkout submit button would read Donate $5.00. See the Stripe.js Reference for a complete list of submitType options.

    Define a submit_type on your session:

    curl https://api.stripe.com/v1/checkout/sessions \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d submit_type=donate \
      -d "payment_method_types[]=card" \
      -d "line_items[][name]=T-shirt" \
      -d "line_items[][description]=Comfortable cotton t-shirt" \
      -d "line_items[][images][]=https://example.com/t-shirt.png" \
      -d "line_items[][amount]=500" \
      -d "line_items[][currency]=usd" \
      -d "line_items[][quantity]=1" \
      -d success_url="https://example.com/success" \
      -d cancel_url="https://example.com/cancel"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = Stripe::Checkout::Session.create(
      submit_type: 'donate',
      payment_method_types: ['card'],
      line_items: [{
        name: 'T-shirt',
        description: 'Comfortable cotton t-shirt',
        images: ['https://example.com/t-shirt.png'],
        amount: 500,
        currency: 'usd',
        quantity: 1,
      }],
      success_url: 'https://example.com/success',
      cancel_url: 'https://example.com/cancel',
    )
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = stripe.checkout.Session.create(
      submit_type: 'donate',
      payment_method_types=['card'],
      line_items=[{
        'name': 'T-shirt',
        'description': 'Comfortable cotton t-shirt',
        'images': ['https://example.com/t-shirt.png'],
        'amount': 500,
        'currency': 'usd',
        'quantity': 1,
      }],
      success_url='https://example.com/success',
      cancel_url='https://example.com/cancel',
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    $session = \Stripe\Checkout\Session::create([
      'submit_type' => 'donate',
      'payment_method_types' => ['card'],
      'line_items' => [[
        'name' => 'T-shirt',
        'description' => 'Comfortable cotton t-shirt',
        'images' => ['https://example.com/t-shirt.png'],
        'amount' => 500,
        'currency' => 'usd',
        'quantity' => 1,
      ]],
      'success_url' => 'https://example.com/success',
      'cancel_url' => 'https://example.com/cancel',
    ]);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    Map<String, Object> params = new HashMap<String, Object>();
    
    params.put("submit_type", "donate");
    
    ArrayList<String> paymentMethodTypes = new ArrayList<>();
    paymentMethodTypes.add("card");
    params.put("payment_method_types", paymentMethodTypes);
    
    ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
    HashMap<String, Object> lineItem = new HashMap<String, Object>();
    lineItem.put("name", "T-shirt");
    lineItem.put("description", "Comfortable cotton t-shirt");
    lineItem.put("amount", 500);
    lineItem.put("currency", "usd");
    lineItem.put("quantity", 1);
    lineItems.add(lineItem);
    params.put("line_items", lineItems);
    
    params.put("success_url", "https://example.com/success");
    params.put("cancel_url", "https://example.com/cancel");
    
    Session session = Session.create(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const session = await stripe.checkout.sessions.create({
        submit_type: 'donate',
        payment_method_types: ['card'],
        line_items: [{
          name: 'T-shirt',
          description: 'Comfortable cotton t-shirt',
          images: ['https://example.com/t-shirt.png'],
          amount: 500,
          currency: 'usd',
          quantity: 1,
        }],
        success_url: 'https://example.com/success',
        cancel_url: 'https://example.com/cancel',
      });
    })();
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.CheckoutSessionParams{
        SubmitType: stripe.String("donate"),
        PaymentMethodTypes: stripe.StringSlice([]string{
            "card",
        }),
        LineItems: []*stripe.CheckoutSessionLineItemParams{
            &stripe.CheckoutSessionLineItemParams{
                Name: stripe.String("T-shirt"),
                Description: stripe.String("Comfortable cotton t-shirt"),
                Amount: stripe.Int64(500),
                Currency: stripe.String(string(stripe.CurrencyUSD)),
                Quantity: stripe.Int64(1),
            },
        },
        SuccessURL: stripe.String("https://example.com/success"),
        CancelURL: stripe.String("https://example.com/cancel"),
    }
    
    session, err := session.New(params)
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    var options = new SessionCreateOptions {
        SubmitType = "donate",
        PaymentMethodTypes = new List<string> {
            "card",
        },
        LineItems = new List<SessionLineItemOptions> {
            new SessionLineItemOptions {
                Name = "T-shirt",
                Description = "Comfortable cotton t-shirt",
                Amount = 500,
                Currency = "usd",
                Quantity = 1,
            },
        },
        SuccessUrl = "https://example.com/success",
        CancelUrl = "https://example.com/cancel",
    };
    
    var service = new SessionService();
    Session session = service.Create(options);
    

    In this example (for a 5 USD donation), your customized Checkout submit button would read Donate $5.00. See the API Reference for a complete list of submit_type options.

    Prefilling customer data Client-onlyClient and server

    You may already have collected information about your customer that you want to prefill in the Checkout page to avoid your customers needing to enter their payment information twice. You can prefill the customer email on the Checkout page by providing customerEmail in the redirectToCheckout call.

    stripe.redirectToCheckout({
      items: [
        // Replace with the ID of your SKU
        {sku: 'sku_123', quantity: 1}
      ],
      successUrl: 'https://example.com/success',
      cancelUrl: 'https://example.com/cancel',
      customerEmail: 'customer@example.com',
    }).then(function (result) {
      // If `redirectToCheckout` fails due to a browser or network
      // error, display the localized error message to your customer
      // using `result.error.message`.
    });
    
    stripe.redirectToCheckout({
      items: [
        // Replace with the ID of your SKU
        {sku: 'sku_123', quantity: 1}
      ],
      successUrl: 'https://example.com/success',
      cancelUrl: 'https://example.com/cancel',
      customerEmail: 'customer@example.com',
    }).then((result) => {
      // If `redirectToCheckout` fails due to a browser or network
      // error, display the localized error message to your customer
      // using `result.error.message`.
    });
    

    You may already have collected information about your customer that you want to prefill in the Checkout page to avoid your customers needing to enter their payment information twice. You can prefill the customer email on the Checkout page by providing customer_email when creating a Checkout Session.

    curl https://api.stripe.com/v1/checkout/sessions \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d customer_email="customer@example.com" \
      -d "payment_method_types[]=card" \
      -d "line_items[][name]=T-shirt" \
      -d "line_items[][description]=Comfortable cotton t-shirt" \
      -d "line_items[][images][]=https://example.com/t-shirt.png" \
      -d "line_items[][amount]=500" \
      -d "line_items[][currency]=usd" \
      -d "line_items[][quantity]=1" \
      -d success_url="https://example.com/success" \
      -d cancel_url="https://example.com/cancel"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = Stripe::Checkout::Session.create(
      customer_email: 'customer@example.com',
      payment_method_types: ['card'],
      line_items: [{
        name: 'T-shirt',
        description: 'Comfortable cotton t-shirt',
        images: ['https://example.com/t-shirt.png'],
        amount: 500,
        currency: 'usd',
        quantity: 1,
      }],
      success_url: 'https://example.com/success',
      cancel_url: 'https://example.com/cancel',
    )
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = stripe.checkout.Session.create(
      customer_email='customer@example.com',
      payment_method_types=['card'],
      line_items=[{
        'name': 'T-shirt',
        'description': 'Comfortable cotton t-shirt',
        'images': ['https://example.com/t-shirt.png'],
        'amount': 500,
        'currency': 'usd',
        'quantity': 1,
      }],
      success_url='https://example.com/success',
      cancel_url='https://example.com/cancel',
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    $session = \Stripe\Checkout\Session::create([
      'customer_email' => 'customer@example.com',
      'payment_method_types' => ['card'],
      'line_items' => [[
        'name' => 'T-shirt',
        'description' => 'Comfortable cotton t-shirt',
        'images' => ['https://example.com/t-shirt.png'],
        'amount' => 500,
        'currency' => 'usd',
        'quantity' => 1,
      ]],
      'success_url' => 'https://example.com/success',
      'cancel_url' => 'https://example.com/cancel',
    ]);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    Map<String, Object> params = new HashMap<String, Object>();
    
    params.put("customer_email", "customer@example.com");
    
    ArrayList<String> paymentMethodTypes = new ArrayList<>();
    paymentMethodTypes.add("card");
    params.put("payment_method_types", paymentMethodTypes);
    
    ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
    HashMap<String, Object> lineItem = new HashMap<String, Object>();
    lineItem.put("name", "T-shirt");
    lineItem.put("description", "Comfortable cotton t-shirt");
    lineItem.put("amount", 500);
    lineItem.put("currency", "usd");
    lineItem.put("quantity", 1);
    lineItems.add(lineItem);
    params.put("line_items", lineItems);
    
    params.put("success_url", "https://example.com/success");
    params.put("cancel_url", "https://example.com/cancel");
    
    Session session = Session.create(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const session = await stripe.checkout.sessions.create({
        customer_email: 'customer@example.com',
        payment_method_types: ['card'],
        line_items: [{
          name: 'T-shirt',
          description: 'Comfortable cotton t-shirt',
          images: ['https://example.com/t-shirt.png'],
          amount: 500,
          currency: 'usd',
          quantity: 1,
        }],
        success_url: 'https://example.com/success',
        cancel_url: 'https://example.com/cancel',
      });
    })();
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.CheckoutSessionParams{
        CustomerEmail: stripe.String("customer@example.com"),
        PaymentMethodTypes: stripe.StringSlice([]string{
            "card",
        }),
        LineItems: []*stripe.CheckoutSessionLineItemParams{
            &stripe.CheckoutSessionLineItemParams{
                Name: stripe.String("T-shirt"),
                Description: stripe.String("Comfortable cotton t-shirt"),
                Amount: stripe.Int64(500),
                Currency: stripe.String(string(stripe.CurrencyUSD)),
                Quantity: stripe.Int64(1),
            },
        },
        SuccessURL: stripe.String("https://example.com/success"),
        CancelURL: stripe.String("https://example.com/cancel"),
    }
    
    session, err := session.New(params)
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    var options = new SessionCreateOptions {
        CustomerEmail = "customer@example.com",
        PaymentMethodTypes = new List<string> {
            "card",
        },
        LineItems = new List<SessionLineItemOptions> {
            new SessionLineItemOptions {
                Name = "T-shirt",
                Description = "Comfortable cotton t-shirt",
                Amount = 500,
                Currency = "usd",
                Quantity = 1,
            },
        },
        SuccessUrl = "https://example.com/success",
        CancelUrl = "https://example.com/cancel",
    };
    
    var service = new SessionService();
    Session session = service.Create(options);
    

    Separate authorization and capture Client and server

    Stripe supports two-step card payments so you can first authorize the card, then wait to capture funds later. When a payment is authorized, the funds are guaranteed by the card issuer and the amount held on the customer’s card for up to seven days. If the payment is not captured within this time, the payment is canceled and funds released.

    To indicate that you want separate authorization and capture, you must set the value of payment_intent_data.capture_method option to manual when creating the Checkout Session. This instructs Stripe to only authorize the amount on the customer’s card.

    curl https://api.stripe.com/v1/checkout/sessions \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d "payment_method_types[]=card" \
      -d "line_items[][name]=T-shirt" \
      -d "line_items[][description]=Comfortable cotton t-shirt" \
      -d "line_items[][images][]=https://example.com/t-shirt.png" \
      -d "line_items[][amount]=500" \
      -d "line_items[][currency]=usd" \
      -d "line_items[][quantity]=1" \
      -d "payment_intent_data[capture_method]=manual" \
      -d success_url="https://example.com/success" \
      -d cancel_url="https://example.com/cancel"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = Stripe::Checkout::Session.create(
      payment_method_types: ['card'],
      line_items: [{
        name: 'T-shirt',
        description: 'Comfortable cotton t-shirt',
        images: ['https://example.com/t-shirt.png'],
        amount: 500,
        currency: 'usd',
        quantity: 1,
      }],
      payment_intent_data: {
        capture_method: 'manual',
      },
      success_url: 'https://example.com/success',
      cancel_url: 'https://example.com/cancel',
    )
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = stripe.checkout.Session.create(
      payment_method_types=['card'],
      line_items=[{
        'name': 'T-shirt',
        'description': 'Comfortable cotton t-shirt',
        'images': ['https://example.com/t-shirt.png'],
        'amount': 500,
        'currency': 'usd',
        'quantity': 1,
      }],
      payment_intent_data={
        'capture_method': 'manual',
      },
      success_url='https://example.com/success',
      cancel_url='https://example.com/cancel',
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    $session = \Stripe\Checkout\Session::create([
      'payment_method_types' => ['card'],
      'line_items' => [[
        'name' => 'T-shirt',
        'description' => 'Comfortable cotton t-shirt',
        'images' => ['https://example.com/t-shirt.png'],
        'amount' => 500,
        'currency' => 'usd',
        'quantity' => 1,
      ]],
      'payment_intent_data' => [
        'capture_method' => 'manual',
      ],
      'success_url' => 'https://example.com/success',
      'cancel_url' => 'https://example.com/cancel',
    ]);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    Map<String, Object> params = new HashMap<String, Object>();
    
    ArrayList<String> paymentMethodTypes = new ArrayList<>();
    paymentMethodTypes.add("card");
    params.put("payment_method_types", paymentMethodTypes);
    
    ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
    HashMap<String, Object> lineItem = new HashMap<String, Object>();
    lineItem.put("name", "T-shirt");
    lineItem.put("description", "Comfortable cotton t-shirt");
    lineItem.put("amount", 500);
    lineItem.put("currency", "usd");
    lineItem.put("quantity", 1);
    lineItems.add(lineItem);
    params.put("line_items", lineItems);
    
    HashMap<String, Object> paymentIntentData = new HashMap<String, Object>();
    paymentIntentData.put("capture_method", "manual");
    params.put("payment_intent_data", paymentIntentData);
    
    params.put("success_url", "https://example.com/success");
    params.put("cancel_url", "https://example.com/cancel");
    
    Session session = Session.create(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const session = await stripe.checkout.sessions.create({
        payment_method_types: ['card'],
        line_items: [{
          name: 'T-shirt',
          description: 'Comfortable cotton t-shirt',
          images: ['https://example.com/t-shirt.png'],
          amount: 500,
          currency: 'usd',
          quantity: 1,
        }],
        payment_intent_data: {
          capture_method: 'manual',
        },
        success_url: 'https://example.com/success',
        cancel_url: 'https://example.com/cancel',
      });
    })();
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.CheckoutSessionParams{
        PaymentMethodTypes: stripe.StringSlice([]string{
            "card",
        }),
        LineItems: []*stripe.CheckoutSessionLineItemParams{
            &stripe.CheckoutSessionLineItemParams{
                Name: stripe.String("T-shirt"),
                Description: stripe.String("Comfortable cotton t-shirt"),
                Amount: stripe.Int64(500),
                Currency: stripe.String(string(stripe.CurrencyUSD)),
                Quantity: stripe.Int64(1),
            },
        },
        PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{
            CaptureMethod: stripe.String("manual"),
        },
        SuccessURL: stripe.String("https://example.com/success"),
        CancelURL: stripe.String("https://example.com/cancel"),
    }
    
    session, err := session.New(params)
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    var options = new SessionCreateOptions {
        PaymentMethodTypes = new List<string> {
            "card",
        },
        LineItems = new List<SessionLineItemOptions> {
            new SessionLineItemOptions {
                Name = "T-shirt",
                Description = "Comfortable cotton t-shirt",
                Amount = 500,
                Currency = "usd",
                Quantity = 1,
            },
        },
        PaymentIntentData = new SessionPaymentIntentDataOptions {
            CaptureMethod = "manual",
        },
        SuccessUrl = "https://example.com/success",
        CancelUrl = "https://example.com/cancel",
    };
    
    var service = new SessionService();
    Session session = service.Create(options);
    

    To capture an uncaptured payment, you can use either the Dashboard or the API.

    Using existing customers Client and server

    You may specify an existing Customer object for Checkout to use when making one-time payments or subscriptions. If you do so, any Stripe objects that Checkout creates are associated with that Customer. When you specify a Customer, Stripe also uses the email stored on the customer to prefill the email field on the Checkout page. If the customer changes their email on the Checkout page, it will be updated on the Customer object after a successful payment.

    curl https://api.stripe.com/v1/checkout/sessions \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d customer=cus_123 \
      -d "payment_method_types[]=card" \
      -d "line_items[][name]=T-shirt" \
      -d "line_items[][description]=Comfortable cotton t-shirt" \
      -d "line_items[][images][]=https://example.com/t-shirt.png" \
      -d "line_items[][amount]=500" \
      -d "line_items[][currency]=usd" \
      -d "line_items[][quantity]=1" \
      -d success_url="https://example.com/success" \
      -d cancel_url="https://example.com/cancel"
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = Stripe::Checkout::Session.create(
      customer: 'cus_123',
      payment_method_types: ['card'],
      line_items: [{
        name: 'T-shirt',
        description: 'Comfortable cotton t-shirt',
        images: ['https://example.com/t-shirt.png'],
        amount: 500,
        currency: 'usd',
        quantity: 1,
      }],
      success_url: 'https://example.com/success',
      cancel_url: 'https://example.com/cancel',
    )
    
    # Set your secret key: remember to change this to your live secret key in production
    # See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    
    session = stripe.checkout.Session.create(
      customer='cus_123',
      payment_method_types=['card'],
      line_items=[{
        'name': 'T-shirt',
        'description': 'Comfortable cotton t-shirt',
        'images': ['https://example.com/t-shirt.png'],
        'amount': 500,
        'currency': 'usd',
        'quantity': 1,
      }],
      success_url='https://example.com/success',
      cancel_url='https://example.com/cancel',
    )
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    $session = \Stripe\Checkout\Session::create([
      'customer' => 'cus_123',
      'payment_method_types' => ['card'],
      'line_items' => [[
        'name' => 'T-shirt',
        'description' => 'Comfortable cotton t-shirt',
        'images' => ['https://example.com/t-shirt.png'],
        'amount' => 500,
        'currency' => 'usd',
        'quantity' => 1,
      ]],
      'success_url' => 'https://example.com/success',
      'cancel_url' => 'https://example.com/cancel',
    ]);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    Map<String, Object> params = new HashMap<String, Object>();
    
    params.put("customer", "cus_123");
    
    ArrayList<String> paymentMethodTypes = new ArrayList<>();
    paymentMethodTypes.add("card");
    params.put("payment_method_types", paymentMethodTypes);
    
    ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
    HashMap<String, Object> lineItem = new HashMap<String, Object>();
    lineItem.put("name", "T-shirt");
    lineItem.put("description", "Comfortable cotton t-shirt");
    lineItem.put("amount", 500);
    lineItem.put("currency", "usd");
    lineItem.put("quantity", 1);
    lineItems.add(lineItem);
    params.put("line_items", lineItems);
    
    params.put("success_url", "https://example.com/success");
    params.put("cancel_url", "https://example.com/cancel");
    
    Session session = Session.create(params);
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    
    (async () => {
      const session = await stripe.checkout.sessions.create({
        customer: 'cus_123',
        payment_method_types: ['card'],
        line_items: [{
          name: 'T-shirt',
          description: 'Comfortable cotton t-shirt',
          images: ['https://example.com/t-shirt.png'],
          amount: 500,
          currency: 'usd',
          quantity: 1,
        }],
        success_url: 'https://example.com/success',
        cancel_url: 'https://example.com/cancel',
      });
    })();
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
    
    params := &stripe.CheckoutSessionParams{
        Customer: stripe.String("cus_123"),
        PaymentMethodTypes: stripe.StringSlice([]string{
            "card",
        }),
        LineItems: []*stripe.CheckoutSessionLineItemParams{
            &stripe.CheckoutSessionLineItemParams{
                Name: stripe.String("T-shirt"),
                Description: stripe.String("Comfortable cotton t-shirt"),
                Amount: stripe.Int64(500),
                Currency: stripe.String(string(stripe.CurrencyUSD)),
                Quantity: stripe.Int64(1),
            },
        },
        SuccessURL: stripe.String("https://example.com/success"),
        CancelURL: stripe.String("https://example.com/cancel"),
    }
    
    session, err := session.New(params)
    
    // Set your secret key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
    
    var options = new SessionCreateOptions {
        Customer = "cus_123",
        PaymentMethodTypes = new List<string> {
            "card",
        },
        LineItems = new List<SessionLineItemOptions> {
            new SessionLineItemOptions {
                Name = "T-shirt",
                Description = "Comfortable cotton t-shirt",
                Amount = 500,
                Currency = "usd",
                Quantity = 1,
            },
        },
        SuccessUrl = "https://example.com/success",
        CancelUrl = "https://example.com/cancel",
    };
    
    var service = new SessionService();
    Session session = service.Create(options);
    

    Was this page helpful?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    Questions?

    We're always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team. You can also chat live with other developers in #stripe on freenode.

    On this page