Class SessionCreateParams.Builder

java.lang.Object
com.stripe.param.checkout.SessionCreateParams.Builder
Enclosing class:
SessionCreateParams

public static class SessionCreateParams.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public SessionCreateParams build()
      Finalize and obtain parameter instance from this builder.
    • setAfterExpiration

      public SessionCreateParams.Builder setAfterExpiration(SessionCreateParams.AfterExpiration afterExpiration)
      Configure actions after a Checkout Session has expired.
    • setAllowPromotionCodes

      public SessionCreateParams.Builder setAllowPromotionCodes(Boolean allowPromotionCodes)
      Enables user redeemable promotion codes.
    • setAutomaticTax

      public SessionCreateParams.Builder setAutomaticTax(SessionCreateParams.AutomaticTax automaticTax)
      Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.
    • setBillingAddressCollection

      public SessionCreateParams.Builder setBillingAddressCollection(SessionCreateParams.BillingAddressCollection billingAddressCollection)
      Specify whether Checkout should collect the customer's billing address.
    • setCancelUrl

      public SessionCreateParams.Builder setCancelUrl(String cancelUrl)
      The URL the customer will be directed to if they decide to cancel payment and return to your website.
    • setClientReferenceId

      public SessionCreateParams.Builder setClientReferenceId(String clientReferenceId)
      A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the session with your internal systems.
    • setConsentCollection

      public SessionCreateParams.Builder setConsentCollection(SessionCreateParams.ConsentCollection consentCollection)
      Configure fields for the Checkout Session to gather active consent from customers.
    • setCurrency

      public SessionCreateParams.Builder setCurrency(String currency)
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • setCustomer

      public SessionCreateParams.Builder setCustomer(String customer)
      ID of an existing Customer, if one exists. In payment mode, the customer’s most recent card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. In subscription mode, the customer’s default payment method will be used if it’s a card, and otherwise the most recent card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer's card details.

      If the Customer already has a valid email set, the email will be prefilled and not editable in Checkout. If the Customer does not have a valid email, Checkout will set the email entered during the session on the Customer.

      If blank for Checkout Sessions in payment or subscription mode, Checkout will create a new Customer object based on information provided during the payment flow.

      You can set payment_intent_data.setup_future_usage to have Checkout automatically attach the payment method to the Customer you pass in for future reuse.

    • setCustomerCreation

      public SessionCreateParams.Builder setCustomerCreation(SessionCreateParams.CustomerCreation customerCreation)
      Configure whether a Checkout Session creates a Customer during Session confirmation.

      When a Customer is not created, you can still retrieve email, address, and other customer data entered in Checkout with customer_details.

      Sessions that don't create Customers instead create Guest Customers in the Dashboard. Promotion codes limited to first time customers will return invalid for these Sessions.

      Can only be set in payment and setup mode.

    • setCustomerEmail

      public SessionCreateParams.Builder setCustomerEmail(String customerEmail)
      If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the customer field.
    • setCustomerUpdate

      public SessionCreateParams.Builder setCustomerUpdate(SessionCreateParams.CustomerUpdate customerUpdate)
      Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when customer is provided.
    • addDiscount

      Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.discounts for the field documentation.
    • addAllDiscount

      Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.discounts for the field documentation.
    • addExpand

      public SessionCreateParams.Builder addExpand(String element)
      Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.expand for the field documentation.
    • addAllExpand

      public SessionCreateParams.Builder addAllExpand(List<String> elements)
      Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.expand for the field documentation.
    • setExpiresAt

      public SessionCreateParams.Builder setExpiresAt(Long expiresAt)
      The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 30 minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation.
    • putExtraParam

      public SessionCreateParams.Builder putExtraParam(String key, Object value)
      Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See SessionCreateParams.extraParams for the field documentation.
    • putAllExtraParam

      public SessionCreateParams.Builder putAllExtraParam(Map<String,Object> map)
      Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See SessionCreateParams.extraParams for the field documentation.
    • addLineItem

      Add an element to `lineItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.lineItems for the field documentation.
    • addAllLineItem

      Add all elements to `lineItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.lineItems for the field documentation.
    • setLocale

      The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser's locale is used.
    • putMetadata

      public SessionCreateParams.Builder putMetadata(String key, String value)
      Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See SessionCreateParams.metadata for the field documentation.
    • putAllMetadata

      public SessionCreateParams.Builder putAllMetadata(Map<String,String> map)
      Add all map key/value pairs to `metadata` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See SessionCreateParams.metadata for the field documentation.
    • setMode

      The mode of the Checkout Session. Required when using prices or setup mode. Pass subscription if the Checkout Session includes at least one recurring item.
    • setPaymentIntentData

      public SessionCreateParams.Builder setPaymentIntentData(SessionCreateParams.PaymentIntentData paymentIntentData)
      A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.
    • setPaymentMethodOptions

      public SessionCreateParams.Builder setPaymentMethodOptions(SessionCreateParams.PaymentMethodOptions paymentMethodOptions)
      Payment-method-specific configuration.
    • addPaymentMethodType

      Add an element to `paymentMethodTypes` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.paymentMethodTypes for the field documentation.
    • addAllPaymentMethodType

      public SessionCreateParams.Builder addAllPaymentMethodType(List<SessionCreateParams.PaymentMethodType> elements)
      Add all elements to `paymentMethodTypes` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.paymentMethodTypes for the field documentation.
    • setPhoneNumberCollection

      public SessionCreateParams.Builder setPhoneNumberCollection(SessionCreateParams.PhoneNumberCollection phoneNumberCollection)
      Controls phone number collection settings for the session.

      We recommend that you review your privacy policy and check with your legal contacts before using this feature. Learn more about collecting phone numbers with Checkout.

    • setSetupIntentData

      public SessionCreateParams.Builder setSetupIntentData(SessionCreateParams.SetupIntentData setupIntentData)
      A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in setup mode.
    • setShippingAddressCollection

      public SessionCreateParams.Builder setShippingAddressCollection(SessionCreateParams.ShippingAddressCollection shippingAddressCollection)
      When set, provides configuration for Checkout to collect a shipping address from a customer.
    • addShippingOption

      Add an element to `shippingOptions` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.shippingOptions for the field documentation.
    • addAllShippingOption

      public SessionCreateParams.Builder addAllShippingOption(List<SessionCreateParams.ShippingOption> elements)
      Add all elements to `shippingOptions` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.shippingOptions for the field documentation.
    • addShippingRate

      public SessionCreateParams.Builder addShippingRate(String element)
      Add an element to `shippingRates` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.shippingRates for the field documentation.
    • addAllShippingRate

      public SessionCreateParams.Builder addAllShippingRate(List<String> elements)
      Add all elements to `shippingRates` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See SessionCreateParams.shippingRates for the field documentation.
    • setSubmitType

      Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode.
    • setSubscriptionData

      public SessionCreateParams.Builder setSubscriptionData(SessionCreateParams.SubscriptionData subscriptionData)
      A subset of parameters to be passed to subscription creation for Checkout Sessions in subscription mode.
    • setSuccessUrl

      public SessionCreateParams.Builder setSuccessUrl(String successUrl)
      The URL to which Stripe should send customers when payment or setup is complete. If you’d like to use information from the successful Checkout Session on your page, read the guide on customizing your success page.
    • setTaxIdCollection

      public SessionCreateParams.Builder setTaxIdCollection(SessionCreateParams.TaxIdCollection taxIdCollection)
      Controls tax ID collection settings for the session.