Class SessionCreateParams.Builder

  • Enclosing class:
    SessionCreateParams

    public static class SessionCreateParams.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • build

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

        public SessionCreateParams.Builder setAllowPromotionCodes​(java.lang.Boolean allowPromotionCodes)
        Enables user redeemable promotion codes.
      • setCancelUrl

        public SessionCreateParams.Builder setCancelUrl​(java.lang.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​(java.lang.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.
      • setCustomer

        public SessionCreateParams.Builder setCustomer​(java.lang.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 is required for Checkout to prefill the customer's card details.

        If the customer changes their email on the Checkout page, the Customer object will be updated with the new email.

        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.

      • setCustomerEmail

        public SessionCreateParams.Builder setCustomerEmail​(java.lang.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.
      • addExpand

        public SessionCreateParams.Builder addExpand​(java.lang.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​(java.util.List<java.lang.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.
      • putExtraParam

        public SessionCreateParams.Builder putExtraParam​(java.lang.String key,
                                                         java.lang.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​(java.util.Map<java.lang.String,​java.lang.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.
      • putMetadata

        public SessionCreateParams.Builder putMetadata​(java.lang.String key,
                                                       java.lang.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​(java.util.Map<java.lang.String,​java.lang.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.
      • addShippingRate

        public SessionCreateParams.Builder addShippingRate​(java.lang.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​(java.util.List<java.lang.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

        public SessionCreateParams.Builder 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. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode.
      • setSuccessUrl

        public SessionCreateParams.Builder setSuccessUrl​(java.lang.String successUrl)
        The URL to which Stripe should send customers when payment or setup is complete. If you’d like access to the Checkout Session for the successful payment, read more about it in the guide on fulfilling orders.