All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.CustomerSession Maven / Gradle / Ivy

There is a newer version: 28.1.0-beta.3
Show newest version
// File generated from our OpenAPI spec
package com.stripe.model;

import com.google.gson.annotations.SerializedName;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
import com.stripe.net.ApiResource;
import com.stripe.net.BaseAddress;
import com.stripe.net.RequestOptions;
import com.stripe.net.StripeResponseGetter;
import com.stripe.param.CustomerSessionCreateParams;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
 * 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. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public class CustomerSession extends ApiResource { /** * The client secret of this Customer Session. Used on the client to set up secure access to the * given {@code customer}. * *

The client secret can be used to provide access to {@code 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. */ @SerializedName("client_secret") String clientSecret; /** Configuration for the components supported by this Customer Session. */ @SerializedName("components") Components components; /** Time at which the object was created. Measured in seconds since the Unix epoch. */ @SerializedName("created") Long created; /** The Customer the Customer Session was created for. */ @SerializedName("customer") @Getter(lombok.AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE) ExpandableField customer; /** The timestamp at which this Customer Session will expire. */ @SerializedName("expires_at") Long expiresAt; /** * Has the value {@code true} if the object exists in live mode or the value {@code false} if the * object exists in test mode. */ @SerializedName("livemode") Boolean livemode; /** * String representing the object's type. Objects of the same type share the same value. * *

Equal to {@code customer_session}. */ @SerializedName("object") String object; /** Get ID of expandable {@code customer} object. */ public String getCustomer() { return (this.customer != null) ? this.customer.getId() : null; } public void setCustomer(String id) { this.customer = ApiResource.setExpandableFieldId(id, this.customer); } /** Get expanded {@code customer}. */ public Customer getCustomerObject() { return (this.customer != null) ? this.customer.getExpanded() : null; } public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } /** * 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. */ public static CustomerSession create(Map params) throws StripeException { return create(params, (RequestOptions) null); } /** * 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. */ public static CustomerSession create(Map params, RequestOptions options) throws StripeException { String path = "/v1/customer_sessions"; ApiRequest request = new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); return getGlobalResponseGetter().request(request, CustomerSession.class); } /** * 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. */ public static CustomerSession create(CustomerSessionCreateParams params) throws StripeException { return create(params, (RequestOptions) null); } /** * 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. */ public static CustomerSession create(CustomerSessionCreateParams params, RequestOptions options) throws StripeException { String path = "/v1/customer_sessions"; ApiResource.checkNullTypedParams(path, params); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.POST, path, ApiRequestParams.paramsToMap(params), options); return getGlobalResponseGetter().request(request, CustomerSession.class); } /** Configuration for the components supported by this Customer Session. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class Components extends StripeObject { /** This hash contains whether the buy button is enabled. */ @SerializedName("buy_button") BuyButton buyButton; /** This hash contains whether the Payment Element is enabled and the features it supports. */ @SerializedName("payment_element") PaymentElement paymentElement; /** This hash contains whether the pricing table is enabled. */ @SerializedName("pricing_table") PricingTable pricingTable; /** This hash contains whether the buy button is enabled. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class BuyButton extends StripeObject { /** Whether the buy button is enabled. */ @SerializedName("enabled") Boolean enabled; } /** This hash contains whether the Payment Element is enabled and the features it supports. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class PaymentElement extends StripeObject { /** Whether the Payment Element is enabled. */ @SerializedName("enabled") Boolean enabled; /** This hash defines whether the Payment Element supports certain features. */ @SerializedName("features") Features features; /** This hash contains the features the Payment Element supports. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class Features extends StripeObject { /** * A list of {@code * allow_redisplay} values that controls which saved payment methods the Payment Element * displays by filtering to only show payment methods with an {@code allow_redisplay} value * that is present in this list. * *

If not specified, defaults to ["always"]. In order to display all saved * payment methods, specify ["always", "limited", * "unspecified"]. */ @SerializedName("payment_method_allow_redisplay_filters") List paymentMethodAllowRedisplayFilters; /** * Controls whether or not the Payment Element shows saved payment methods. This parameter * defaults to {@code disabled}. * *

One of {@code disabled}, or {@code enabled}. */ @SerializedName("payment_method_redisplay") String paymentMethodRedisplay; /** * Determines the max number of saved payment methods for the Payment Element to display. * This parameter defaults to {@code 3}. */ @SerializedName("payment_method_redisplay_limit") Long paymentMethodRedisplayLimit; /** * Controls whether the Payment Element displays the option to remove a saved payment * method. This parameter defaults to {@code disabled}. * *

Allowing buyers to remove their saved payment methods impacts subscriptions that * depend on that payment method. Removing the payment method detaches the {@code * customer} object from that PaymentMethod. * *

One of {@code disabled}, or {@code enabled}. */ @SerializedName("payment_method_remove") String paymentMethodRemove; /** * Controls whether the Payment Element displays a checkbox offering to save a new payment * method. This parameter defaults to {@code disabled}. * *

If a customer checks the box, the {@code * allow_redisplay} value on the PaymentMethod is set to {@code 'always'} at * confirmation time. For PaymentIntents, the {@code * setup_future_usage} value is also set to the value defined in {@code * payment_method_save_usage}. * *

One of {@code disabled}, or {@code enabled}. */ @SerializedName("payment_method_save") String paymentMethodSave; /** * When using PaymentIntents and the customer checks the save checkbox, this field * determines the {@code * setup_future_usage} value used to confirm the PaymentIntent. * *

When using SetupIntents, directly configure the {@code * usage} value on SetupIntent creation. * *

One of {@code off_session}, or {@code on_session}. */ @SerializedName("payment_method_save_usage") String paymentMethodSaveUsage; } } /** This hash contains whether the pricing table is enabled. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class PricingTable extends StripeObject { /** Whether the pricing table is enabled. */ @SerializedName("enabled") Boolean enabled; } } @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); trySetResponseGetter(components, responseGetter); trySetResponseGetter(customer, responseGetter); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy