Class Session
- All Implemented Interfaces:
HasId,StripeObjectInterface
Once payment is successful, the Checkout Session will contain a reference to the Customer, and either the successful PaymentIntent or an active Subscription.
You can create a Checkout Session on your server and pass its ID to the client to begin Checkout.
Related guide: Checkout Quickstart.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classURL that creates a new Checkout Session when clicked that is a copy of this expired Checkout Session.static classstatic classstatic classText may be up to 500 characters in length.static classstatic classThe value of the tax ID.static classHow line-item prices and amounts will be displayed with respect to tax on invoice PDFs.static classFor webview integrations only.static classstatic classstatic classstatic classstatic classNested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod -
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSONFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanstatic Sessioncreate(SessionCreateParams params) Creates a Session object.static Sessioncreate(SessionCreateParams params, RequestOptions options) Creates a Session object.static SessionCreates a Session object.static Sessioncreate(Map<String, Object> params, RequestOptions options) Creates a Session object.booleanexpire()A Session can be expired when it is in one of these statuses:openexpire(RequestOptions options) A Session can be expired when it is in one of these statuses:openexpire(SessionExpireParams params) A Session can be expired when it is in one of these statuses:openexpire(SessionExpireParams params, RequestOptions options) A Session can be expired when it is in one of these statuses:openA Session can be expired when it is in one of these statuses:openexpire(Map<String, Object> params, RequestOptions options) A Session can be expired when it is in one of these statuses:openWhen set, provides configuration for actions to take if this Checkout Session expires.Enables user redeemable promotion codes.Total of all items before discounts or taxes are applied.Total of all items after discounts and taxes are applied.Describes whether Checkout should collect the customer's billing address.The URL the customer will be directed to if they decide to cancel payment and return to your website.A unique string to reference the Checkout Session.Results ofconsent_collectionfor this session.When set, provides configuration for the Checkout Session to gather active consent from customers.Time at which the object was created.Three-letter ISO currency code, in lowercase.Get ID of expandablecustomerobject.Configure whether a Checkout Session creates a Customer when the Checkout Session completes.The customer details including the customer's tax exempt status and the customer's tax IDs.If provided, this value will be used when the Customer object is created.Get expandedcustomer.The timestamp at which the Checkout Session will expire.getId()Unique identifier for the object.Get ID of expandableinvoiceobject.Details on the state of invoice creation for the Checkout Session.Get expandedinvoice.The line items purchased by the customer.Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.The IETF language tag of the locale Checkout is displayed in.Set of key-value pairs that you can attach to an object.getMode()The mode of the Checkout Session.String representing the object's type.Get ID of expandablepaymentIntentobject.Get expandedpaymentIntent.Get ID of expandablepaymentLinkobject.Get expandedpaymentLink.Configure whether a Checkout Session should collect a payment method.Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.A list of the types of payment methods (e.g.The payment status of the Checkout Session, one ofpaid,unpaid, orno_payment_required.The ID of the original expired Checkout Session that triggered the recovery flow.Get ID of expandablesetupIntentobject.Get expandedsetupIntent.When set, provides configuration for Checkout to collect a shipping address from a customer.The details of the customer cost of shipping, including the customer chosen ShippingRate.Shipping information for this Checkout Session.The shipping rate options applied to this Session.The status of the Checkout Session, one ofopen,complete, orexpired.Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button.Get ID of expandablesubscriptionobject.Get expandedsubscription.The URL the customer will be directed to after the payment or subscription creation is successful.Tax and discount details for the computed total amount.getUrl()The URL to the Checkout Session.inthashCode()static SessionCollectionlist(SessionListParams params) Returns a list of Checkout Sessions.static SessionCollectionlist(SessionListParams params, RequestOptions options) Returns a list of Checkout Sessions.static SessionCollectionReturns a list of Checkout Sessions.static SessionCollectionlist(Map<String, Object> params, RequestOptions options) Returns a list of Checkout Sessions.When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items.When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items.listLineItems(SessionListLineItemsParams params, RequestOptions options) When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items.listLineItems(Map<String, Object> params) When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items.listLineItems(Map<String, Object> params, RequestOptions options) When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items.static SessionRetrieves a Session object.static Sessionretrieve(String session, RequestOptions options) Retrieves a Session object.static Sessionretrieve(String session, SessionRetrieveParams params, RequestOptions options) Retrieves a Session object.static SessionRetrieves a Session object.voidsetAfterExpiration(Session.AfterExpiration afterExpiration) When set, provides configuration for actions to take if this Checkout Session expires.voidsetAllowPromotionCodes(Boolean allowPromotionCodes) Enables user redeemable promotion codes.voidsetAmountSubtotal(Long amountSubtotal) Total of all items before discounts or taxes are applied.voidsetAmountTotal(Long amountTotal) Total of all items after discounts and taxes are applied.voidsetAutomaticTax(Session.AutomaticTax automaticTax) voidsetBillingAddressCollection(String billingAddressCollection) Describes whether Checkout should collect the customer's billing address.voidsetCancelUrl(String cancelUrl) The URL the customer will be directed to if they decide to cancel payment and return to your website.voidsetClientReferenceId(String clientReferenceId) A unique string to reference the Checkout Session.voidsetConsent(Session.Consent consent) Results ofconsent_collectionfor this session.voidsetConsentCollection(Session.ConsentCollection consentCollection) When set, provides configuration for the Checkout Session to gather active consent from customers.voidsetCreated(Long created) Time at which the object was created.voidsetCurrency(String currency) Three-letter ISO currency code, in lowercase.voidsetCustomer(String id) voidsetCustomerCreation(String customerCreation) Configure whether a Checkout Session creates a Customer when the Checkout Session completes.voidsetCustomerDetails(Session.CustomerDetails customerDetails) The customer details including the customer's tax exempt status and the customer's tax IDs.voidsetCustomerEmail(String customerEmail) If provided, this value will be used when the Customer object is created.voidsetCustomerObject(Customer expandableObject) voidsetCustomText(Session.CustomText customText) voidsetExpiresAt(Long expiresAt) The timestamp at which the Checkout Session will expire.voidUnique identifier for the object.voidsetInvoice(String id) voidsetInvoiceCreation(Session.InvoiceCreation invoiceCreation) Details on the state of invoice creation for the Checkout Session.voidsetInvoiceObject(Invoice expandableObject) voidsetLineItems(LineItemCollection lineItems) The line items purchased by the customer.voidsetLivemode(Boolean livemode) Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidThe IETF language tag of the locale Checkout is displayed in.voidsetMetadata(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.voidThe mode of the Checkout Session.voidString representing the object's type.voidvoidsetPaymentIntentObject(PaymentIntent expandableObject) voidsetPaymentLink(String id) voidsetPaymentLinkObject(PaymentLink expandableObject) voidsetPaymentMethodCollection(String paymentMethodCollection) Configure whether a Checkout Session should collect a payment method.voidsetPaymentMethodOptions(Session.PaymentMethodOptions paymentMethodOptions) Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.voidsetPaymentMethodTypes(List<String> paymentMethodTypes) A list of the types of payment methods (e.g.voidsetPaymentStatus(String paymentStatus) The payment status of the Checkout Session, one ofpaid,unpaid, orno_payment_required.voidsetPhoneNumberCollection(Session.PhoneNumberCollection phoneNumberCollection) voidsetRecoveredFrom(String recoveredFrom) The ID of the original expired Checkout Session that triggered the recovery flow.voidsetSetupIntent(String id) voidsetSetupIntentObject(SetupIntent expandableObject) voidsetShippingAddressCollection(Session.ShippingAddressCollection shippingAddressCollection) When set, provides configuration for Checkout to collect a shipping address from a customer.voidsetShippingCost(Session.ShippingCost shippingCost) The details of the customer cost of shipping, including the customer chosen ShippingRate.voidsetShippingDetails(ShippingDetails shippingDetails) Shipping information for this Checkout Session.voidsetShippingOptions(List<Session.ShippingOption> shippingOptions) The shipping rate options applied to this Session.voidThe status of the Checkout Session, one ofopen,complete, orexpired.voidsetSubmitType(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.voidvoidsetSubscriptionObject(Subscription expandableObject) voidsetSuccessUrl(String successUrl) The URL the customer will be directed to after the payment or subscription creation is successful.voidsetTaxIdCollection(Session.TaxIdCollection taxIdCollection) voidsetTotalDetails(Session.TotalDetails totalDetails) Tax and discount details for the computed total amount.voidThe URL to the Checkout Session.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, requestSearchResult, requestSearchResult, requestStream, requestStream, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
Constructor Details
-
Session
public Session()
-
-
Method Details
-
getCustomer
Get ID of expandablecustomerobject. -
setCustomer
-
getCustomerObject
Get expandedcustomer. -
setCustomerObject
-
getInvoice
Get ID of expandableinvoiceobject. -
setInvoice
-
getInvoiceObject
Get expandedinvoice. -
setInvoiceObject
-
getPaymentIntent
Get ID of expandablepaymentIntentobject. -
setPaymentIntent
-
getPaymentIntentObject
Get expandedpaymentIntent. -
setPaymentIntentObject
-
getPaymentLink
Get ID of expandablepaymentLinkobject. -
setPaymentLink
-
getPaymentLinkObject
Get expandedpaymentLink. -
setPaymentLinkObject
-
getSetupIntent
Get ID of expandablesetupIntentobject. -
setSetupIntent
-
getSetupIntentObject
Get expandedsetupIntent. -
setSetupIntentObject
-
getSubscription
Get ID of expandablesubscriptionobject. -
setSubscription
-
getSubscriptionObject
Get expandedsubscription. -
setSubscriptionObject
-
create
Creates a Session object.- Throws:
StripeException
-
create
public static Session create(Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates a Session object.- Throws:
StripeException
-
create
Creates a Session object.- Throws:
StripeException
-
create
public static Session create(SessionCreateParams params, RequestOptions options) throws StripeException Creates a Session object.- Throws:
StripeException
-
expire
A Session can be expired when it is in one of these statuses:openAfter 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
A Session can be expired when it is in one of these statuses:openAfter 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
A Session can be expired when it is in one of these statuses:openAfter 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
A Session can be expired when it is in one of these statuses:openAfter 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
A Session can be expired when it is in one of these statuses:openAfter 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
A Session can be expired when it is in one of these statuses:openAfter it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.
- Throws:
StripeException
-
list
Returns a list of Checkout Sessions.- Throws:
StripeException
-
list
public static SessionCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of Checkout Sessions.- Throws:
StripeException
-
list
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
-
listLineItems
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
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 StripeExceptionWhen 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
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
-
retrieve
Retrieves a Session object.- Throws:
StripeException
-
retrieve
Retrieves a Session object.- Throws:
StripeException
-
retrieve
public static Session retrieve(String session, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves a Session object.- Throws:
StripeException
-
retrieve
public static Session retrieve(String session, SessionRetrieveParams params, RequestOptions options) throws StripeException Retrieves a Session object.- Throws:
StripeException
-
getAfterExpiration
When set, provides configuration for actions to take if this Checkout Session expires. -
getAllowPromotionCodes
Enables user redeemable promotion codes. -
getAmountSubtotal
Total of all items before discounts or taxes are applied. -
getAmountTotal
Total of all items after discounts and taxes are applied. -
getAutomaticTax
-
getBillingAddressCollection
Describes whether Checkout should collect the customer's billing address.One of
auto, orrequired. -
getCancelUrl
The URL the customer will be directed to if they decide to cancel payment and return to your website. -
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
Results ofconsent_collectionfor this session. -
getConsentCollection
When set, provides configuration for the Checkout Session to gather active consent from customers. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
getCustomText
-
getCustomerCreation
Configure whether a Checkout Session creates a Customer when the Checkout Session completes.One of
always, orif_required. -
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 insetupmode. -
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 thecustomerattribute. -
getExpiresAt
The timestamp at which the Checkout Session will expire. -
getInvoiceCreation
Details on the state of invoice creation for the Checkout Session. -
getLineItems
The line items purchased by the customer. -
getLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
getLocale
The IETF language tag of the locale Checkout is displayed in. If blank orauto, 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, orzh-TW. -
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
The mode of the Checkout Session.One of
payment,setup, orsubscription. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
checkout.session. -
getPaymentMethodCollection
Configure whether a Checkout Session should collect a payment method.One of
always, orif_required. -
getPaymentMethodOptions
Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession. -
getPaymentMethodTypes
A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept. -
getPaymentStatus
The payment status of the Checkout Session, one ofpaid,unpaid, orno_payment_required. You can use this value to decide when to fulfill your customer's order. -
getPhoneNumberCollection
-
getRecoveredFrom
The ID of the original expired Checkout Session that triggered the recovery flow. -
getShippingAddressCollection
When set, provides configuration for Checkout to collect a shipping address from a customer. -
getShippingCost
The details of the customer cost of shipping, including the customer chosen ShippingRate. -
getShippingDetails
Shipping information for this Checkout Session. -
getShippingOptions
The shipping rate options applied to this Session. -
getStatus
The status of the Checkout Session, one ofopen,complete, orexpired. -
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_typecan only be specified on Checkout Sessions inpaymentmode, but not Checkout Sessions insubscriptionorsetupmode.One of
auto,book,donate, orpay. -
getSuccessUrl
The URL the customer will be directed to after the payment or subscription creation is successful. -
getTaxIdCollection
-
getTotalDetails
Tax and discount details for the computed total amount. -
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 usecheckout.stripe.com.This value is only present when the session is active. -
setAfterExpiration
When set, provides configuration for actions to take if this Checkout Session expires. -
setAllowPromotionCodes
Enables user redeemable promotion codes. -
setAmountSubtotal
Total of all items before discounts or taxes are applied. -
setAmountTotal
Total of all items after discounts and taxes are applied. -
setAutomaticTax
-
setBillingAddressCollection
Describes whether Checkout should collect the customer's billing address.One of
auto, orrequired. -
setCancelUrl
The URL the customer will be directed to if they decide to cancel payment and return to your website. -
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. -
setConsent
Results ofconsent_collectionfor this session. -
setConsentCollection
When set, provides configuration for the Checkout Session to gather active consent from customers. -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
setCustomText
-
setCustomerCreation
Configure whether a Checkout Session creates a Customer when the Checkout Session completes.One of
always, orif_required. -
setCustomerDetails
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 insetupmode. -
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 the payment flow is complete, use thecustomerattribute. -
setExpiresAt
The timestamp at which the Checkout Session will expire. -
setId
Unique identifier for the object. Used to pass toredirectToCheckoutin Stripe.js. -
setInvoiceCreation
Details on the state of invoice creation for the Checkout Session. -
setLineItems
The line items purchased by the customer. -
setLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
setLocale
The IETF language tag of the locale Checkout is displayed in. If blank orauto, 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, orzh-TW. -
setMetadata
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
The mode of the Checkout Session.One of
payment,setup, orsubscription. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
checkout.session. -
setPaymentMethodCollection
Configure whether a Checkout Session should collect a payment method.One of
always, orif_required. -
setPaymentMethodOptions
Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession. -
setPaymentMethodTypes
A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept. -
setPaymentStatus
The payment status of the Checkout Session, one ofpaid,unpaid, orno_payment_required. You can use this value to decide when to fulfill your customer's order. -
setPhoneNumberCollection
-
setRecoveredFrom
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
The details of the customer cost of shipping, including the customer chosen ShippingRate. -
setShippingDetails
Shipping information for this Checkout Session. -
setShippingOptions
The shipping rate options applied to this Session. -
setStatus
The status of the Checkout Session, one ofopen,complete, orexpired. -
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 inpaymentmode, but not Checkout Sessions insubscriptionorsetupmode.One of
auto,book,donate, orpay. -
setSuccessUrl
The URL the customer will be directed to after the payment or subscription creation is successful. -
setTaxIdCollection
-
setTotalDetails
Tax and discount details for the computed total amount. -
setUrl
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 usecheckout.stripe.com.This value is only present when the session is active. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object. Used to pass toredirectToCheckoutin Stripe.js.
-