Class Session

All Implemented Interfaces:
HasId, StripeObjectInterface

public class Session extends ApiResource implements HasId
  • Constructor Details

    • Session

      public Session()
  • Method Details

    • getCustomer

      public String getCustomer()
      Get ID of expandable customer object.
    • setCustomer

      public void setCustomer(String id)
    • getCustomerObject

      public Customer getCustomerObject()
      Get expanded customer.
    • setCustomerObject

      public void setCustomerObject(Customer expandableObject)
    • getPaymentIntent

      public String getPaymentIntent()
      Get ID of expandable paymentIntent object.
    • setPaymentIntent

      public void setPaymentIntent(String id)
    • getPaymentIntentObject

      public PaymentIntent getPaymentIntentObject()
      Get expanded paymentIntent.
    • setPaymentIntentObject

      public void setPaymentIntentObject(PaymentIntent expandableObject)
    • getPaymentLink

      public String getPaymentLink()
      Get ID of expandable paymentLink object.
    • setPaymentLink

      public void setPaymentLink(String id)
    • getPaymentLinkObject

      public PaymentLink getPaymentLinkObject()
      Get expanded paymentLink.
    • setPaymentLinkObject

      public void setPaymentLinkObject(PaymentLink expandableObject)
    • getSetupIntent

      public String getSetupIntent()
      Get ID of expandable setupIntent object.
    • setSetupIntent

      public void setSetupIntent(String id)
    • getSetupIntentObject

      public SetupIntent getSetupIntentObject()
      Get expanded setupIntent.
    • setSetupIntentObject

      public void setSetupIntentObject(SetupIntent expandableObject)
    • getSubscription

      public String getSubscription()
      Get ID of expandable subscription object.
    • setSubscription

      public void setSubscription(String id)
    • getSubscriptionObject

      public Subscription getSubscriptionObject()
      Get expanded subscription.
    • setSubscriptionObject

      public void setSubscriptionObject(Subscription expandableObject)
    • list

      public static SessionCollection list(Map<String,Object> params) throws StripeException
      Returns a list of Checkout Sessions.
      Throws:
      StripeException
    • list

      public static SessionCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of Checkout Sessions.
      Throws:
      StripeException
    • list

      public static SessionCollection list(SessionListParams params) throws StripeException
      Returns a list of Checkout Sessions.
      Throws:
      StripeException
    • list

      public static SessionCollection list(SessionListParams params, RequestOptions options) throws StripeException
      Returns a list of Checkout Sessions.
      Throws:
      StripeException
    • retrieve

      public static Session retrieve(String session) throws StripeException
      Retrieves a Session object.
      Throws:
      StripeException
    • retrieve

      public static Session retrieve(String session, RequestOptions options) throws StripeException
      Retrieves a Session object.
      Throws:
      StripeException
    • retrieve

      public static Session retrieve(String session, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves a Session object.
      Throws:
      StripeException
    • retrieve

      public static Session retrieve(String session, SessionRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves a Session object.
      Throws:
      StripeException
    • create

      public static Session create(Map<String,Object> params) throws StripeException
      Creates a Session object.
      Throws:
      StripeException
    • create

      public static Session create(Map<String,Object> params, RequestOptions options) throws StripeException
      Creates a Session object.
      Throws:
      StripeException
    • create

      public static Session create(SessionCreateParams params) throws StripeException
      Creates a Session object.
      Throws:
      StripeException
    • create

      public static Session create(SessionCreateParams params, RequestOptions options) throws StripeException
      Creates a Session object.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems() throws StripeException
      When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(Map<String,Object> params) throws StripeException
      When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(Map<String,Object> params, RequestOptions options) throws StripeException
      When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(SessionListLineItemsParams params) throws StripeException
      When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(SessionListLineItemsParams params, RequestOptions options) throws StripeException
      When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • expire

      public Session expire() throws StripeException
      A Session can be expired when it is in one of these statuses: open

      After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

      Throws:
      StripeException
    • expire

      public Session expire(RequestOptions options) throws StripeException
      A Session can be expired when it is in one of these statuses: open

      After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

      Throws:
      StripeException
    • expire

      public Session expire(Map<String,Object> params) throws StripeException
      A Session can be expired when it is in one of these statuses: open

      After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

      Throws:
      StripeException
    • expire

      public Session expire(Map<String,Object> params, RequestOptions options) throws StripeException
      A Session can be expired when it is in one of these statuses: open

      After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

      Throws:
      StripeException
    • expire

      public Session expire(SessionExpireParams params) throws StripeException
      A Session can be expired when it is in one of these statuses: open

      After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

      Throws:
      StripeException
    • expire

      public Session expire(SessionExpireParams params, RequestOptions options) throws StripeException
      A Session can be expired when it is in one of these statuses: open

      After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.

      Throws:
      StripeException
    • getAfterExpiration

      public Session.AfterExpiration getAfterExpiration()
      When set, provides configuration for actions to take if this Checkout Session expires.
    • getAllowPromotionCodes

      public Boolean getAllowPromotionCodes()
      Enables user redeemable promotion codes.
    • getAmountSubtotal

      public Long getAmountSubtotal()
      Total of all items before discounts or taxes are applied.
    • getAmountTotal

      public Long getAmountTotal()
      Total of all items after discounts and taxes are applied.
    • getAutomaticTax

      public Session.AutomaticTax getAutomaticTax()
    • getBillingAddressCollection

      public String getBillingAddressCollection()
      Describes whether Checkout should collect the customer's billing address.

      One of auto, or required.

    • getCancelUrl

      public String getCancelUrl()
      The URL the customer will be directed to if they decide to cancel payment and return to your website.
    • getClientReferenceId

      public String getClientReferenceId()
      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.
    • getConsent

      public Session.Consent getConsent()
      Results of consent_collection for this session.
    • getConsentCollection

      public Session.ConsentCollection getConsentCollection()
      When set, provides configuration for the Checkout Session to gather active consent from customers.
    • getCurrency

      public String getCurrency()
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • getCustomerCreation

      public String getCustomerCreation()
      Configure whether a Checkout Session creates a Customer when the Checkout Session completes.

      One of always, or if_required.

    • getCustomerDetails

      public Session.CustomerDetails getCustomerDetails()
      The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in setup mode.
    • getCustomerEmail

      public String getCustomerEmail()
      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 the payment flow is complete, use the customer attribute.
    • getExpiresAt

      public Long getExpiresAt()
      The timestamp at which the Checkout Session will expire.
    • getLineItems

      public LineItemCollection getLineItems()
      The line items purchased by the customer.
    • getLivemode

      public Boolean getLivemode()
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • getLocale

      public String getLocale()
      The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser's locale is used.

      One of auto, bg, cs, da, de, el, en, en-GB, es, es-419, et, fi, fil, fr, fr-CA, hr, hu, id, it, ja, ko, lt, lv, ms, mt, nb, nl, pl, pt, pt-BR, ro, ru, sk, sl, sv, th, tr, vi, zh, zh-HK, or zh-TW.

    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • getMode

      public String getMode()
      The mode of the Checkout Session.

      One of payment, setup, or subscription.

    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to checkout.session.

    • getPaymentMethodOptions

      public Session.PaymentMethodOptions getPaymentMethodOptions()
      Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
    • getPaymentMethodTypes

      public List<String> getPaymentMethodTypes()
      A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
    • getPaymentStatus

      public String getPaymentStatus()
      The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer's order.
    • getPhoneNumberCollection

      public Session.PhoneNumberCollection getPhoneNumberCollection()
    • getRecoveredFrom

      public String getRecoveredFrom()
      The ID of the original expired Checkout Session that triggered the recovery flow.
    • getShippingAddressCollection

      public Session.ShippingAddressCollection getShippingAddressCollection()
      When set, provides configuration for Checkout to collect a shipping address from a customer.
    • getShippingCost

      public Session.ShippingCost getShippingCost()
      The details of the customer cost of shipping, including the customer chosen ShippingRate.
    • getShippingDetails

      public ShippingDetails getShippingDetails()
      Shipping information for this Checkout Session.
    • getShippingOptions

      public List<Session.ShippingOption> getShippingOptions()
      The shipping rate options applied to this Session.
    • getStatus

      public String getStatus()
      The status of the Checkout Session, one of open, complete, or expired.
    • getSubmitType

      public String getSubmitType()
      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.

      One of auto, book, donate, or pay.

    • getSuccessUrl

      public String getSuccessUrl()
      The URL the customer will be directed to after the payment or subscription creation is successful.
    • getTaxIdCollection

      public Session.TaxIDCollection getTaxIdCollection()
    • getTotalDetails

      public Session.TotalDetails getTotalDetails()
      Tax and discount details for the computed total amount.
    • getUrl

      public String getUrl()
      The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com.
    • setAfterExpiration

      public void setAfterExpiration(Session.AfterExpiration afterExpiration)
      When set, provides configuration for actions to take if this Checkout Session expires.
    • setAllowPromotionCodes

      public void setAllowPromotionCodes(Boolean allowPromotionCodes)
      Enables user redeemable promotion codes.
    • setAmountSubtotal

      public void setAmountSubtotal(Long amountSubtotal)
      Total of all items before discounts or taxes are applied.
    • setAmountTotal

      public void setAmountTotal(Long amountTotal)
      Total of all items after discounts and taxes are applied.
    • setAutomaticTax

      public void setAutomaticTax(Session.AutomaticTax automaticTax)
    • setBillingAddressCollection

      public void setBillingAddressCollection(String billingAddressCollection)
      Describes whether Checkout should collect the customer's billing address.

      One of auto, or required.

    • setCancelUrl

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

      public void 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.
    • setConsent

      public void setConsent(Session.Consent consent)
      Results of consent_collection for this session.
    • setConsentCollection

      public void setConsentCollection(Session.ConsentCollection consentCollection)
      When set, provides configuration for the Checkout Session to gather active consent from customers.
    • setCurrency

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

      public void setCustomerCreation(String customerCreation)
      Configure whether a Checkout Session creates a Customer when the Checkout Session completes.

      One of always, or if_required.

    • setCustomerDetails

      public void setCustomerDetails(Session.CustomerDetails customerDetails)
      The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in setup mode.
    • setCustomerEmail

      public void 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 the payment flow is complete, use the customer attribute.
    • setExpiresAt

      public void setExpiresAt(Long expiresAt)
      The timestamp at which the Checkout Session will expire.
    • setId

      public void setId(String id)
      Unique identifier for the object. Used to pass to redirectToCheckout in Stripe.js.
    • setLineItems

      public void setLineItems(LineItemCollection lineItems)
      The line items purchased by the customer.
    • setLivemode

      public void setLivemode(Boolean livemode)
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • setLocale

      public void setLocale(String locale)
      The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser's locale is used.

      One of auto, bg, cs, da, de, el, en, en-GB, es, es-419, et, fi, fil, fr, fr-CA, hr, hu, id, it, ja, ko, lt, lv, ms, mt, nb, nl, pl, pt, pt-BR, ro, ru, sk, sl, sv, th, tr, vi, zh, zh-HK, or zh-TW.

    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setMode

      public void setMode(String mode)
      The mode of the Checkout Session.

      One of payment, setup, or subscription.

    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to checkout.session.

    • setPaymentMethodOptions

      public void setPaymentMethodOptions(Session.PaymentMethodOptions paymentMethodOptions)
      Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
    • setPaymentMethodTypes

      public void setPaymentMethodTypes(List<String> paymentMethodTypes)
      A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
    • setPaymentStatus

      public void setPaymentStatus(String paymentStatus)
      The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer's order.
    • setPhoneNumberCollection

      public void setPhoneNumberCollection(Session.PhoneNumberCollection phoneNumberCollection)
    • setRecoveredFrom

      public void setRecoveredFrom(String recoveredFrom)
      The ID of the original expired Checkout Session that triggered the recovery flow.
    • setShippingAddressCollection

      public void setShippingAddressCollection(Session.ShippingAddressCollection shippingAddressCollection)
      When set, provides configuration for Checkout to collect a shipping address from a customer.
    • setShippingCost

      public void setShippingCost(Session.ShippingCost shippingCost)
      The details of the customer cost of shipping, including the customer chosen ShippingRate.
    • setShippingDetails

      public void setShippingDetails(ShippingDetails shippingDetails)
      Shipping information for this Checkout Session.
    • setShippingOptions

      public void setShippingOptions(List<Session.ShippingOption> shippingOptions)
      The shipping rate options applied to this Session.
    • setStatus

      public void setStatus(String status)
      The status of the Checkout Session, one of open, complete, or expired.
    • setSubmitType

      public void setSubmitType(String 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.

      One of auto, book, donate, or pay.

    • setSuccessUrl

      public void setSuccessUrl(String successUrl)
      The URL the customer will be directed to after the payment or subscription creation is successful.
    • setTaxIdCollection

      public void setTaxIdCollection(Session.TaxIDCollection taxIdCollection)
    • setTotalDetails

      public void setTotalDetails(Session.TotalDetails totalDetails)
      Tax and discount details for the computed total amount.
    • setUrl

      public void setUrl(String url)
      The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object. Used to pass to redirectToCheckout in Stripe.js.
      Specified by:
      getId in interface HasId