Class SessionCreateParams.Builder
- Enclosing class:
- SessionCreateParams
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd all elements to `checkoutItems` list.addAllCustomField(List<SessionCreateParams.CustomField> elements) Add all elements to `customFields` list.addAllDiscount(List<SessionCreateParams.Discount> elements) Add all elements to `discounts` list.Add all elements to `excludedPaymentMethodTypes` list.addAllExpand(List<String> elements) Add all elements to `expand` list.addAllLineItem(List<SessionCreateParams.LineItem> elements) Add all elements to `lineItems` list.Add all elements to `optionalItems` list.Add all elements to `paymentMethodTypes` list.Add all elements to `shippingOptions` list.Add an element to `checkoutItems` list.Add an element to `customFields` list.addDiscount(SessionCreateParams.Discount element) Add an element to `discounts` list.Add an element to `excludedPaymentMethodTypes` list.Add an element to `expand` list.addLineItem(SessionCreateParams.LineItem element) Add an element to `lineItems` list.Add an element to `optionalItems` list.Add an element to `paymentMethodTypes` list.Add an element to `shippingOptions` list.build()Finalize and obtain parameter instance from this builder.putAllExtraParam(Map<String, Object> map) Add all map key/value pairs to `extraParams` map.putAllMetadata(Map<String, String> map) Add all map key/value pairs to `metadata` map.putExtraParam(String key, Object value) Add a key/value pair to `extraParams` map.putMetadata(String key, String value) Add a key/value pair to `metadata` map.setAdaptivePricing(SessionCreateParams.AdaptivePricing adaptivePricing) Settings for price localization with Adaptive Pricing.setAfterExpiration(SessionCreateParams.AfterExpiration afterExpiration) Configure actions after a Checkout Session has expired.setAllowPromotionCodes(Boolean allowPromotionCodes) Enables user redeemable promotion codes.setAutomaticTax(SessionCreateParams.AutomaticTax automaticTax) Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.setBillingAddressCollection(SessionCreateParams.BillingAddressCollection billingAddressCollection) Specify whether Checkout should collect the customer's billing address.setBrandingSettings(SessionCreateParams.BrandingSettings brandingSettings) The branding settings for the Checkout Session.setCancelUrl(String cancelUrl) If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.setClientReferenceId(String clientReferenceId) A unique string to reference the Checkout Session.setConsentCollection(SessionCreateParams.ConsentCollection consentCollection) Configure fields for the Checkout Session to gather active consent from customers.setCurrency(String currency) Three-letter ISO currency code, in lowercase.setCustomer(String customer) ID of an existing Customer, if one exists.setCustomerAccount(String customerAccount) ID of an existing Account, if one exists.setCustomerCreation(SessionCreateParams.CustomerCreation customerCreation) Configure whether a Checkout Session creates a Customer during Session confirmation.setCustomerEmail(String customerEmail) If provided, this value will be used when the Customer object is created.setCustomerUpdate(SessionCreateParams.CustomerUpdate customerUpdate) Controls what fields on Customer can be updated by the Checkout Session.setCustomText(SessionCreateParams.CustomText customText) Display additional text for your customers using custom text.setExpiresAt(Long expiresAt) The Epoch time in seconds at which the Checkout Session will expire.setInvoiceCreation(SessionCreateParams.InvoiceCreation invoiceCreation) Generate a post-purchase Invoice for one-time payments.setLocale(SessionCreateParams.Locale locale) The IETF language tag of the locale Checkout is displayed in.The mode of the Checkout Session.setNameCollection(SessionCreateParams.NameCollection nameCollection) Controls name collection settings for the session.setOriginContext(SessionCreateParams.OriginContext originContext) Where the user is coming from.setPaymentIntentData(SessionCreateParams.PaymentIntentData paymentIntentData) A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions inpaymentmode.setPaymentMethodCollection(SessionCreateParams.PaymentMethodCollection paymentMethodCollection) Specify whether Checkout should collect a payment method.setPaymentMethodConfiguration(String paymentMethodConfiguration) The ID of the payment method configuration to use with this Checkout session.setPaymentMethodData(SessionCreateParams.PaymentMethodData paymentMethodData) This parameter allows you to set some attributes on the payment method created during a Checkout session.setPaymentMethodOptions(SessionCreateParams.PaymentMethodOptions paymentMethodOptions) Payment-method-specific configuration.setPermissions(SessionCreateParams.Permissions permissions) This property is used to set up permissions for various actions (e.g., update) on the CheckoutSession object.setPhoneNumberCollection(SessionCreateParams.PhoneNumberCollection phoneNumberCollection) Controls phone number collection settings for the session.setRedirectOnCompletion(SessionCreateParams.RedirectOnCompletion redirectOnCompletion) This parameter applies toui_mode: embedded.setReturnUrl(String returnUrl) The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.setSavedPaymentMethodOptions(SessionCreateParams.SavedPaymentMethodOptions savedPaymentMethodOptions) Controls saved payment method settings for the session.setSetupIntentData(SessionCreateParams.SetupIntentData setupIntentData) A subset of parameters to be passed to SetupIntent creation for Checkout Sessions insetupmode.setShippingAddressCollection(SessionCreateParams.ShippingAddressCollection shippingAddressCollection) When set, provides configuration for Checkout to collect a shipping address from a customer.setSubmitType(SessionCreateParams.SubmitType submitType) Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button.setSubscriptionData(SessionCreateParams.SubscriptionData subscriptionData) A subset of parameters to be passed to subscription creation for Checkout Sessions insubscriptionmode.setSuccessUrl(String successUrl) The URL to which Stripe should send customers when payment or setup is complete.setTaxIdCollection(SessionCreateParams.TaxIdCollection taxIdCollection) Controls tax ID collection during checkout.setUiMode(SessionCreateParams.UiMode uiMode) The UI mode of the Session.setWalletOptions(SessionCreateParams.WalletOptions walletOptions) Wallet-specific configuration.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Finalize and obtain parameter instance from this builder. -
setAdaptivePricing
public SessionCreateParams.Builder setAdaptivePricing(SessionCreateParams.AdaptivePricing adaptivePricing) Settings for price localization with Adaptive Pricing. -
setAfterExpiration
public SessionCreateParams.Builder setAfterExpiration(SessionCreateParams.AfterExpiration afterExpiration) Configure actions after a Checkout Session has expired. -
setAllowPromotionCodes
Enables user redeemable promotion codes. -
setAutomaticTax
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. Defaults toauto. -
setBrandingSettings
public SessionCreateParams.Builder setBrandingSettings(SessionCreateParams.BrandingSettings brandingSettings) The branding settings for the Checkout Session. This parameter is not allowed if ui_mode iscustom. -
setCancelUrl
If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website. This parameter is not allowed if ui_mode isembeddedorcustom. -
addCheckoutItem
Add an element to `checkoutItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.checkoutItemsfor the field documentation. -
addAllCheckoutItem
public SessionCreateParams.Builder addAllCheckoutItem(List<SessionCreateParams.CheckoutItem> elements) Add all elements to `checkoutItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.checkoutItemsfor the field documentation. -
setClientReferenceId
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
Three-letter ISO currency code, in lowercase. Must be a supported currency. Required insetupmode whenpayment_method_typesis not set. -
addCustomField
Add an element to `customFields` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.customFieldsfor the field documentation. -
addAllCustomField
public SessionCreateParams.Builder addAllCustomField(List<SessionCreateParams.CustomField> elements) Add all elements to `customFields` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.customFieldsfor the field documentation. -
setCustomText
Display additional text for your customers using custom text. -
setCustomer
ID of an existing Customer, if one exists. Inpaymentmode, the customer’s most recently saved card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. Insubscriptionmode, the customer’s default payment method will be used if it’s a card, otherwise the most recently saved 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
subscriptionmode or withcustomer_creationset asalwaysinpaymentmode, Checkout will create a new Customer object based on information provided during the payment flow.You can set
payment_intent_data.setup_future_usageto have Checkout automatically attach the payment method to the Customer you pass in for future reuse. -
setCustomerAccount
ID of an existing Account, if one exists. Has the same behavior ascustomer. -
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 are grouped by guest customers in the Dashboard. Promotion codes limited to first time customers will return invalid for these Sessions.
Can only be set in
paymentandsetupmode. -
setCustomerEmail
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 thecustomerfield. -
setCustomerUpdate
public SessionCreateParams.Builder setCustomerUpdate(SessionCreateParams.CustomerUpdate customerUpdate) Controls what fields on Customer can be updated by the Checkout Session. Can only be provided whencustomeris 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. SeeSessionCreateParams.discountsfor 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. SeeSessionCreateParams.discountsfor the field documentation. -
addExcludedPaymentMethodType
public SessionCreateParams.Builder addExcludedPaymentMethodType(SessionCreateParams.ExcludedPaymentMethodType element) Add an element to `excludedPaymentMethodTypes` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.excludedPaymentMethodTypesfor the field documentation. -
addAllExcludedPaymentMethodType
public SessionCreateParams.Builder addAllExcludedPaymentMethodType(List<SessionCreateParams.ExcludedPaymentMethodType> elements) Add all elements to `excludedPaymentMethodTypes` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.excludedPaymentMethodTypesfor the field documentation. -
addExpand
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. SeeSessionCreateParams.expandfor the field documentation. -
addAllExpand
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. SeeSessionCreateParams.expandfor the field documentation. -
setExpiresAt
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
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. SeeSessionCreateParams.extraParamsfor the field documentation. -
putAllExtraParam
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. SeeSessionCreateParams.extraParamsfor the field documentation. -
setInvoiceCreation
public SessionCreateParams.Builder setInvoiceCreation(SessionCreateParams.InvoiceCreation invoiceCreation) Generate a post-purchase Invoice for one-time payments. -
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. SeeSessionCreateParams.lineItemsfor 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. SeeSessionCreateParams.lineItemsfor the field documentation. -
setLocale
The IETF language tag of the locale Checkout is displayed in. If blank orauto, the browser's locale is used. -
putMetadata
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. SeeSessionCreateParams.metadatafor the field documentation. -
putAllMetadata
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. SeeSessionCreateParams.metadatafor the field documentation. -
setMode
The mode of the Checkout Session. Passsubscriptionif the Checkout Session includes at least one recurring item. -
setNameCollection
public SessionCreateParams.Builder setNameCollection(SessionCreateParams.NameCollection nameCollection) Controls name collection settings for the session.You can configure Checkout to collect your customers' business names, individual names, or both. Each name field can be either required or optional.
If a Customer is created or provided, the names can be saved to the Customer object as well.
-
addOptionalItem
Add an element to `optionalItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.optionalItemsfor the field documentation. -
addAllOptionalItem
public SessionCreateParams.Builder addAllOptionalItem(List<SessionCreateParams.OptionalItem> elements) Add all elements to `optionalItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeSessionCreateParams.optionalItemsfor the field documentation. -
setOriginContext
public SessionCreateParams.Builder setOriginContext(SessionCreateParams.OriginContext originContext) Where the user is coming from. This informs the optimizations that are applied to the session. -
setPaymentIntentData
public SessionCreateParams.Builder setPaymentIntentData(SessionCreateParams.PaymentIntentData paymentIntentData) A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions inpaymentmode. -
setPaymentMethodCollection
public SessionCreateParams.Builder setPaymentMethodCollection(SessionCreateParams.PaymentMethodCollection paymentMethodCollection) Specify whether Checkout should collect a payment method. When set toif_required, Checkout will not collect a payment method when the total due for the session is 0. This may occur if the Checkout Session includes a free trial or a discount.Can only be set in
subscriptionmode. Defaults toalways.If you'd like information on how to collect a payment method outside of Checkout, read the guide on configuring subscriptions with a free trial.
-
setPaymentMethodConfiguration
The ID of the payment method configuration to use with this Checkout session. -
setPaymentMethodData
public SessionCreateParams.Builder setPaymentMethodData(SessionCreateParams.PaymentMethodData paymentMethodData) This parameter allows you to set some attributes on the payment method created during a Checkout session. -
setPaymentMethodOptions
public SessionCreateParams.Builder setPaymentMethodOptions(SessionCreateParams.PaymentMethodOptions paymentMethodOptions) Payment-method-specific configuration. -
addPaymentMethodType
public SessionCreateParams.Builder addPaymentMethodType(SessionCreateParams.PaymentMethodType element) 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. SeeSessionCreateParams.paymentMethodTypesfor 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. SeeSessionCreateParams.paymentMethodTypesfor the field documentation. -
setPermissions
This property is used to set up permissions for various actions (e.g., update) on the CheckoutSession object. Can only be set when creatingembeddedorcustomsessions.For specific permissions, please refer to their dedicated subsections, such as
permissions.update_shipping_details. -
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.
-
setRedirectOnCompletion
public SessionCreateParams.Builder setRedirectOnCompletion(SessionCreateParams.RedirectOnCompletion redirectOnCompletion) This parameter applies toui_mode: embedded. Learn more about the redirect behavior of embedded sessions. Defaults toalways. -
setReturnUrl
The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. This parameter is required ifui_modeisembeddedorcustomand redirect-based payment methods are enabled on the session. -
setSavedPaymentMethodOptions
public SessionCreateParams.Builder setSavedPaymentMethodOptions(SessionCreateParams.SavedPaymentMethodOptions savedPaymentMethodOptions) Controls saved payment method settings for the session. Only available inpaymentandsubscriptionmode. -
setSetupIntentData
public SessionCreateParams.Builder setSetupIntentData(SessionCreateParams.SetupIntentData setupIntentData) A subset of parameters to be passed to SetupIntent creation for Checkout Sessions insetupmode. -
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. SeeSessionCreateParams.shippingOptionsfor 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. SeeSessionCreateParams.shippingOptionsfor 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_typecan only be specified on Checkout Sessions inpaymentorsubscriptionmode. If blank orauto,payis used. -
setSubscriptionData
public SessionCreateParams.Builder setSubscriptionData(SessionCreateParams.SubscriptionData subscriptionData) A subset of parameters to be passed to subscription creation for Checkout Sessions insubscriptionmode. -
setSuccessUrl
The URL to which Stripe should send customers when payment or setup is complete. This parameter is not allowed if ui_mode isembeddedorcustom. 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 during checkout. -
setUiMode
The UI mode of the Session. Defaults tohosted. -
setWalletOptions
public SessionCreateParams.Builder setWalletOptions(SessionCreateParams.WalletOptions walletOptions) Wallet-specific configuration.
-