Class CustomerSession

All Implemented Interfaces:
StripeActiveObject, StripeObjectInterface

public class CustomerSession extends ApiResource
A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access control over a Customer.

Related guides: Customer Session with the Payment Element, Customer Session with the Pricing Table, Customer Session with the Buy Button.

  • Constructor Details

    • CustomerSession

      public CustomerSession()
  • 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)
    • create

      public static CustomerSession create(Map<String,Object> params) throws StripeException
      Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
      Throws:
      StripeException
    • create

      public static CustomerSession create(Map<String,Object> params, RequestOptions options) throws StripeException
      Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
      Throws:
      StripeException
    • create

      public static CustomerSession create(CustomerSessionCreateParams params) throws StripeException
      Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
      Throws:
      StripeException
    • create

      public static CustomerSession create(CustomerSessionCreateParams params, RequestOptions options) throws StripeException
      Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
      Throws:
      StripeException
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      Whether the pricing table is enabled.
      Specified by:
      setResponseGetter in interface StripeActiveObject
      Overrides:
      setResponseGetter in class ApiResource
      Parameters:
      responseGetter - the StripeResponseGetter instance to use for making further requests.
    • getClientSecret

      public String getClientSecret()
      The client secret of this Customer Session. Used on the client to set up secure access to the given customer.

      The client secret can be used to provide access to customer from your frontend. It should not be stored, logged, or exposed to anyone other than the relevant customer. Make sure that you have TLS enabled on any page that includes the client secret.

    • getComponents

      public CustomerSession.Components getComponents()
      Configuration for the components supported by this Customer Session.
    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getExpiresAt

      public Long getExpiresAt()
      The timestamp at which this Customer Session will expire.
    • 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.
    • getObject

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

      Equal to customer_session.

    • setClientSecret

      public void setClientSecret(String clientSecret)
      The client secret of this Customer Session. Used on the client to set up secure access to the given customer.

      The client secret can be used to provide access to customer from your frontend. It should not be stored, logged, or exposed to anyone other than the relevant customer. Make sure that you have TLS enabled on any page that includes the client secret.

    • setComponents

      public void setComponents(CustomerSession.Components components)
      Configuration for the components supported by this Customer Session.
    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setExpiresAt

      public void setExpiresAt(Long expiresAt)
      The timestamp at which this Customer Session will expire.
    • 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.
    • setObject

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

      Equal to customer_session.

    • 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