com.stripe.param.checkout.SessionCreateParams Maven / Gradle / Ivy
// File generated from our OpenAPI spec
package com.stripe.param.checkout;
import com.google.gson.annotations.SerializedName;
import com.stripe.net.ApiRequestParams;
import com.stripe.param.common.EmptyParam;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
@Getter
public class SessionCreateParams extends ApiRequestParams {
/** Configure actions after a Checkout Session has expired. */
@SerializedName("after_expiration")
AfterExpiration afterExpiration;
/** Enables user redeemable promotion codes. */
@SerializedName("allow_promotion_codes")
Boolean allowPromotionCodes;
/**
* Settings for automatic tax lookup for this session and resulting payments, invoices, and
* subscriptions.
*/
@SerializedName("automatic_tax")
AutomaticTax automaticTax;
/**
* Specify whether Checkout should collect the customer's billing address. Defaults to {@code
* auto}.
*/
@SerializedName("billing_address_collection")
BillingAddressCollection billingAddressCollection;
/**
* If set, Checkout displays a back button and customers will be directed to this URL if they
* decide to cancel payment and return to your website. This parameter is not allowed if ui_mode
* is {@code embedded}.
*/
@SerializedName("cancel_url")
String cancelUrl;
/**
* 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.
*/
@SerializedName("client_reference_id")
String clientReferenceId;
/** Configure fields for the Checkout Session to gather active consent from customers. */
@SerializedName("consent_collection")
ConsentCollection consentCollection;
/**
* Three-letter ISO currency code,
* in lowercase. Must be a supported currency.
* Required in {@code setup} mode when {@code payment_method_types} is not set.
*/
@SerializedName("currency")
String currency;
/**
* Collect additional information from your customer using custom fields. Up to 3 fields are
* supported.
*/
@SerializedName("custom_fields")
List customFields;
/** Display additional text for your customers using custom text. */
@SerializedName("custom_text")
CustomText customText;
/**
* ID of an existing Customer, if one exists. In {@code payment} mode, the customer’s most
* recently saved card payment method will be used to prefill the email, name, card details, and
* billing address on the Checkout page. In {@code subscription} mode, the customer’s default
* payment method will be used if it’s a card, otherwise the most recently saved card will be
* used. A valid billing address, billing name and billing email are required on the payment
* method for Checkout to prefill the customer's card details.
*
* If the Customer already has a valid email set, the
* email will be prefilled and not editable in Checkout. If the Customer does not have a valid
* {@code email}, Checkout will set the email entered during the session on the Customer.
*
*
If blank for Checkout Sessions in {@code subscription} mode or with {@code
* customer_creation} set as {@code always} in {@code payment} mode, Checkout will create a new
* Customer object based on information provided during the payment flow.
*
*
You can set {@code
* payment_intent_data.setup_future_usage} to have Checkout automatically attach the payment
* method to the Customer you pass in for future reuse.
*/
@SerializedName("customer")
String customer;
/**
* Configure whether a Checkout Session creates a Customer during Session confirmation.
*
*
When a Customer is not created, you can still retrieve email, address, and other customer
* data entered in Checkout with customer_details.
*
*
Sessions that don't create Customers instead are grouped by guest customers in the
* Dashboard. Promotion codes limited to first time customers will return invalid for these
* Sessions.
*
*
Can only be set in {@code payment} and {@code setup} mode.
*/
@SerializedName("customer_creation")
CustomerCreation customerCreation;
/**
* 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 {@code customer} field.
*/
@SerializedName("customer_email")
String customerEmail;
/**
* Controls what fields on Customer can be updated by the Checkout Session. Can only be provided
* when {@code customer} is provided.
*/
@SerializedName("customer_update")
CustomerUpdate customerUpdate;
/**
* The coupon or promotion code to apply to this Session. Currently, only up to one may be
* specified.
*/
@SerializedName("discounts")
List discounts;
/** Specifies which fields in the response should be expanded. */
@SerializedName("expand")
List expand;
/**
* The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 30
* minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours from
* creation.
*/
@SerializedName("expires_at")
Long expiresAt;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Generate a post-purchase Invoice for one-time payments. */
@SerializedName("invoice_creation")
InvoiceCreation invoiceCreation;
/**
* A list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices.
*
* For {@code payment} mode, there is a maximum of 100 line items, however it is recommended to
* consolidate line items if there are more than a few dozen.
*
*
For {@code subscription} mode, there is a maximum of 20 line items with recurring Prices and
* 20 line items with one-time Prices. Line items with one-time Prices will be on the initial
* invoice only.
*/
@SerializedName("line_items")
List lineItems;
/**
* The IETF language tag of the locale Checkout is displayed in. If blank or {@code auto}, the
* browser's locale is used.
*/
@SerializedName("locale")
Locale locale;
/**
* 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. Individual keys can be unset by posting an empty value to them. All keys can
* be unset by posting an empty value to {@code metadata}.
*/
@SerializedName("metadata")
Map metadata;
/**
* The mode of the Checkout Session. Pass {@code subscription} if the Checkout Session includes at
* least one recurring item.
*/
@SerializedName("mode")
Mode mode;
/**
* A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in {@code
* payment} mode.
*/
@SerializedName("payment_intent_data")
PaymentIntentData paymentIntentData;
/**
* Specify whether Checkout should collect a payment method. When set to {@code if_required},
* Checkout will not collect a payment method when the total due for the session is 0. This may
* occur if the Checkout Session includes a free trial or a discount.
*
* Can only be set in {@code subscription} mode. Defaults to {@code always}.
*
*
If you'd like information on how to collect a payment method outside of Checkout, read the
* guide on configuring subscriptions with a free
* trial.
*/
@SerializedName("payment_method_collection")
PaymentMethodCollection paymentMethodCollection;
/** The ID of the payment method configuration to use with this Checkout session. */
@SerializedName("payment_method_configuration")
String paymentMethodConfiguration;
/**
* This parameter allows you to set some attributes on the payment method created during a
* Checkout session.
*/
@SerializedName("payment_method_data")
PaymentMethodData paymentMethodData;
/** Payment-method-specific configuration. */
@SerializedName("payment_method_options")
PaymentMethodOptions paymentMethodOptions;
/**
* A list of the types of payment methods (e.g., {@code card}) this Checkout Session can accept.
*
*
You can omit this attribute to manage your payment methods from the Stripe Dashboard. See Dynamic
* Payment Methods for more details.
*
*
Read more about the supported payment methods and their requirements in our payment method details
* guide.
*
*
If multiple payment methods are passed, Checkout will dynamically reorder them to prioritize
* the most relevant payment methods based on the customer's location and other characteristics.
*/
@SerializedName("payment_method_types")
List paymentMethodTypes;
/**
* Controls phone number collection settings for the session.
*
* We recommend that you review your privacy policy and check with your legal contacts before
* using this feature. Learn more about collecting phone numbers with
* Checkout.
*/
@SerializedName("phone_number_collection")
PhoneNumberCollection phoneNumberCollection;
/**
* This parameter applies to {@code ui_mode: embedded}. Learn more about the redirect
* behavior of embedded sessions. Defaults to {@code always}.
*/
@SerializedName("redirect_on_completion")
RedirectOnCompletion redirectOnCompletion;
/**
* The URL to redirect your customer back to after they authenticate or cancel their payment on
* the payment method's app or site. This parameter is required if ui_mode is {@code embedded} and
* redirect-based payment methods are enabled on the session.
*/
@SerializedName("return_url")
String returnUrl;
/**
* Controls saved payment method settings for the session. Only available in {@code payment} and
* {@code subscription} mode.
*/
@SerializedName("saved_payment_method_options")
SavedPaymentMethodOptions savedPaymentMethodOptions;
/**
* A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in {@code
* setup} mode.
*/
@SerializedName("setup_intent_data")
SetupIntentData setupIntentData;
/**
* When set, provides configuration for Checkout to collect a shipping address from a customer.
*/
@SerializedName("shipping_address_collection")
ShippingAddressCollection shippingAddressCollection;
/** The shipping rate options to apply to this Session. Up to a maximum of 5. */
@SerializedName("shipping_options")
List shippingOptions;
/**
* Describes the type of transaction being performed by Checkout in order to customize relevant
* text on the page, such as the submit button. {@code submit_type} can only be specified on
* Checkout Sessions in {@code payment} mode. If blank or {@code auto}, {@code pay} is used.
*/
@SerializedName("submit_type")
SubmitType submitType;
/**
* A subset of parameters to be passed to subscription creation for Checkout Sessions in {@code
* subscription} mode.
*/
@SerializedName("subscription_data")
SubscriptionData subscriptionData;
/**
* The URL to which Stripe should send customers when payment or setup is complete. This parameter
* is not allowed if ui_mode is {@code embedded}. If you’d like to use information from the
* successful Checkout Session on your page, read the guide on customizing your success
* page.
*/
@SerializedName("success_url")
String successUrl;
/** Controls tax ID collection during checkout. */
@SerializedName("tax_id_collection")
TaxIdCollection taxIdCollection;
/** The UI mode of the Session. Defaults to {@code hosted}. */
@SerializedName("ui_mode")
UiMode uiMode;
private SessionCreateParams(
AfterExpiration afterExpiration,
Boolean allowPromotionCodes,
AutomaticTax automaticTax,
BillingAddressCollection billingAddressCollection,
String cancelUrl,
String clientReferenceId,
ConsentCollection consentCollection,
String currency,
List customFields,
CustomText customText,
String customer,
CustomerCreation customerCreation,
String customerEmail,
CustomerUpdate customerUpdate,
List discounts,
List expand,
Long expiresAt,
Map extraParams,
InvoiceCreation invoiceCreation,
List lineItems,
Locale locale,
Map metadata,
Mode mode,
PaymentIntentData paymentIntentData,
PaymentMethodCollection paymentMethodCollection,
String paymentMethodConfiguration,
PaymentMethodData paymentMethodData,
PaymentMethodOptions paymentMethodOptions,
List paymentMethodTypes,
PhoneNumberCollection phoneNumberCollection,
RedirectOnCompletion redirectOnCompletion,
String returnUrl,
SavedPaymentMethodOptions savedPaymentMethodOptions,
SetupIntentData setupIntentData,
ShippingAddressCollection shippingAddressCollection,
List shippingOptions,
SubmitType submitType,
SubscriptionData subscriptionData,
String successUrl,
TaxIdCollection taxIdCollection,
UiMode uiMode) {
this.afterExpiration = afterExpiration;
this.allowPromotionCodes = allowPromotionCodes;
this.automaticTax = automaticTax;
this.billingAddressCollection = billingAddressCollection;
this.cancelUrl = cancelUrl;
this.clientReferenceId = clientReferenceId;
this.consentCollection = consentCollection;
this.currency = currency;
this.customFields = customFields;
this.customText = customText;
this.customer = customer;
this.customerCreation = customerCreation;
this.customerEmail = customerEmail;
this.customerUpdate = customerUpdate;
this.discounts = discounts;
this.expand = expand;
this.expiresAt = expiresAt;
this.extraParams = extraParams;
this.invoiceCreation = invoiceCreation;
this.lineItems = lineItems;
this.locale = locale;
this.metadata = metadata;
this.mode = mode;
this.paymentIntentData = paymentIntentData;
this.paymentMethodCollection = paymentMethodCollection;
this.paymentMethodConfiguration = paymentMethodConfiguration;
this.paymentMethodData = paymentMethodData;
this.paymentMethodOptions = paymentMethodOptions;
this.paymentMethodTypes = paymentMethodTypes;
this.phoneNumberCollection = phoneNumberCollection;
this.redirectOnCompletion = redirectOnCompletion;
this.returnUrl = returnUrl;
this.savedPaymentMethodOptions = savedPaymentMethodOptions;
this.setupIntentData = setupIntentData;
this.shippingAddressCollection = shippingAddressCollection;
this.shippingOptions = shippingOptions;
this.submitType = submitType;
this.subscriptionData = subscriptionData;
this.successUrl = successUrl;
this.taxIdCollection = taxIdCollection;
this.uiMode = uiMode;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private AfterExpiration afterExpiration;
private Boolean allowPromotionCodes;
private AutomaticTax automaticTax;
private BillingAddressCollection billingAddressCollection;
private String cancelUrl;
private String clientReferenceId;
private ConsentCollection consentCollection;
private String currency;
private List customFields;
private CustomText customText;
private String customer;
private CustomerCreation customerCreation;
private String customerEmail;
private CustomerUpdate customerUpdate;
private List discounts;
private List expand;
private Long expiresAt;
private Map extraParams;
private InvoiceCreation invoiceCreation;
private List lineItems;
private Locale locale;
private Map metadata;
private Mode mode;
private PaymentIntentData paymentIntentData;
private PaymentMethodCollection paymentMethodCollection;
private String paymentMethodConfiguration;
private PaymentMethodData paymentMethodData;
private PaymentMethodOptions paymentMethodOptions;
private List paymentMethodTypes;
private PhoneNumberCollection phoneNumberCollection;
private RedirectOnCompletion redirectOnCompletion;
private String returnUrl;
private SavedPaymentMethodOptions savedPaymentMethodOptions;
private SetupIntentData setupIntentData;
private ShippingAddressCollection shippingAddressCollection;
private List shippingOptions;
private SubmitType submitType;
private SubscriptionData subscriptionData;
private String successUrl;
private TaxIdCollection taxIdCollection;
private UiMode uiMode;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams build() {
return new SessionCreateParams(
this.afterExpiration,
this.allowPromotionCodes,
this.automaticTax,
this.billingAddressCollection,
this.cancelUrl,
this.clientReferenceId,
this.consentCollection,
this.currency,
this.customFields,
this.customText,
this.customer,
this.customerCreation,
this.customerEmail,
this.customerUpdate,
this.discounts,
this.expand,
this.expiresAt,
this.extraParams,
this.invoiceCreation,
this.lineItems,
this.locale,
this.metadata,
this.mode,
this.paymentIntentData,
this.paymentMethodCollection,
this.paymentMethodConfiguration,
this.paymentMethodData,
this.paymentMethodOptions,
this.paymentMethodTypes,
this.phoneNumberCollection,
this.redirectOnCompletion,
this.returnUrl,
this.savedPaymentMethodOptions,
this.setupIntentData,
this.shippingAddressCollection,
this.shippingOptions,
this.submitType,
this.subscriptionData,
this.successUrl,
this.taxIdCollection,
this.uiMode);
}
/** Configure actions after a Checkout Session has expired. */
public Builder setAfterExpiration(SessionCreateParams.AfterExpiration afterExpiration) {
this.afterExpiration = afterExpiration;
return this;
}
/** Enables user redeemable promotion codes. */
public Builder setAllowPromotionCodes(Boolean allowPromotionCodes) {
this.allowPromotionCodes = allowPromotionCodes;
return this;
}
/**
* Settings for automatic tax lookup for this session and resulting payments, invoices, and
* subscriptions.
*/
public Builder setAutomaticTax(SessionCreateParams.AutomaticTax automaticTax) {
this.automaticTax = automaticTax;
return this;
}
/**
* Specify whether Checkout should collect the customer's billing address. Defaults to {@code
* auto}.
*/
public Builder setBillingAddressCollection(
SessionCreateParams.BillingAddressCollection billingAddressCollection) {
this.billingAddressCollection = billingAddressCollection;
return this;
}
/**
* If set, Checkout displays a back button and customers will be directed to this URL if they
* decide to cancel payment and return to your website. This parameter is not allowed if ui_mode
* is {@code embedded}.
*/
public Builder setCancelUrl(String cancelUrl) {
this.cancelUrl = cancelUrl;
return this;
}
/**
* 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.
*/
public Builder setClientReferenceId(String clientReferenceId) {
this.clientReferenceId = clientReferenceId;
return this;
}
/** Configure fields for the Checkout Session to gather active consent from customers. */
public Builder setConsentCollection(SessionCreateParams.ConsentCollection consentCollection) {
this.consentCollection = consentCollection;
return this;
}
/**
* Three-letter ISO currency
* code, in lowercase. Must be a supported
* currency. Required in {@code setup} mode when {@code payment_method_types} is not set.
*/
public Builder setCurrency(String currency) {
this.currency = currency;
return this;
}
/**
* Add an element to `customFields` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#customFields} for the field documentation.
*/
public Builder addCustomField(SessionCreateParams.CustomField element) {
if (this.customFields == null) {
this.customFields = new ArrayList<>();
}
this.customFields.add(element);
return this;
}
/**
* Add all elements to `customFields` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#customFields} for the field documentation.
*/
public Builder addAllCustomField(List elements) {
if (this.customFields == null) {
this.customFields = new ArrayList<>();
}
this.customFields.addAll(elements);
return this;
}
/** Display additional text for your customers using custom text. */
public Builder setCustomText(SessionCreateParams.CustomText customText) {
this.customText = customText;
return this;
}
/**
* ID of an existing Customer, if one exists. In {@code payment} mode, the customer’s most
* recently saved card payment method will be used to prefill the email, name, card details, and
* billing address on the Checkout page. In {@code subscription} mode, the customer’s default
* payment method will be used if it’s a card, otherwise the most recently saved card will
* be used. A valid billing address, billing name and billing email are required on the payment
* method for Checkout to prefill the customer's card details.
*
* If the Customer already has a valid email set, the
* email will be prefilled and not editable in Checkout. If the Customer does not have a valid
* {@code email}, Checkout will set the email entered during the session on the Customer.
*
*
If blank for Checkout Sessions in {@code subscription} mode or with {@code
* customer_creation} set as {@code always} in {@code payment} mode, Checkout will create a new
* Customer object based on information provided during the payment flow.
*
*
You can set {@code
* payment_intent_data.setup_future_usage} to have Checkout automatically attach the payment
* method to the Customer you pass in for future reuse.
*/
public Builder setCustomer(String customer) {
this.customer = customer;
return this;
}
/**
* Configure whether a Checkout Session creates a Customer during Session confirmation.
*
*
When a Customer is not created, you can still retrieve email, address, and other customer
* data entered in Checkout with customer_details.
*
*
Sessions that don't create Customers instead are grouped by guest customers in the
* Dashboard. Promotion codes limited to first time customers will return invalid for these
* Sessions.
*
*
Can only be set in {@code payment} and {@code setup} mode.
*/
public Builder setCustomerCreation(SessionCreateParams.CustomerCreation customerCreation) {
this.customerCreation = customerCreation;
return this;
}
/**
* 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 {@code customer} field.
*/
public Builder setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
return this;
}
/**
* Controls what fields on Customer can be updated by the Checkout Session. Can only be provided
* when {@code customer} is provided.
*/
public Builder setCustomerUpdate(SessionCreateParams.CustomerUpdate customerUpdate) {
this.customerUpdate = customerUpdate;
return this;
}
/**
* Add an element to `discounts` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#discounts} for the field documentation.
*/
public Builder addDiscount(SessionCreateParams.Discount element) {
if (this.discounts == null) {
this.discounts = new ArrayList<>();
}
this.discounts.add(element);
return this;
}
/**
* Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#discounts} for the field documentation.
*/
public Builder addAllDiscount(List elements) {
if (this.discounts == null) {
this.discounts = new ArrayList<>();
}
this.discounts.addAll(elements);
return this;
}
/**
* 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 {@link
* SessionCreateParams#expand} for the field documentation.
*/
public Builder addExpand(String element) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.add(element);
return this;
}
/**
* 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 {@link
* SessionCreateParams#expand} for the field documentation.
*/
public Builder addAllExpand(List elements) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.addAll(elements);
return this;
}
/**
* The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from
* 30 minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours
* from creation.
*/
public Builder setExpiresAt(Long expiresAt) {
this.expiresAt = expiresAt;
return this;
}
/**
* 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 {@link
* SessionCreateParams#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Generate a post-purchase Invoice for one-time payments. */
public Builder setInvoiceCreation(SessionCreateParams.InvoiceCreation invoiceCreation) {
this.invoiceCreation = invoiceCreation;
return this;
}
/**
* Add an element to `lineItems` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#lineItems} for the field documentation.
*/
public Builder addLineItem(SessionCreateParams.LineItem element) {
if (this.lineItems == null) {
this.lineItems = new ArrayList<>();
}
this.lineItems.add(element);
return this;
}
/**
* Add all elements to `lineItems` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#lineItems} for the field documentation.
*/
public Builder addAllLineItem(List elements) {
if (this.lineItems == null) {
this.lineItems = new ArrayList<>();
}
this.lineItems.addAll(elements);
return this;
}
/**
* The IETF language tag of the locale Checkout is displayed in. If blank or {@code auto}, the
* browser's locale is used.
*/
public Builder setLocale(SessionCreateParams.Locale locale) {
this.locale = locale;
return this;
}
/**
* 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 {@link
* SessionCreateParams#metadata} for the field documentation.
*/
public Builder putMetadata(String key, String value) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams#metadata} for the field documentation.
*/
public Builder putAllMetadata(Map map) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.putAll(map);
return this;
}
/**
* The mode of the Checkout Session. Pass {@code subscription} if the Checkout Session includes
* at least one recurring item.
*/
public Builder setMode(SessionCreateParams.Mode mode) {
this.mode = mode;
return this;
}
/**
* A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in {@code
* payment} mode.
*/
public Builder setPaymentIntentData(SessionCreateParams.PaymentIntentData paymentIntentData) {
this.paymentIntentData = paymentIntentData;
return this;
}
/**
* Specify whether Checkout should collect a payment method. When set to {@code if_required},
* Checkout will not collect a payment method when the total due for the session is 0. This may
* occur if the Checkout Session includes a free trial or a discount.
*
* Can only be set in {@code subscription} mode. Defaults to {@code always}.
*
*
If you'd like information on how to collect a payment method outside of Checkout, read the
* guide on configuring subscriptions with a free
* trial.
*/
public Builder setPaymentMethodCollection(
SessionCreateParams.PaymentMethodCollection paymentMethodCollection) {
this.paymentMethodCollection = paymentMethodCollection;
return this;
}
/** The ID of the payment method configuration to use with this Checkout session. */
public Builder setPaymentMethodConfiguration(String paymentMethodConfiguration) {
this.paymentMethodConfiguration = paymentMethodConfiguration;
return this;
}
/**
* This parameter allows you to set some attributes on the payment method created during a
* Checkout session.
*/
public Builder setPaymentMethodData(SessionCreateParams.PaymentMethodData paymentMethodData) {
this.paymentMethodData = paymentMethodData;
return this;
}
/** Payment-method-specific configuration. */
public Builder setPaymentMethodOptions(
SessionCreateParams.PaymentMethodOptions paymentMethodOptions) {
this.paymentMethodOptions = paymentMethodOptions;
return this;
}
/**
* Add an element to `paymentMethodTypes` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#paymentMethodTypes} for the field documentation.
*/
public Builder addPaymentMethodType(SessionCreateParams.PaymentMethodType element) {
if (this.paymentMethodTypes == null) {
this.paymentMethodTypes = new ArrayList<>();
}
this.paymentMethodTypes.add(element);
return this;
}
/**
* Add all elements to `paymentMethodTypes` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original list. See
* {@link SessionCreateParams#paymentMethodTypes} for the field documentation.
*/
public Builder addAllPaymentMethodType(List elements) {
if (this.paymentMethodTypes == null) {
this.paymentMethodTypes = new ArrayList<>();
}
this.paymentMethodTypes.addAll(elements);
return this;
}
/**
* Controls phone number collection settings for the session.
*
* We recommend that you review your privacy policy and check with your legal contacts before
* using this feature. Learn more about collecting phone numbers with
* Checkout.
*/
public Builder setPhoneNumberCollection(
SessionCreateParams.PhoneNumberCollection phoneNumberCollection) {
this.phoneNumberCollection = phoneNumberCollection;
return this;
}
/**
* This parameter applies to {@code ui_mode: embedded}. Learn more about the redirect
* behavior of embedded sessions. Defaults to {@code always}.
*/
public Builder setRedirectOnCompletion(
SessionCreateParams.RedirectOnCompletion redirectOnCompletion) {
this.redirectOnCompletion = redirectOnCompletion;
return this;
}
/**
* The URL to redirect your customer back to after they authenticate or cancel their payment on
* the payment method's app or site. This parameter is required if ui_mode is {@code embedded}
* and redirect-based payment methods are enabled on the session.
*/
public Builder setReturnUrl(String returnUrl) {
this.returnUrl = returnUrl;
return this;
}
/**
* Controls saved payment method settings for the session. Only available in {@code payment} and
* {@code subscription} mode.
*/
public Builder setSavedPaymentMethodOptions(
SessionCreateParams.SavedPaymentMethodOptions savedPaymentMethodOptions) {
this.savedPaymentMethodOptions = savedPaymentMethodOptions;
return this;
}
/**
* A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in {@code
* setup} mode.
*/
public Builder setSetupIntentData(SessionCreateParams.SetupIntentData setupIntentData) {
this.setupIntentData = setupIntentData;
return this;
}
/**
* When set, provides configuration for Checkout to collect a shipping address from a customer.
*/
public Builder setShippingAddressCollection(
SessionCreateParams.ShippingAddressCollection shippingAddressCollection) {
this.shippingAddressCollection = shippingAddressCollection;
return this;
}
/**
* Add an element to `shippingOptions` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#shippingOptions} for the field documentation.
*/
public Builder addShippingOption(SessionCreateParams.ShippingOption element) {
if (this.shippingOptions == null) {
this.shippingOptions = new ArrayList<>();
}
this.shippingOptions.add(element);
return this;
}
/**
* Add all elements to `shippingOptions` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams#shippingOptions} for the field documentation.
*/
public Builder addAllShippingOption(List elements) {
if (this.shippingOptions == null) {
this.shippingOptions = new ArrayList<>();
}
this.shippingOptions.addAll(elements);
return this;
}
/**
* Describes the type of transaction being performed by Checkout in order to customize relevant
* text on the page, such as the submit button. {@code submit_type} can only be specified on
* Checkout Sessions in {@code payment} mode. If blank or {@code auto}, {@code pay} is used.
*/
public Builder setSubmitType(SessionCreateParams.SubmitType submitType) {
this.submitType = submitType;
return this;
}
/**
* A subset of parameters to be passed to subscription creation for Checkout Sessions in {@code
* subscription} mode.
*/
public Builder setSubscriptionData(SessionCreateParams.SubscriptionData subscriptionData) {
this.subscriptionData = subscriptionData;
return this;
}
/**
* The URL to which Stripe should send customers when payment or setup is complete. This
* parameter is not allowed if ui_mode is {@code embedded}. If you’d like to use information
* from the successful Checkout Session on your page, read the guide on customizing your success
* page.
*/
public Builder setSuccessUrl(String successUrl) {
this.successUrl = successUrl;
return this;
}
/** Controls tax ID collection during checkout. */
public Builder setTaxIdCollection(SessionCreateParams.TaxIdCollection taxIdCollection) {
this.taxIdCollection = taxIdCollection;
return this;
}
/** The UI mode of the Session. Defaults to {@code hosted}. */
public Builder setUiMode(SessionCreateParams.UiMode uiMode) {
this.uiMode = uiMode;
return this;
}
}
@Getter
public static class AfterExpiration {
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Configure a Checkout Session that can be used to recover an expired session. */
@SerializedName("recovery")
Recovery recovery;
private AfterExpiration(Map extraParams, Recovery recovery) {
this.extraParams = extraParams;
this.recovery = recovery;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private Recovery recovery;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.AfterExpiration build() {
return new SessionCreateParams.AfterExpiration(this.extraParams, this.recovery);
}
/**
* 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 {@link
* SessionCreateParams.AfterExpiration#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.AfterExpiration#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Configure a Checkout Session that can be used to recover an expired session. */
public Builder setRecovery(SessionCreateParams.AfterExpiration.Recovery recovery) {
this.recovery = recovery;
return this;
}
}
@Getter
public static class Recovery {
/**
* Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to
* {@code false}
*/
@SerializedName("allow_promotion_codes")
Boolean allowPromotionCodes;
/**
* Required. If {@code true}, a recovery URL will be generated to recover
* this Checkout Session if it expires before a successful transaction is completed. It will
* be attached to the Checkout Session object upon expiration.
*/
@SerializedName("enabled")
Boolean enabled;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
private Recovery(
Boolean allowPromotionCodes, Boolean enabled, Map extraParams) {
this.allowPromotionCodes = allowPromotionCodes;
this.enabled = enabled;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Boolean allowPromotionCodes;
private Boolean enabled;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.AfterExpiration.Recovery build() {
return new SessionCreateParams.AfterExpiration.Recovery(
this.allowPromotionCodes, this.enabled, this.extraParams);
}
/**
* Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to
* {@code false}
*/
public Builder setAllowPromotionCodes(Boolean allowPromotionCodes) {
this.allowPromotionCodes = allowPromotionCodes;
return this;
}
/**
* Required. If {@code true}, a recovery URL will be generated to recover
* this Checkout Session if it expires before a successful transaction is completed. It will
* be attached to the Checkout Session object upon expiration.
*/
public Builder setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* 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 {@link SessionCreateParams.AfterExpiration.Recovery#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.AfterExpiration.Recovery#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
}
}
@Getter
public static class AutomaticTax {
/** Required. Set to true to enable automatic taxes. */
@SerializedName("enabled")
Boolean enabled;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* The account that's liable for tax. If set, the business address and tax registrations
* required to perform the tax calculation are loaded from this account. The tax transaction is
* returned in the report of the connected account.
*/
@SerializedName("liability")
Liability liability;
private AutomaticTax(Boolean enabled, Map extraParams, Liability liability) {
this.enabled = enabled;
this.extraParams = extraParams;
this.liability = liability;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Boolean enabled;
private Map extraParams;
private Liability liability;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.AutomaticTax build() {
return new SessionCreateParams.AutomaticTax(this.enabled, this.extraParams, this.liability);
}
/** Required. Set to true to enable automatic taxes. */
public Builder setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* 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 {@link
* SessionCreateParams.AutomaticTax#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.AutomaticTax#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* The account that's liable for tax. If set, the business address and tax registrations
* required to perform the tax calculation are loaded from this account. The tax transaction
* is returned in the report of the connected account.
*/
public Builder setLiability(SessionCreateParams.AutomaticTax.Liability liability) {
this.liability = liability;
return this;
}
}
@Getter
public static class Liability {
/** The connected account being referenced when {@code type} is {@code account}. */
@SerializedName("account")
String account;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Type of the account referenced in the request. */
@SerializedName("type")
Type type;
private Liability(String account, Map extraParams, Type type) {
this.account = account;
this.extraParams = extraParams;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String account;
private Map extraParams;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.AutomaticTax.Liability build() {
return new SessionCreateParams.AutomaticTax.Liability(
this.account, this.extraParams, this.type);
}
/** The connected account being referenced when {@code type} is {@code account}. */
public Builder setAccount(String account) {
this.account = account;
return this;
}
/**
* 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 {@link SessionCreateParams.AutomaticTax.Liability#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.AutomaticTax.Liability#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Type of the account referenced in the request. */
public Builder setType(SessionCreateParams.AutomaticTax.Liability.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("account")
ACCOUNT("account"),
@SerializedName("self")
SELF("self");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
}
@Getter
public static class ConsentCollection {
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Determines the display of payment method reuse agreement text in the UI. If set to {@code
* hidden}, it will hide legal text related to the reuse of a payment method.
*/
@SerializedName("payment_method_reuse_agreement")
PaymentMethodReuseAgreement paymentMethodReuseAgreement;
/**
* If set to {@code auto}, enables the collection of customer consent for promotional
* communications. The Checkout Session will determine whether to display an option to opt into
* promotional communication from the merchant depending on the customer's locale. Only
* available to US merchants.
*/
@SerializedName("promotions")
Promotions promotions;
/**
* If set to {@code required}, it requires customers to check a terms of service checkbox before
* being able to pay. There must be a valid terms of service URL set in your Dashboard settings.
*/
@SerializedName("terms_of_service")
TermsOfService termsOfService;
private ConsentCollection(
Map extraParams,
PaymentMethodReuseAgreement paymentMethodReuseAgreement,
Promotions promotions,
TermsOfService termsOfService) {
this.extraParams = extraParams;
this.paymentMethodReuseAgreement = paymentMethodReuseAgreement;
this.promotions = promotions;
this.termsOfService = termsOfService;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private PaymentMethodReuseAgreement paymentMethodReuseAgreement;
private Promotions promotions;
private TermsOfService termsOfService;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.ConsentCollection build() {
return new SessionCreateParams.ConsentCollection(
this.extraParams,
this.paymentMethodReuseAgreement,
this.promotions,
this.termsOfService);
}
/**
* 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 {@link
* SessionCreateParams.ConsentCollection#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.ConsentCollection#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Determines the display of payment method reuse agreement text in the UI. If set to {@code
* hidden}, it will hide legal text related to the reuse of a payment method.
*/
public Builder setPaymentMethodReuseAgreement(
SessionCreateParams.ConsentCollection.PaymentMethodReuseAgreement
paymentMethodReuseAgreement) {
this.paymentMethodReuseAgreement = paymentMethodReuseAgreement;
return this;
}
/**
* If set to {@code auto}, enables the collection of customer consent for promotional
* communications. The Checkout Session will determine whether to display an option to opt
* into promotional communication from the merchant depending on the customer's locale. Only
* available to US merchants.
*/
public Builder setPromotions(SessionCreateParams.ConsentCollection.Promotions promotions) {
this.promotions = promotions;
return this;
}
/**
* If set to {@code required}, it requires customers to check a terms of service checkbox
* before being able to pay. There must be a valid terms of service URL set in your Dashboard settings.
*/
public Builder setTermsOfService(
SessionCreateParams.ConsentCollection.TermsOfService termsOfService) {
this.termsOfService = termsOfService;
return this;
}
}
@Getter
public static class PaymentMethodReuseAgreement {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Required. Determines the position and visibility of the payment method
* reuse agreement in the UI. When set to {@code auto}, Stripe's defaults will be used. When
* set to {@code hidden}, the payment method reuse agreement text will always be hidden in the
* UI.
*/
@SerializedName("position")
Position position;
private PaymentMethodReuseAgreement(Map extraParams, Position position) {
this.extraParams = extraParams;
this.position = position;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private Position position;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.ConsentCollection.PaymentMethodReuseAgreement build() {
return new SessionCreateParams.ConsentCollection.PaymentMethodReuseAgreement(
this.extraParams, this.position);
}
/**
* 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 {@link
* SessionCreateParams.ConsentCollection.PaymentMethodReuseAgreement#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link
* SessionCreateParams.ConsentCollection.PaymentMethodReuseAgreement#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Required. Determines the position and visibility of the payment method
* reuse agreement in the UI. When set to {@code auto}, Stripe's defaults will be used. When
* set to {@code hidden}, the payment method reuse agreement text will always be hidden in
* the UI.
*/
public Builder setPosition(
SessionCreateParams.ConsentCollection.PaymentMethodReuseAgreement.Position position) {
this.position = position;
return this;
}
}
public enum Position implements ApiRequestParams.EnumParam {
@SerializedName("auto")
AUTO("auto"),
@SerializedName("hidden")
HIDDEN("hidden");
@Getter(onMethod_ = {@Override})
private final String value;
Position(String value) {
this.value = value;
}
}
}
public enum Promotions implements ApiRequestParams.EnumParam {
@SerializedName("auto")
AUTO("auto"),
@SerializedName("none")
NONE("none");
@Getter(onMethod_ = {@Override})
private final String value;
Promotions(String value) {
this.value = value;
}
}
public enum TermsOfService implements ApiRequestParams.EnumParam {
@SerializedName("none")
NONE("none"),
@SerializedName("required")
REQUIRED("required");
@Getter(onMethod_ = {@Override})
private final String value;
TermsOfService(String value) {
this.value = value;
}
}
}
@Getter
public static class CustomField {
/** Configuration for {@code type=dropdown} fields. */
@SerializedName("dropdown")
Dropdown dropdown;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Required. String of your choice that your integration can use to reconcile
* this field. Must be unique to this field, alphanumeric, and up to 200 characters.
*/
@SerializedName("key")
String key;
/** Required. The label for the field, displayed to the customer. */
@SerializedName("label")
Label label;
/** Configuration for {@code type=numeric} fields. */
@SerializedName("numeric")
Numeric numeric;
/**
* Whether the customer is required to complete the field before completing the Checkout
* Session. Defaults to {@code false}.
*/
@SerializedName("optional")
Boolean optional;
/** Configuration for {@code type=text} fields. */
@SerializedName("text")
Text text;
/** Required. The type of the field. */
@SerializedName("type")
Type type;
private CustomField(
Dropdown dropdown,
Map extraParams,
String key,
Label label,
Numeric numeric,
Boolean optional,
Text text,
Type type) {
this.dropdown = dropdown;
this.extraParams = extraParams;
this.key = key;
this.label = label;
this.numeric = numeric;
this.optional = optional;
this.text = text;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Dropdown dropdown;
private Map extraParams;
private String key;
private Label label;
private Numeric numeric;
private Boolean optional;
private Text text;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomField build() {
return new SessionCreateParams.CustomField(
this.dropdown,
this.extraParams,
this.key,
this.label,
this.numeric,
this.optional,
this.text,
this.type);
}
/** Configuration for {@code type=dropdown} fields. */
public Builder setDropdown(SessionCreateParams.CustomField.Dropdown dropdown) {
this.dropdown = dropdown;
return this;
}
/**
* 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 {@link
* SessionCreateParams.CustomField#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Required. String of your choice that your integration can use to reconcile
* this field. Must be unique to this field, alphanumeric, and up to 200 characters.
*/
public Builder setKey(String key) {
this.key = key;
return this;
}
/** Required. The label for the field, displayed to the customer. */
public Builder setLabel(SessionCreateParams.CustomField.Label label) {
this.label = label;
return this;
}
/** Configuration for {@code type=numeric} fields. */
public Builder setNumeric(SessionCreateParams.CustomField.Numeric numeric) {
this.numeric = numeric;
return this;
}
/**
* Whether the customer is required to complete the field before completing the Checkout
* Session. Defaults to {@code false}.
*/
public Builder setOptional(Boolean optional) {
this.optional = optional;
return this;
}
/** Configuration for {@code type=text} fields. */
public Builder setText(SessionCreateParams.CustomField.Text text) {
this.text = text;
return this;
}
/** Required. The type of the field. */
public Builder setType(SessionCreateParams.CustomField.Type type) {
this.type = type;
return this;
}
}
@Getter
public static class Dropdown {
/**
* The value that will pre-fill the field on the payment page.Must match a {@code value} in
* the {@code options} array.
*/
@SerializedName("default_value")
String defaultValue;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Required. The options available for the customer to select. Up to 200
* options allowed.
*/
@SerializedName("options")
List options;
private Dropdown(
String defaultValue,
Map extraParams,
List options) {
this.defaultValue = defaultValue;
this.extraParams = extraParams;
this.options = options;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String defaultValue;
private Map extraParams;
private List options;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomField.Dropdown build() {
return new SessionCreateParams.CustomField.Dropdown(
this.defaultValue, this.extraParams, this.options);
}
/**
* The value that will pre-fill the field on the payment page.Must match a {@code value} in
* the {@code options} array.
*/
public Builder setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Dropdown#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Dropdown#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Add an element to `options` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.CustomField.Dropdown#options} for the field documentation.
*/
public Builder addOption(SessionCreateParams.CustomField.Dropdown.Option element) {
if (this.options == null) {
this.options = new ArrayList<>();
}
this.options.add(element);
return this;
}
/**
* Add all elements to `options` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.CustomField.Dropdown#options} for the field documentation.
*/
public Builder addAllOption(
List elements) {
if (this.options == null) {
this.options = new ArrayList<>();
}
this.options.addAll(elements);
return this;
}
}
@Getter
public static class Option {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Required. The label for the option, displayed to the customer. Up to 100
* characters.
*/
@SerializedName("label")
String label;
/**
* Required. The value for this option, not displayed to the customer, used
* by your integration to reconcile the option selected by the customer. Must be unique to
* this option, alphanumeric, and up to 100 characters.
*/
@SerializedName("value")
String value;
private Option(Map extraParams, String label, String value) {
this.extraParams = extraParams;
this.label = label;
this.value = value;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String label;
private String value;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomField.Dropdown.Option build() {
return new SessionCreateParams.CustomField.Dropdown.Option(
this.extraParams, this.label, this.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 {@link SessionCreateParams.CustomField.Dropdown.Option#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Dropdown.Option#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Required. The label for the option, displayed to the customer. Up to
* 100 characters.
*/
public Builder setLabel(String label) {
this.label = label;
return this;
}
/**
* Required. The value for this option, not displayed to the customer,
* used by your integration to reconcile the option selected by the customer. Must be
* unique to this option, alphanumeric, and up to 100 characters.
*/
public Builder setValue(String value) {
this.value = value;
return this;
}
}
}
}
@Getter
public static class Label {
/**
* Required. Custom text for the label, displayed to the customer. Up to 50
* characters.
*/
@SerializedName("custom")
String custom;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. The type of the label. */
@SerializedName("type")
Type type;
private Label(String custom, Map extraParams, Type type) {
this.custom = custom;
this.extraParams = extraParams;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String custom;
private Map extraParams;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomField.Label build() {
return new SessionCreateParams.CustomField.Label(
this.custom, this.extraParams, this.type);
}
/**
* Required. Custom text for the label, displayed to the customer. Up to 50
* characters.
*/
public Builder setCustom(String custom) {
this.custom = custom;
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Label#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Label#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. The type of the label. */
public Builder setType(SessionCreateParams.CustomField.Label.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("custom")
CUSTOM("custom");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class Numeric {
/** The value that will pre-fill the field on the payment page. */
@SerializedName("default_value")
String defaultValue;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** The maximum character length constraint for the customer's input. */
@SerializedName("maximum_length")
Long maximumLength;
/** The minimum character length requirement for the customer's input. */
@SerializedName("minimum_length")
Long minimumLength;
private Numeric(
String defaultValue,
Map extraParams,
Long maximumLength,
Long minimumLength) {
this.defaultValue = defaultValue;
this.extraParams = extraParams;
this.maximumLength = maximumLength;
this.minimumLength = minimumLength;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String defaultValue;
private Map extraParams;
private Long maximumLength;
private Long minimumLength;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomField.Numeric build() {
return new SessionCreateParams.CustomField.Numeric(
this.defaultValue, this.extraParams, this.maximumLength, this.minimumLength);
}
/** The value that will pre-fill the field on the payment page. */
public Builder setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Numeric#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Numeric#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** The maximum character length constraint for the customer's input. */
public Builder setMaximumLength(Long maximumLength) {
this.maximumLength = maximumLength;
return this;
}
/** The minimum character length requirement for the customer's input. */
public Builder setMinimumLength(Long minimumLength) {
this.minimumLength = minimumLength;
return this;
}
}
}
@Getter
public static class Text {
/** The value that will pre-fill the field on the payment page. */
@SerializedName("default_value")
String defaultValue;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** The maximum character length constraint for the customer's input. */
@SerializedName("maximum_length")
Long maximumLength;
/** The minimum character length requirement for the customer's input. */
@SerializedName("minimum_length")
Long minimumLength;
private Text(
String defaultValue,
Map extraParams,
Long maximumLength,
Long minimumLength) {
this.defaultValue = defaultValue;
this.extraParams = extraParams;
this.maximumLength = maximumLength;
this.minimumLength = minimumLength;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String defaultValue;
private Map extraParams;
private Long maximumLength;
private Long minimumLength;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomField.Text build() {
return new SessionCreateParams.CustomField.Text(
this.defaultValue, this.extraParams, this.maximumLength, this.minimumLength);
}
/** The value that will pre-fill the field on the payment page. */
public Builder setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Text#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomField.Text#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** The maximum character length constraint for the customer's input. */
public Builder setMaximumLength(Long maximumLength) {
this.maximumLength = maximumLength;
return this;
}
/** The minimum character length requirement for the customer's input. */
public Builder setMinimumLength(Long minimumLength) {
this.minimumLength = minimumLength;
return this;
}
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("dropdown")
DROPDOWN("dropdown"),
@SerializedName("numeric")
NUMERIC("numeric"),
@SerializedName("text")
TEXT("text");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class CustomText {
/** Custom text that should be displayed after the payment confirmation button. */
@SerializedName("after_submit")
Object afterSubmit;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Custom text that should be displayed alongside shipping address collection. */
@SerializedName("shipping_address")
Object shippingAddress;
/** Custom text that should be displayed alongside the payment confirmation button. */
@SerializedName("submit")
Object submit;
/**
* Custom text that should be displayed in place of the default terms of service agreement text.
*/
@SerializedName("terms_of_service_acceptance")
Object termsOfServiceAcceptance;
private CustomText(
Object afterSubmit,
Map extraParams,
Object shippingAddress,
Object submit,
Object termsOfServiceAcceptance) {
this.afterSubmit = afterSubmit;
this.extraParams = extraParams;
this.shippingAddress = shippingAddress;
this.submit = submit;
this.termsOfServiceAcceptance = termsOfServiceAcceptance;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Object afterSubmit;
private Map extraParams;
private Object shippingAddress;
private Object submit;
private Object termsOfServiceAcceptance;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomText build() {
return new SessionCreateParams.CustomText(
this.afterSubmit,
this.extraParams,
this.shippingAddress,
this.submit,
this.termsOfServiceAcceptance);
}
/** Custom text that should be displayed after the payment confirmation button. */
public Builder setAfterSubmit(SessionCreateParams.CustomText.AfterSubmit afterSubmit) {
this.afterSubmit = afterSubmit;
return this;
}
/** Custom text that should be displayed after the payment confirmation button. */
public Builder setAfterSubmit(EmptyParam afterSubmit) {
this.afterSubmit = afterSubmit;
return this;
}
/**
* 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 {@link
* SessionCreateParams.CustomText#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomText#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Custom text that should be displayed alongside shipping address collection. */
public Builder setShippingAddress(
SessionCreateParams.CustomText.ShippingAddress shippingAddress) {
this.shippingAddress = shippingAddress;
return this;
}
/** Custom text that should be displayed alongside shipping address collection. */
public Builder setShippingAddress(EmptyParam shippingAddress) {
this.shippingAddress = shippingAddress;
return this;
}
/** Custom text that should be displayed alongside the payment confirmation button. */
public Builder setSubmit(SessionCreateParams.CustomText.Submit submit) {
this.submit = submit;
return this;
}
/** Custom text that should be displayed alongside the payment confirmation button. */
public Builder setSubmit(EmptyParam submit) {
this.submit = submit;
return this;
}
/**
* Custom text that should be displayed in place of the default terms of service agreement
* text.
*/
public Builder setTermsOfServiceAcceptance(
SessionCreateParams.CustomText.TermsOfServiceAcceptance termsOfServiceAcceptance) {
this.termsOfServiceAcceptance = termsOfServiceAcceptance;
return this;
}
/**
* Custom text that should be displayed in place of the default terms of service agreement
* text.
*/
public Builder setTermsOfServiceAcceptance(EmptyParam termsOfServiceAcceptance) {
this.termsOfServiceAcceptance = termsOfServiceAcceptance;
return this;
}
}
@Getter
public static class AfterSubmit {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Text may be up to 1200 characters in length. */
@SerializedName("message")
String message;
private AfterSubmit(Map extraParams, String message) {
this.extraParams = extraParams;
this.message = message;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String message;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomText.AfterSubmit build() {
return new SessionCreateParams.CustomText.AfterSubmit(this.extraParams, this.message);
}
/**
* 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 {@link SessionCreateParams.CustomText.AfterSubmit#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomText.AfterSubmit#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Text may be up to 1200 characters in length. */
public Builder setMessage(String message) {
this.message = message;
return this;
}
}
}
@Getter
public static class ShippingAddress {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Text may be up to 1200 characters in length. */
@SerializedName("message")
String message;
private ShippingAddress(Map extraParams, String message) {
this.extraParams = extraParams;
this.message = message;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String message;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomText.ShippingAddress build() {
return new SessionCreateParams.CustomText.ShippingAddress(this.extraParams, this.message);
}
/**
* 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 {@link SessionCreateParams.CustomText.ShippingAddress#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomText.ShippingAddress#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Text may be up to 1200 characters in length. */
public Builder setMessage(String message) {
this.message = message;
return this;
}
}
}
@Getter
public static class Submit {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Text may be up to 1200 characters in length. */
@SerializedName("message")
String message;
private Submit(Map extraParams, String message) {
this.extraParams = extraParams;
this.message = message;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String message;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomText.Submit build() {
return new SessionCreateParams.CustomText.Submit(this.extraParams, this.message);
}
/**
* 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 {@link SessionCreateParams.CustomText.Submit#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomText.Submit#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Text may be up to 1200 characters in length. */
public Builder setMessage(String message) {
this.message = message;
return this;
}
}
}
@Getter
public static class TermsOfServiceAcceptance {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Text may be up to 1200 characters in length. */
@SerializedName("message")
String message;
private TermsOfServiceAcceptance(Map extraParams, String message) {
this.extraParams = extraParams;
this.message = message;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String message;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomText.TermsOfServiceAcceptance build() {
return new SessionCreateParams.CustomText.TermsOfServiceAcceptance(
this.extraParams, this.message);
}
/**
* 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 {@link SessionCreateParams.CustomText.TermsOfServiceAcceptance#extraParams} for
* the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomText.TermsOfServiceAcceptance#extraParams} for
* the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Text may be up to 1200 characters in length. */
public Builder setMessage(String message) {
this.message = message;
return this;
}
}
}
}
@Getter
public static class CustomerUpdate {
/**
* Describes whether Checkout saves the billing address onto {@code customer.address}. To always
* collect a full billing address, use {@code billing_address_collection}. Defaults to {@code
* never}.
*/
@SerializedName("address")
Address address;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Describes whether Checkout saves the name onto {@code customer.name}. Defaults to {@code
* never}.
*/
@SerializedName("name")
Name name;
/**
* Describes whether Checkout saves shipping information onto {@code customer.shipping}. To
* collect shipping information, use {@code shipping_address_collection}. Defaults to {@code
* never}.
*/
@SerializedName("shipping")
Shipping shipping;
private CustomerUpdate(
Address address, Map extraParams, Name name, Shipping shipping) {
this.address = address;
this.extraParams = extraParams;
this.name = name;
this.shipping = shipping;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Address address;
private Map extraParams;
private Name name;
private Shipping shipping;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.CustomerUpdate build() {
return new SessionCreateParams.CustomerUpdate(
this.address, this.extraParams, this.name, this.shipping);
}
/**
* Describes whether Checkout saves the billing address onto {@code customer.address}. To
* always collect a full billing address, use {@code billing_address_collection}. Defaults to
* {@code never}.
*/
public Builder setAddress(SessionCreateParams.CustomerUpdate.Address address) {
this.address = address;
return this;
}
/**
* 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 {@link
* SessionCreateParams.CustomerUpdate#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.CustomerUpdate#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Describes whether Checkout saves the name onto {@code customer.name}. Defaults to {@code
* never}.
*/
public Builder setName(SessionCreateParams.CustomerUpdate.Name name) {
this.name = name;
return this;
}
/**
* Describes whether Checkout saves shipping information onto {@code customer.shipping}. To
* collect shipping information, use {@code shipping_address_collection}. Defaults to {@code
* never}.
*/
public Builder setShipping(SessionCreateParams.CustomerUpdate.Shipping shipping) {
this.shipping = shipping;
return this;
}
}
public enum Address implements ApiRequestParams.EnumParam {
@SerializedName("auto")
AUTO("auto"),
@SerializedName("never")
NEVER("never");
@Getter(onMethod_ = {@Override})
private final String value;
Address(String value) {
this.value = value;
}
}
public enum Name implements ApiRequestParams.EnumParam {
@SerializedName("auto")
AUTO("auto"),
@SerializedName("never")
NEVER("never");
@Getter(onMethod_ = {@Override})
private final String value;
Name(String value) {
this.value = value;
}
}
public enum Shipping implements ApiRequestParams.EnumParam {
@SerializedName("auto")
AUTO("auto"),
@SerializedName("never")
NEVER("never");
@Getter(onMethod_ = {@Override})
private final String value;
Shipping(String value) {
this.value = value;
}
}
}
@Getter
public static class Discount {
/** The ID of the coupon to apply to this Session. */
@SerializedName("coupon")
String coupon;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** The ID of a promotion code to apply to this Session. */
@SerializedName("promotion_code")
String promotionCode;
private Discount(String coupon, Map extraParams, String promotionCode) {
this.coupon = coupon;
this.extraParams = extraParams;
this.promotionCode = promotionCode;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String coupon;
private Map extraParams;
private String promotionCode;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.Discount build() {
return new SessionCreateParams.Discount(this.coupon, this.extraParams, this.promotionCode);
}
/** The ID of the coupon to apply to this Session. */
public Builder setCoupon(String coupon) {
this.coupon = coupon;
return this;
}
/**
* 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 {@link
* SessionCreateParams.Discount#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.Discount#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** The ID of a promotion code to apply to this Session. */
public Builder setPromotionCode(String promotionCode) {
this.promotionCode = promotionCode;
return this;
}
}
}
@Getter
public static class InvoiceCreation {
/** Required. Set to {@code true} to enable invoice creation. */
@SerializedName("enabled")
Boolean enabled;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Parameters passed when creating invoices for payment-mode Checkout Sessions. */
@SerializedName("invoice_data")
InvoiceData invoiceData;
private InvoiceCreation(
Boolean enabled, Map extraParams, InvoiceData invoiceData) {
this.enabled = enabled;
this.extraParams = extraParams;
this.invoiceData = invoiceData;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Boolean enabled;
private Map extraParams;
private InvoiceData invoiceData;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.InvoiceCreation build() {
return new SessionCreateParams.InvoiceCreation(
this.enabled, this.extraParams, this.invoiceData);
}
/** Required. Set to {@code true} to enable invoice creation. */
public Builder setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* 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 {@link
* SessionCreateParams.InvoiceCreation#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.InvoiceCreation#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Parameters passed when creating invoices for payment-mode Checkout Sessions. */
public Builder setInvoiceData(SessionCreateParams.InvoiceCreation.InvoiceData invoiceData) {
this.invoiceData = invoiceData;
return this;
}
}
@Getter
public static class InvoiceData {
/** The account tax IDs associated with the invoice. */
@SerializedName("account_tax_ids")
Object accountTaxIds;
/** Default custom fields to be displayed on invoices for this customer. */
@SerializedName("custom_fields")
Object customFields;
/** An arbitrary string attached to the object. Often useful for displaying to users. */
@SerializedName("description")
String description;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Default footer to be displayed on invoices for this customer. */
@SerializedName("footer")
String footer;
/**
* The connected account that issues the invoice. The invoice is presented with the branding
* and support information of the specified account.
*/
@SerializedName("issuer")
Issuer issuer;
/**
* 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. Individual keys can be unset by posting an empty value to them. All
* keys can be unset by posting an empty value to {@code metadata}.
*/
@SerializedName("metadata")
Map metadata;
/** Default options for invoice PDF rendering for this customer. */
@SerializedName("rendering_options")
Object renderingOptions;
private InvoiceData(
Object accountTaxIds,
Object customFields,
String description,
Map extraParams,
String footer,
Issuer issuer,
Map metadata,
Object renderingOptions) {
this.accountTaxIds = accountTaxIds;
this.customFields = customFields;
this.description = description;
this.extraParams = extraParams;
this.footer = footer;
this.issuer = issuer;
this.metadata = metadata;
this.renderingOptions = renderingOptions;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Object accountTaxIds;
private Object customFields;
private String description;
private Map extraParams;
private String footer;
private Issuer issuer;
private Map metadata;
private Object renderingOptions;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.InvoiceCreation.InvoiceData build() {
return new SessionCreateParams.InvoiceCreation.InvoiceData(
this.accountTaxIds,
this.customFields,
this.description,
this.extraParams,
this.footer,
this.issuer,
this.metadata,
this.renderingOptions);
}
/**
* Add an element to `accountTaxIds` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.InvoiceCreation.InvoiceData#accountTaxIds} for the field
* documentation.
*/
@SuppressWarnings("unchecked")
public Builder addAccountTaxId(String element) {
if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) {
this.accountTaxIds = new ArrayList();
}
((List) this.accountTaxIds).add(element);
return this;
}
/**
* Add all elements to `accountTaxIds` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original list.
* See {@link SessionCreateParams.InvoiceCreation.InvoiceData#accountTaxIds} for the field
* documentation.
*/
@SuppressWarnings("unchecked")
public Builder addAllAccountTaxId(List elements) {
if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) {
this.accountTaxIds = new ArrayList();
}
((List) this.accountTaxIds).addAll(elements);
return this;
}
/** The account tax IDs associated with the invoice. */
public Builder setAccountTaxIds(EmptyParam accountTaxIds) {
this.accountTaxIds = accountTaxIds;
return this;
}
/** The account tax IDs associated with the invoice. */
public Builder setAccountTaxIds(List accountTaxIds) {
this.accountTaxIds = accountTaxIds;
return this;
}
/**
* Add an element to `customFields` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.InvoiceCreation.InvoiceData#customFields} for the field
* documentation.
*/
@SuppressWarnings("unchecked")
public Builder addCustomField(
SessionCreateParams.InvoiceCreation.InvoiceData.CustomField element) {
if (this.customFields == null || this.customFields instanceof EmptyParam) {
this.customFields =
new ArrayList();
}
((List) this.customFields)
.add(element);
return this;
}
/**
* Add all elements to `customFields` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.InvoiceCreation.InvoiceData#customFields} for the field
* documentation.
*/
@SuppressWarnings("unchecked")
public Builder addAllCustomField(
List elements) {
if (this.customFields == null || this.customFields instanceof EmptyParam) {
this.customFields =
new ArrayList();
}
((List) this.customFields)
.addAll(elements);
return this;
}
/** Default custom fields to be displayed on invoices for this customer. */
public Builder setCustomFields(EmptyParam customFields) {
this.customFields = customFields;
return this;
}
/** Default custom fields to be displayed on invoices for this customer. */
public Builder setCustomFields(
List customFields) {
this.customFields = customFields;
return this;
}
/** An arbitrary string attached to the object. Often useful for displaying to users. */
public Builder setDescription(String description) {
this.description = description;
return this;
}
/**
* 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 {@link SessionCreateParams.InvoiceCreation.InvoiceData#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.InvoiceCreation.InvoiceData#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Default footer to be displayed on invoices for this customer. */
public Builder setFooter(String footer) {
this.footer = footer;
return this;
}
/**
* The connected account that issues the invoice. The invoice is presented with the branding
* and support information of the specified account.
*/
public Builder setIssuer(SessionCreateParams.InvoiceCreation.InvoiceData.Issuer issuer) {
this.issuer = issuer;
return this;
}
/**
* 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 {@link
* SessionCreateParams.InvoiceCreation.InvoiceData#metadata} for the field documentation.
*/
public Builder putMetadata(String key, String value) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.InvoiceCreation.InvoiceData#metadata} for the field
* documentation.
*/
public Builder putAllMetadata(Map map) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.putAll(map);
return this;
}
/** Default options for invoice PDF rendering for this customer. */
public Builder setRenderingOptions(
SessionCreateParams.InvoiceCreation.InvoiceData.RenderingOptions renderingOptions) {
this.renderingOptions = renderingOptions;
return this;
}
/** Default options for invoice PDF rendering for this customer. */
public Builder setRenderingOptions(EmptyParam renderingOptions) {
this.renderingOptions = renderingOptions;
return this;
}
}
@Getter
public static class CustomField {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Required. The name of the custom field. This may be up to 40 characters.
*/
@SerializedName("name")
String name;
/**
* Required. The value of the custom field. This may be up to 140
* characters.
*/
@SerializedName("value")
String value;
private CustomField(Map extraParams, String name, String value) {
this.extraParams = extraParams;
this.name = name;
this.value = value;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String name;
private String value;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.InvoiceCreation.InvoiceData.CustomField build() {
return new SessionCreateParams.InvoiceCreation.InvoiceData.CustomField(
this.extraParams, this.name, this.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 {@link
* SessionCreateParams.InvoiceCreation.InvoiceData.CustomField#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link
* SessionCreateParams.InvoiceCreation.InvoiceData.CustomField#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Required. The name of the custom field. This may be up to 40
* characters.
*/
public Builder setName(String name) {
this.name = name;
return this;
}
/**
* Required. The value of the custom field. This may be up to 140
* characters.
*/
public Builder setValue(String value) {
this.value = value;
return this;
}
}
}
@Getter
public static class Issuer {
/** The connected account being referenced when {@code type} is {@code account}. */
@SerializedName("account")
String account;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Type of the account referenced in the request. */
@SerializedName("type")
Type type;
private Issuer(String account, Map extraParams, Type type) {
this.account = account;
this.extraParams = extraParams;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String account;
private Map extraParams;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.InvoiceCreation.InvoiceData.Issuer build() {
return new SessionCreateParams.InvoiceCreation.InvoiceData.Issuer(
this.account, this.extraParams, this.type);
}
/** The connected account being referenced when {@code type} is {@code account}. */
public Builder setAccount(String account) {
this.account = account;
return this;
}
/**
* 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 {@link SessionCreateParams.InvoiceCreation.InvoiceData.Issuer#extraParams} for
* the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.InvoiceCreation.InvoiceData.Issuer#extraParams} for
* the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Type of the account referenced in the request. */
public Builder setType(SessionCreateParams.InvoiceCreation.InvoiceData.Issuer.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("account")
ACCOUNT("account"),
@SerializedName("self")
SELF("self");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class RenderingOptions {
/**
* How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
* One of {@code exclude_tax} or {@code include_inclusive_tax}. {@code
* include_inclusive_tax} will include inclusive tax (and exclude exclusive tax) in invoice
* PDF amounts. {@code exclude_tax} will exclude all tax (inclusive and exclusive alike)
* from invoice PDF amounts.
*/
@SerializedName("amount_tax_display")
ApiRequestParams.EnumParam amountTaxDisplay;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
private RenderingOptions(
ApiRequestParams.EnumParam amountTaxDisplay, Map extraParams) {
this.amountTaxDisplay = amountTaxDisplay;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private ApiRequestParams.EnumParam amountTaxDisplay;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.InvoiceCreation.InvoiceData.RenderingOptions build() {
return new SessionCreateParams.InvoiceCreation.InvoiceData.RenderingOptions(
this.amountTaxDisplay, this.extraParams);
}
/**
* How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
* One of {@code exclude_tax} or {@code include_inclusive_tax}. {@code
* include_inclusive_tax} will include inclusive tax (and exclude exclusive tax) in
* invoice PDF amounts. {@code exclude_tax} will exclude all tax (inclusive and exclusive
* alike) from invoice PDF amounts.
*/
public Builder setAmountTaxDisplay(
SessionCreateParams.InvoiceCreation.InvoiceData.RenderingOptions.AmountTaxDisplay
amountTaxDisplay) {
this.amountTaxDisplay = amountTaxDisplay;
return this;
}
/**
* How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
* One of {@code exclude_tax} or {@code include_inclusive_tax}. {@code
* include_inclusive_tax} will include inclusive tax (and exclude exclusive tax) in
* invoice PDF amounts. {@code exclude_tax} will exclude all tax (inclusive and exclusive
* alike) from invoice PDF amounts.
*/
public Builder setAmountTaxDisplay(EmptyParam amountTaxDisplay) {
this.amountTaxDisplay = amountTaxDisplay;
return this;
}
/**
* 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 {@link
* SessionCreateParams.InvoiceCreation.InvoiceData.RenderingOptions#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link
* SessionCreateParams.InvoiceCreation.InvoiceData.RenderingOptions#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
public enum AmountTaxDisplay implements ApiRequestParams.EnumParam {
@SerializedName("exclude_tax")
EXCLUDE_TAX("exclude_tax"),
@SerializedName("include_inclusive_tax")
INCLUDE_INCLUSIVE_TAX("include_inclusive_tax");
@Getter(onMethod_ = {@Override})
private final String value;
AmountTaxDisplay(String value) {
this.value = value;
}
}
}
}
}
@Getter
public static class LineItem {
/**
* When set, provides configuration for this item’s quantity to be adjusted by the customer
* during Checkout.
*/
@SerializedName("adjustable_quantity")
AdjustableQuantity adjustableQuantity;
/**
* The tax rates that will be applied to
* this line item depending on the customer's billing/shipping address. We currently support the
* following countries: US, GB, AU, and all countries in the EU.
*/
@SerializedName("dynamic_tax_rates")
List dynamicTaxRates;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* The ID of the Price or Plan object. One of {@code price} or {@code
* price_data} is required.
*/
@SerializedName("price")
String price;
/**
* Data used to generate a new Price object
* inline. One of {@code price} or {@code price_data} is required.
*/
@SerializedName("price_data")
PriceData priceData;
/**
* The quantity of the line item being purchased. Quantity should not be defined when {@code
* recurring.usage_type=metered}.
*/
@SerializedName("quantity")
Long quantity;
/**
* The tax rates which apply to this line
* item.
*/
@SerializedName("tax_rates")
List taxRates;
private LineItem(
AdjustableQuantity adjustableQuantity,
List dynamicTaxRates,
Map extraParams,
String price,
PriceData priceData,
Long quantity,
List taxRates) {
this.adjustableQuantity = adjustableQuantity;
this.dynamicTaxRates = dynamicTaxRates;
this.extraParams = extraParams;
this.price = price;
this.priceData = priceData;
this.quantity = quantity;
this.taxRates = taxRates;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private AdjustableQuantity adjustableQuantity;
private List dynamicTaxRates;
private Map extraParams;
private String price;
private PriceData priceData;
private Long quantity;
private List taxRates;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.LineItem build() {
return new SessionCreateParams.LineItem(
this.adjustableQuantity,
this.dynamicTaxRates,
this.extraParams,
this.price,
this.priceData,
this.quantity,
this.taxRates);
}
/**
* When set, provides configuration for this item’s quantity to be adjusted by the customer
* during Checkout.
*/
public Builder setAdjustableQuantity(
SessionCreateParams.LineItem.AdjustableQuantity adjustableQuantity) {
this.adjustableQuantity = adjustableQuantity;
return this;
}
/**
* Add an element to `dynamicTaxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem#dynamicTaxRates} for the field documentation.
*/
public Builder addDynamicTaxRate(String element) {
if (this.dynamicTaxRates == null) {
this.dynamicTaxRates = new ArrayList<>();
}
this.dynamicTaxRates.add(element);
return this;
}
/**
* Add all elements to `dynamicTaxRates` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original list. See
* {@link SessionCreateParams.LineItem#dynamicTaxRates} for the field documentation.
*/
public Builder addAllDynamicTaxRate(List elements) {
if (this.dynamicTaxRates == null) {
this.dynamicTaxRates = new ArrayList<>();
}
this.dynamicTaxRates.addAll(elements);
return this;
}
/**
* 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 {@link
* SessionCreateParams.LineItem#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* The ID of the Price or Plan object. One of {@code price} or {@code
* price_data} is required.
*/
public Builder setPrice(String price) {
this.price = price;
return this;
}
/**
* Data used to generate a new Price object
* inline. One of {@code price} or {@code price_data} is required.
*/
public Builder setPriceData(SessionCreateParams.LineItem.PriceData priceData) {
this.priceData = priceData;
return this;
}
/**
* The quantity of the line item being purchased. Quantity should not be defined when {@code
* recurring.usage_type=metered}.
*/
public Builder setQuantity(Long quantity) {
this.quantity = quantity;
return this;
}
/**
* Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem#taxRates} for the field documentation.
*/
public Builder addTaxRate(String element) {
if (this.taxRates == null) {
this.taxRates = new ArrayList<>();
}
this.taxRates.add(element);
return this;
}
/**
* Add all elements to `taxRates` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem#taxRates} for the field documentation.
*/
public Builder addAllTaxRate(List elements) {
if (this.taxRates == null) {
this.taxRates = new ArrayList<>();
}
this.taxRates.addAll(elements);
return this;
}
}
@Getter
public static class AdjustableQuantity {
/**
* Required. Set to true if the quantity can be adjusted to any non-negative
* integer. By default customers will be able to remove the line item by setting the quantity
* to 0.
*/
@SerializedName("enabled")
Boolean enabled;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* The maximum quantity the customer can purchase for the Checkout Session. By default this
* value is 99. You can specify a value up to 999999.
*/
@SerializedName("maximum")
Long maximum;
/**
* The minimum quantity the customer must purchase for the Checkout Session. By default this
* value is 0.
*/
@SerializedName("minimum")
Long minimum;
private AdjustableQuantity(
Boolean enabled, Map extraParams, Long maximum, Long minimum) {
this.enabled = enabled;
this.extraParams = extraParams;
this.maximum = maximum;
this.minimum = minimum;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Boolean enabled;
private Map extraParams;
private Long maximum;
private Long minimum;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.LineItem.AdjustableQuantity build() {
return new SessionCreateParams.LineItem.AdjustableQuantity(
this.enabled, this.extraParams, this.maximum, this.minimum);
}
/**
* Required. Set to true if the quantity can be adjusted to any
* non-negative integer. By default customers will be able to remove the line item by
* setting the quantity to 0.
*/
public Builder setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.AdjustableQuantity#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.AdjustableQuantity#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* The maximum quantity the customer can purchase for the Checkout Session. By default this
* value is 99. You can specify a value up to 999999.
*/
public Builder setMaximum(Long maximum) {
this.maximum = maximum;
return this;
}
/**
* The minimum quantity the customer must purchase for the Checkout Session. By default this
* value is 0.
*/
public Builder setMinimum(Long minimum) {
this.minimum = minimum;
return this;
}
}
}
@Getter
public static class PriceData {
/**
* Required. Three-letter ISO currency code, in
* lowercase. Must be a supported currency.
*/
@SerializedName("currency")
String currency;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* The ID of the product that this price will belong to. One of {@code product} or {@code
* product_data} is required.
*/
@SerializedName("product")
String product;
/**
* Data used to generate a new product object inline. One of {@code product} or {@code
* product_data} is required.
*/
@SerializedName("product_data")
ProductData productData;
/**
* The recurring components of a price such as {@code interval} and {@code interval_count}.
*/
@SerializedName("recurring")
Recurring recurring;
/**
* Only required if a default
* tax behavior was not provided in the Stripe Tax settings. Specifies whether the price
* is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
* exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
* exclusive}, it cannot be changed.
*/
@SerializedName("tax_behavior")
TaxBehavior taxBehavior;
/**
* A non-negative integer in cents (or local equivalent) representing how much to charge. One
* of {@code unit_amount} or {@code unit_amount_decimal} is required.
*/
@SerializedName("unit_amount")
Long unitAmount;
/**
* Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
* with at most 12 decimal places. Only one of {@code unit_amount} and {@code
* unit_amount_decimal} can be set.
*/
@SerializedName("unit_amount_decimal")
BigDecimal unitAmountDecimal;
private PriceData(
String currency,
Map extraParams,
String product,
ProductData productData,
Recurring recurring,
TaxBehavior taxBehavior,
Long unitAmount,
BigDecimal unitAmountDecimal) {
this.currency = currency;
this.extraParams = extraParams;
this.product = product;
this.productData = productData;
this.recurring = recurring;
this.taxBehavior = taxBehavior;
this.unitAmount = unitAmount;
this.unitAmountDecimal = unitAmountDecimal;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String currency;
private Map extraParams;
private String product;
private ProductData productData;
private Recurring recurring;
private TaxBehavior taxBehavior;
private Long unitAmount;
private BigDecimal unitAmountDecimal;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.LineItem.PriceData build() {
return new SessionCreateParams.LineItem.PriceData(
this.currency,
this.extraParams,
this.product,
this.productData,
this.recurring,
this.taxBehavior,
this.unitAmount,
this.unitAmountDecimal);
}
/**
* Required. Three-letter ISO currency code, in
* lowercase. Must be a supported currency.
*/
public Builder setCurrency(String currency) {
this.currency = currency;
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* The ID of the product that this price will belong to. One of {@code product} or {@code
* product_data} is required.
*/
public Builder setProduct(String product) {
this.product = product;
return this;
}
/**
* Data used to generate a new product object inline. One of {@code product} or {@code
* product_data} is required.
*/
public Builder setProductData(
SessionCreateParams.LineItem.PriceData.ProductData productData) {
this.productData = productData;
return this;
}
/**
* The recurring components of a price such as {@code interval} and {@code interval_count}.
*/
public Builder setRecurring(SessionCreateParams.LineItem.PriceData.Recurring recurring) {
this.recurring = recurring;
return this;
}
/**
* Only required if a default
* tax behavior was not provided in the Stripe Tax settings. Specifies whether the price
* is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
* exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
* exclusive}, it cannot be changed.
*/
public Builder setTaxBehavior(
SessionCreateParams.LineItem.PriceData.TaxBehavior taxBehavior) {
this.taxBehavior = taxBehavior;
return this;
}
/**
* A non-negative integer in cents (or local equivalent) representing how much to charge.
* One of {@code unit_amount} or {@code unit_amount_decimal} is required.
*/
public Builder setUnitAmount(Long unitAmount) {
this.unitAmount = unitAmount;
return this;
}
/**
* Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
* with at most 12 decimal places. Only one of {@code unit_amount} and {@code
* unit_amount_decimal} can be set.
*/
public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
this.unitAmountDecimal = unitAmountDecimal;
return this;
}
}
@Getter
public static class ProductData {
/**
* The product's description, meant to be displayable to the customer. Use this field to
* optionally store a long form explanation of the product being sold for your own rendering
* purposes.
*/
@SerializedName("description")
String description;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* A list of up to 8 URLs of images for this product, meant to be displayable to the
* customer.
*/
@SerializedName("images")
List images;
/**
* 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. Individual keys can be unset by posting an empty value to
* them. All keys can be unset by posting an empty value to {@code metadata}.
*/
@SerializedName("metadata")
Map metadata;
/**
* Required. The product's name, meant to be displayable to the customer.
*/
@SerializedName("name")
String name;
/** A tax code ID. */
@SerializedName("tax_code")
String taxCode;
private ProductData(
String description,
Map extraParams,
List images,
Map metadata,
String name,
String taxCode) {
this.description = description;
this.extraParams = extraParams;
this.images = images;
this.metadata = metadata;
this.name = name;
this.taxCode = taxCode;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String description;
private Map extraParams;
private List images;
private Map metadata;
private String name;
private String taxCode;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.LineItem.PriceData.ProductData build() {
return new SessionCreateParams.LineItem.PriceData.ProductData(
this.description,
this.extraParams,
this.images,
this.metadata,
this.name,
this.taxCode);
}
/**
* The product's description, meant to be displayable to the customer. Use this field to
* optionally store a long form explanation of the product being sold for your own
* rendering purposes.
*/
public Builder setDescription(String description) {
this.description = description;
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData.ProductData#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData.ProductData#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Add an element to `images` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem.PriceData.ProductData#images} for the field documentation.
*/
public Builder addImage(String element) {
if (this.images == null) {
this.images = new ArrayList<>();
}
this.images.add(element);
return this;
}
/**
* Add all elements to `images` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem.PriceData.ProductData#images} for the field documentation.
*/
public Builder addAllImage(List elements) {
if (this.images == null) {
this.images = new ArrayList<>();
}
this.images.addAll(elements);
return this;
}
/**
* 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
* {@link SessionCreateParams.LineItem.PriceData.ProductData#metadata} for the field
* documentation.
*/
public Builder putMetadata(String key, String value) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData.ProductData#metadata} for the
* field documentation.
*/
public Builder putAllMetadata(Map map) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.putAll(map);
return this;
}
/**
* Required. The product's name, meant to be displayable to the customer.
*/
public Builder setName(String name) {
this.name = name;
return this;
}
/** A tax code ID. */
public Builder setTaxCode(String taxCode) {
this.taxCode = taxCode;
return this;
}
}
}
@Getter
public static class Recurring {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Required. Specifies billing frequency. Either {@code day}, {@code week},
* {@code month} or {@code year}.
*/
@SerializedName("interval")
Interval interval;
/**
* The number of intervals between subscription billings. For example, {@code
* interval=month} and {@code interval_count=3} bills every 3 months. Maximum of three years
* interval allowed (3 years, 36 months, or 156 weeks).
*/
@SerializedName("interval_count")
Long intervalCount;
private Recurring(Map extraParams, Interval interval, Long intervalCount) {
this.extraParams = extraParams;
this.interval = interval;
this.intervalCount = intervalCount;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private Interval interval;
private Long intervalCount;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.LineItem.PriceData.Recurring build() {
return new SessionCreateParams.LineItem.PriceData.Recurring(
this.extraParams, this.interval, this.intervalCount);
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData.Recurring#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.LineItem.PriceData.Recurring#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Required. Specifies billing frequency. Either {@code day}, {@code
* week}, {@code month} or {@code year}.
*/
public Builder setInterval(
SessionCreateParams.LineItem.PriceData.Recurring.Interval interval) {
this.interval = interval;
return this;
}
/**
* The number of intervals between subscription billings. For example, {@code
* interval=month} and {@code interval_count=3} bills every 3 months. Maximum of three
* years interval allowed (3 years, 36 months, or 156 weeks).
*/
public Builder setIntervalCount(Long intervalCount) {
this.intervalCount = intervalCount;
return this;
}
}
public enum Interval implements ApiRequestParams.EnumParam {
@SerializedName("day")
DAY("day"),
@SerializedName("month")
MONTH("month"),
@SerializedName("week")
WEEK("week"),
@SerializedName("year")
YEAR("year");
@Getter(onMethod_ = {@Override})
private final String value;
Interval(String value) {
this.value = value;
}
}
}
public enum TaxBehavior implements ApiRequestParams.EnumParam {
@SerializedName("exclusive")
EXCLUSIVE("exclusive"),
@SerializedName("inclusive")
INCLUSIVE("inclusive"),
@SerializedName("unspecified")
UNSPECIFIED("unspecified");
@Getter(onMethod_ = {@Override})
private final String value;
TaxBehavior(String value) {
this.value = value;
}
}
}
}
@Getter
public static class PaymentIntentData {
/**
* The amount of the application fee (if any) that will be requested to be applied to the
* payment and transferred to the application owner's Stripe account. The amount of the
* application fee collected will be capped at the total payment amount. For more information,
* see the PaymentIntents use case
* for connected accounts.
*/
@SerializedName("application_fee_amount")
Long applicationFeeAmount;
/** Controls when the funds will be captured from the customer's account. */
@SerializedName("capture_method")
CaptureMethod captureMethod;
/** An arbitrary string attached to the object. Often useful for displaying to users. */
@SerializedName("description")
String description;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* 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. Individual keys can be unset by posting an empty value to them. All keys
* can be unset by posting an empty value to {@code metadata}.
*/
@SerializedName("metadata")
Map metadata;
/**
* The Stripe account ID for which these funds are intended. For details, see the PaymentIntents
* use case for connected
* accounts.
*/
@SerializedName("on_behalf_of")
String onBehalfOf;
/**
* Email address that the receipt for the resulting payment will be sent to. If {@code
* receipt_email} is specified for a payment in live mode, a receipt will be sent regardless of
* your email settings.
*/
@SerializedName("receipt_email")
String receiptEmail;
/**
* Indicates that you intend to make future payments
* with the payment method collected by this Checkout Session.
*
* When setting this to {@code on_session}, Checkout will show a notice to the customer that
* their payment details will be saved.
*
*
When setting this to {@code off_session}, Checkout will show a notice to the customer that
* their payment details will be saved and used for future payments.
*
*
If a Customer has been provided or Checkout creates a new Customer, Checkout will attach
* the payment method to the Customer.
*
*
If Checkout does not create a Customer, the payment method is not attached to a Customer.
* To reuse the payment method, you can retrieve it from the Checkout Session's PaymentIntent.
*
*
When processing card payments, Checkout also uses {@code setup_future_usage} to
* dynamically optimize your payment flow and comply with regional legislation and network
* rules, such as SCA.
*/
@SerializedName("setup_future_usage")
SetupFutureUsage setupFutureUsage;
/** Shipping information for this payment. */
@SerializedName("shipping")
Shipping shipping;
/**
* Text that appears on the customer's statement as the statement descriptor for a non-card
* charge. This value overrides the account's default statement descriptor. For information
* about requirements, including the 22-character limit, see the Statement
* Descriptor docs.
*
*
Setting this value for a card charge returns an error. For card charges, set the statement_descriptor_suffix
* instead.
*/
@SerializedName("statement_descriptor")
String statementDescriptor;
/**
* Provides information about a card charge. Concatenated to the account's statement
* descriptor prefix to form the complete statement descriptor that appears on the
* customer's statement.
*/
@SerializedName("statement_descriptor_suffix")
String statementDescriptorSuffix;
/**
* The parameters used to automatically create a Transfer when the payment succeeds. For more
* information, see the PaymentIntents use case for connected
* accounts.
*/
@SerializedName("transfer_data")
TransferData transferData;
/**
* A string that identifies the resulting payment as part of a group. See the PaymentIntents use case for connected
* accounts for details.
*/
@SerializedName("transfer_group")
String transferGroup;
private PaymentIntentData(
Long applicationFeeAmount,
CaptureMethod captureMethod,
String description,
Map extraParams,
Map metadata,
String onBehalfOf,
String receiptEmail,
SetupFutureUsage setupFutureUsage,
Shipping shipping,
String statementDescriptor,
String statementDescriptorSuffix,
TransferData transferData,
String transferGroup) {
this.applicationFeeAmount = applicationFeeAmount;
this.captureMethod = captureMethod;
this.description = description;
this.extraParams = extraParams;
this.metadata = metadata;
this.onBehalfOf = onBehalfOf;
this.receiptEmail = receiptEmail;
this.setupFutureUsage = setupFutureUsage;
this.shipping = shipping;
this.statementDescriptor = statementDescriptor;
this.statementDescriptorSuffix = statementDescriptorSuffix;
this.transferData = transferData;
this.transferGroup = transferGroup;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long applicationFeeAmount;
private CaptureMethod captureMethod;
private String description;
private Map extraParams;
private Map metadata;
private String onBehalfOf;
private String receiptEmail;
private SetupFutureUsage setupFutureUsage;
private Shipping shipping;
private String statementDescriptor;
private String statementDescriptorSuffix;
private TransferData transferData;
private String transferGroup;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentIntentData build() {
return new SessionCreateParams.PaymentIntentData(
this.applicationFeeAmount,
this.captureMethod,
this.description,
this.extraParams,
this.metadata,
this.onBehalfOf,
this.receiptEmail,
this.setupFutureUsage,
this.shipping,
this.statementDescriptor,
this.statementDescriptorSuffix,
this.transferData,
this.transferGroup);
}
/**
* The amount of the application fee (if any) that will be requested to be applied to the
* payment and transferred to the application owner's Stripe account. The amount of the
* application fee collected will be capped at the total payment amount. For more information,
* see the PaymentIntents use
* case for connected accounts.
*/
public Builder setApplicationFeeAmount(Long applicationFeeAmount) {
this.applicationFeeAmount = applicationFeeAmount;
return this;
}
/** Controls when the funds will be captured from the customer's account. */
public Builder setCaptureMethod(
SessionCreateParams.PaymentIntentData.CaptureMethod captureMethod) {
this.captureMethod = captureMethod;
return this;
}
/** An arbitrary string attached to the object. Often useful for displaying to users. */
public Builder setDescription(String description) {
this.description = description;
return this;
}
/**
* 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 {@link
* SessionCreateParams.PaymentIntentData#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* 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 {@link
* SessionCreateParams.PaymentIntentData#metadata} for the field documentation.
*/
public Builder putMetadata(String key, String value) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData#metadata} for the field documentation.
*/
public Builder putAllMetadata(Map map) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.putAll(map);
return this;
}
/**
* The Stripe account ID for which these funds are intended. For details, see the
* PaymentIntents use case for
* connected accounts.
*/
public Builder setOnBehalfOf(String onBehalfOf) {
this.onBehalfOf = onBehalfOf;
return this;
}
/**
* Email address that the receipt for the resulting payment will be sent to. If {@code
* receipt_email} is specified for a payment in live mode, a receipt will be sent regardless
* of your email settings.
*/
public Builder setReceiptEmail(String receiptEmail) {
this.receiptEmail = receiptEmail;
return this;
}
/**
* Indicates that you intend to make future
* payments with the payment method collected by this Checkout Session.
*
* When setting this to {@code on_session}, Checkout will show a notice to the customer
* that their payment details will be saved.
*
*
When setting this to {@code off_session}, Checkout will show a notice to the customer
* that their payment details will be saved and used for future payments.
*
*
If a Customer has been provided or Checkout creates a new Customer, Checkout will attach
* the payment method to the Customer.
*
*
If Checkout does not create a Customer, the payment method is not attached to a
* Customer. To reuse the payment method, you can retrieve it from the Checkout Session's
* PaymentIntent.
*
*
When processing card payments, Checkout also uses {@code setup_future_usage} to
* dynamically optimize your payment flow and comply with regional legislation and network
* rules, such as SCA.
*/
public Builder setSetupFutureUsage(
SessionCreateParams.PaymentIntentData.SetupFutureUsage setupFutureUsage) {
this.setupFutureUsage = setupFutureUsage;
return this;
}
/** Shipping information for this payment. */
public Builder setShipping(SessionCreateParams.PaymentIntentData.Shipping shipping) {
this.shipping = shipping;
return this;
}
/**
* Text that appears on the customer's statement as the statement descriptor for a non-card
* charge. This value overrides the account's default statement descriptor. For information
* about requirements, including the 22-character limit, see the Statement
* Descriptor docs.
*
*
Setting this value for a card charge returns an error. For card charges, set the statement_descriptor_suffix
* instead.
*/
public Builder setStatementDescriptor(String statementDescriptor) {
this.statementDescriptor = statementDescriptor;
return this;
}
/**
* Provides information about a card charge. Concatenated to the account's statement
* descriptor prefix to form the complete statement descriptor that appears on the
* customer's statement.
*/
public Builder setStatementDescriptorSuffix(String statementDescriptorSuffix) {
this.statementDescriptorSuffix = statementDescriptorSuffix;
return this;
}
/**
* The parameters used to automatically create a Transfer when the payment succeeds. For more
* information, see the PaymentIntents use case for connected
* accounts.
*/
public Builder setTransferData(
SessionCreateParams.PaymentIntentData.TransferData transferData) {
this.transferData = transferData;
return this;
}
/**
* A string that identifies the resulting payment as part of a group. See the PaymentIntents
* use case for
* connected accounts for details.
*/
public Builder setTransferGroup(String transferGroup) {
this.transferGroup = transferGroup;
return this;
}
}
@Getter
public static class Shipping {
/** Required. Shipping address. */
@SerializedName("address")
Address address;
/** The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. */
@SerializedName("carrier")
String carrier;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Recipient name. */
@SerializedName("name")
String name;
/** Recipient phone (including extension). */
@SerializedName("phone")
String phone;
/**
* The tracking number for a physical product, obtained from the delivery service. If multiple
* tracking numbers were generated for this purchase, please separate them with commas.
*/
@SerializedName("tracking_number")
String trackingNumber;
private Shipping(
Address address,
String carrier,
Map extraParams,
String name,
String phone,
String trackingNumber) {
this.address = address;
this.carrier = carrier;
this.extraParams = extraParams;
this.name = name;
this.phone = phone;
this.trackingNumber = trackingNumber;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Address address;
private String carrier;
private Map extraParams;
private String name;
private String phone;
private String trackingNumber;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentIntentData.Shipping build() {
return new SessionCreateParams.PaymentIntentData.Shipping(
this.address,
this.carrier,
this.extraParams,
this.name,
this.phone,
this.trackingNumber);
}
/** Required. Shipping address. */
public Builder setAddress(SessionCreateParams.PaymentIntentData.Shipping.Address address) {
this.address = address;
return this;
}
/** The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. */
public Builder setCarrier(String carrier) {
this.carrier = carrier;
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData.Shipping#extraParams} for the field
* documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData.Shipping#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Recipient name. */
public Builder setName(String name) {
this.name = name;
return this;
}
/** Recipient phone (including extension). */
public Builder setPhone(String phone) {
this.phone = phone;
return this;
}
/**
* The tracking number for a physical product, obtained from the delivery service. If
* multiple tracking numbers were generated for this purchase, please separate them with
* commas.
*/
public Builder setTrackingNumber(String trackingNumber) {
this.trackingNumber = trackingNumber;
return this;
}
}
@Getter
public static class Address {
/** City, district, suburb, town, or village. */
@SerializedName("city")
String city;
/**
* Two-letter country code (ISO
* 3166-1 alpha-2).
*/
@SerializedName("country")
String country;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Required. Address line 1 (e.g., street, PO Box, or company name). */
@SerializedName("line1")
String line1;
/** Address line 2 (e.g., apartment, suite, unit, or building). */
@SerializedName("line2")
String line2;
/** ZIP or postal code. */
@SerializedName("postal_code")
String postalCode;
/** State, county, province, or region. */
@SerializedName("state")
String state;
private Address(
String city,
String country,
Map extraParams,
String line1,
String line2,
String postalCode,
String state) {
this.city = city;
this.country = country;
this.extraParams = extraParams;
this.line1 = line1;
this.line2 = line2;
this.postalCode = postalCode;
this.state = state;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String city;
private String country;
private Map extraParams;
private String line1;
private String line2;
private String postalCode;
private String state;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentIntentData.Shipping.Address build() {
return new SessionCreateParams.PaymentIntentData.Shipping.Address(
this.city,
this.country,
this.extraParams,
this.line1,
this.line2,
this.postalCode,
this.state);
}
/** City, district, suburb, town, or village. */
public Builder setCity(String city) {
this.city = city;
return this;
}
/**
* Two-letter country code (ISO
* 3166-1 alpha-2).
*/
public Builder setCountry(String country) {
this.country = country;
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData.Shipping.Address#extraParams} for
* the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData.Shipping.Address#extraParams} for
* the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Required. Address line 1 (e.g., street, PO Box, or company name). */
public Builder setLine1(String line1) {
this.line1 = line1;
return this;
}
/** Address line 2 (e.g., apartment, suite, unit, or building). */
public Builder setLine2(String line2) {
this.line2 = line2;
return this;
}
/** ZIP or postal code. */
public Builder setPostalCode(String postalCode) {
this.postalCode = postalCode;
return this;
}
/** State, county, province, or region. */
public Builder setState(String state) {
this.state = state;
return this;
}
}
}
}
@Getter
public static class TransferData {
/** The amount that will be transferred automatically when a charge succeeds. */
@SerializedName("amount")
Long amount;
/**
* Required. If specified, successful charges will be attributed to the
* destination account for tax reporting, and the funds from charges will be transferred to
* the destination account. The ID of the resulting transfer will be returned on the
* successful charge's {@code transfer} field.
*/
@SerializedName("destination")
String destination;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
private TransferData(Long amount, String destination, Map extraParams) {
this.amount = amount;
this.destination = destination;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long amount;
private String destination;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentIntentData.TransferData build() {
return new SessionCreateParams.PaymentIntentData.TransferData(
this.amount, this.destination, this.extraParams);
}
/** The amount that will be transferred automatically when a charge succeeds. */
public Builder setAmount(Long amount) {
this.amount = amount;
return this;
}
/**
* Required. If specified, successful charges will be attributed to the
* destination account for tax reporting, and the funds from charges will be transferred to
* the destination account. The ID of the resulting transfer will be returned on the
* successful charge's {@code transfer} field.
*/
public Builder setDestination(String destination) {
this.destination = destination;
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData.TransferData#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentIntentData.TransferData#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
}
public enum CaptureMethod implements ApiRequestParams.EnumParam {
@SerializedName("automatic")
AUTOMATIC("automatic"),
@SerializedName("automatic_async")
AUTOMATIC_ASYNC("automatic_async"),
@SerializedName("manual")
MANUAL("manual");
@Getter(onMethod_ = {@Override})
private final String value;
CaptureMethod(String value) {
this.value = value;
}
}
public enum SetupFutureUsage implements ApiRequestParams.EnumParam {
@SerializedName("off_session")
OFF_SESSION("off_session"),
@SerializedName("on_session")
ON_SESSION("on_session");
@Getter(onMethod_ = {@Override})
private final String value;
SetupFutureUsage(String value) {
this.value = value;
}
}
}
@Getter
public static class PaymentMethodData {
/**
* Allow redisplay will be set on the payment method on confirmation and indicates whether this
* payment method can be shown again to the customer in a checkout flow. Only set this field if
* you wish to override the allow_redisplay value determined by Checkout.
*/
@SerializedName("allow_redisplay")
AllowRedisplay allowRedisplay;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
private PaymentMethodData(AllowRedisplay allowRedisplay, Map extraParams) {
this.allowRedisplay = allowRedisplay;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private AllowRedisplay allowRedisplay;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodData build() {
return new SessionCreateParams.PaymentMethodData(this.allowRedisplay, this.extraParams);
}
/**
* Allow redisplay will be set on the payment method on confirmation and indicates whether
* this payment method can be shown again to the customer in a checkout flow. Only set this
* field if you wish to override the allow_redisplay value determined by Checkout.
*/
public Builder setAllowRedisplay(
SessionCreateParams.PaymentMethodData.AllowRedisplay allowRedisplay) {
this.allowRedisplay = allowRedisplay;
return this;
}
/**
* 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 {@link
* SessionCreateParams.PaymentMethodData#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodData#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
public enum AllowRedisplay implements ApiRequestParams.EnumParam {
@SerializedName("always")
ALWAYS("always"),
@SerializedName("limited")
LIMITED("limited"),
@SerializedName("unspecified")
UNSPECIFIED("unspecified");
@Getter(onMethod_ = {@Override})
private final String value;
AllowRedisplay(String value) {
this.value = value;
}
}
}
@Getter
public static class PaymentMethodOptions {
/** contains details about the ACSS Debit payment method options. */
@SerializedName("acss_debit")
AcssDebit acssDebit;
/** contains details about the Affirm payment method options. */
@SerializedName("affirm")
Affirm affirm;
/** contains details about the Afterpay Clearpay payment method options. */
@SerializedName("afterpay_clearpay")
AfterpayClearpay afterpayClearpay;
/** contains details about the Alipay payment method options. */
@SerializedName("alipay")
Alipay alipay;
/** contains details about the AmazonPay payment method options. */
@SerializedName("amazon_pay")
AmazonPay amazonPay;
/** contains details about the AU Becs Debit payment method options. */
@SerializedName("au_becs_debit")
AuBecsDebit auBecsDebit;
/** contains details about the Bacs Debit payment method options. */
@SerializedName("bacs_debit")
BacsDebit bacsDebit;
/** contains details about the Bancontact payment method options. */
@SerializedName("bancontact")
Bancontact bancontact;
/** contains details about the Boleto payment method options. */
@SerializedName("boleto")
Boleto boleto;
/** contains details about the Card payment method options. */
@SerializedName("card")
Card card;
/** contains details about the Cashapp Pay payment method options. */
@SerializedName("cashapp")
Cashapp cashapp;
/** contains details about the Customer Balance payment method options. */
@SerializedName("customer_balance")
CustomerBalance customerBalance;
/** contains details about the EPS payment method options. */
@SerializedName("eps")
Eps eps;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** contains details about the FPX payment method options. */
@SerializedName("fpx")
Fpx fpx;
/** contains details about the Giropay payment method options. */
@SerializedName("giropay")
Giropay giropay;
/** contains details about the Grabpay payment method options. */
@SerializedName("grabpay")
Grabpay grabpay;
/** contains details about the Ideal payment method options. */
@SerializedName("ideal")
Ideal ideal;
/** contains details about the Klarna payment method options. */
@SerializedName("klarna")
Klarna klarna;
/** contains details about the Konbini payment method options. */
@SerializedName("konbini")
Konbini konbini;
/** contains details about the Link payment method options. */
@SerializedName("link")
Link link;
/** contains details about the Mobilepay payment method options. */
@SerializedName("mobilepay")
Mobilepay mobilepay;
/** contains details about the Multibanco payment method options. */
@SerializedName("multibanco")
Multibanco multibanco;
/** contains details about the OXXO payment method options. */
@SerializedName("oxxo")
Oxxo oxxo;
/** contains details about the P24 payment method options. */
@SerializedName("p24")
P24 p24;
/** contains details about the PayNow payment method options. */
@SerializedName("paynow")
Paynow paynow;
/** contains details about the PayPal payment method options. */
@SerializedName("paypal")
Paypal paypal;
/** contains details about the Pix payment method options. */
@SerializedName("pix")
Pix pix;
/** contains details about the RevolutPay payment method options. */
@SerializedName("revolut_pay")
RevolutPay revolutPay;
/** contains details about the Sepa Debit payment method options. */
@SerializedName("sepa_debit")
SepaDebit sepaDebit;
/** contains details about the Sofort payment method options. */
@SerializedName("sofort")
Sofort sofort;
/** contains details about the Swish payment method options. */
@SerializedName("swish")
Swish swish;
/** contains details about the Us Bank Account payment method options. */
@SerializedName("us_bank_account")
UsBankAccount usBankAccount;
/** contains details about the WeChat Pay payment method options. */
@SerializedName("wechat_pay")
WechatPay wechatPay;
private PaymentMethodOptions(
AcssDebit acssDebit,
Affirm affirm,
AfterpayClearpay afterpayClearpay,
Alipay alipay,
AmazonPay amazonPay,
AuBecsDebit auBecsDebit,
BacsDebit bacsDebit,
Bancontact bancontact,
Boleto boleto,
Card card,
Cashapp cashapp,
CustomerBalance customerBalance,
Eps eps,
Map extraParams,
Fpx fpx,
Giropay giropay,
Grabpay grabpay,
Ideal ideal,
Klarna klarna,
Konbini konbini,
Link link,
Mobilepay mobilepay,
Multibanco multibanco,
Oxxo oxxo,
P24 p24,
Paynow paynow,
Paypal paypal,
Pix pix,
RevolutPay revolutPay,
SepaDebit sepaDebit,
Sofort sofort,
Swish swish,
UsBankAccount usBankAccount,
WechatPay wechatPay) {
this.acssDebit = acssDebit;
this.affirm = affirm;
this.afterpayClearpay = afterpayClearpay;
this.alipay = alipay;
this.amazonPay = amazonPay;
this.auBecsDebit = auBecsDebit;
this.bacsDebit = bacsDebit;
this.bancontact = bancontact;
this.boleto = boleto;
this.card = card;
this.cashapp = cashapp;
this.customerBalance = customerBalance;
this.eps = eps;
this.extraParams = extraParams;
this.fpx = fpx;
this.giropay = giropay;
this.grabpay = grabpay;
this.ideal = ideal;
this.klarna = klarna;
this.konbini = konbini;
this.link = link;
this.mobilepay = mobilepay;
this.multibanco = multibanco;
this.oxxo = oxxo;
this.p24 = p24;
this.paynow = paynow;
this.paypal = paypal;
this.pix = pix;
this.revolutPay = revolutPay;
this.sepaDebit = sepaDebit;
this.sofort = sofort;
this.swish = swish;
this.usBankAccount = usBankAccount;
this.wechatPay = wechatPay;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private AcssDebit acssDebit;
private Affirm affirm;
private AfterpayClearpay afterpayClearpay;
private Alipay alipay;
private AmazonPay amazonPay;
private AuBecsDebit auBecsDebit;
private BacsDebit bacsDebit;
private Bancontact bancontact;
private Boleto boleto;
private Card card;
private Cashapp cashapp;
private CustomerBalance customerBalance;
private Eps eps;
private Map extraParams;
private Fpx fpx;
private Giropay giropay;
private Grabpay grabpay;
private Ideal ideal;
private Klarna klarna;
private Konbini konbini;
private Link link;
private Mobilepay mobilepay;
private Multibanco multibanco;
private Oxxo oxxo;
private P24 p24;
private Paynow paynow;
private Paypal paypal;
private Pix pix;
private RevolutPay revolutPay;
private SepaDebit sepaDebit;
private Sofort sofort;
private Swish swish;
private UsBankAccount usBankAccount;
private WechatPay wechatPay;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodOptions build() {
return new SessionCreateParams.PaymentMethodOptions(
this.acssDebit,
this.affirm,
this.afterpayClearpay,
this.alipay,
this.amazonPay,
this.auBecsDebit,
this.bacsDebit,
this.bancontact,
this.boleto,
this.card,
this.cashapp,
this.customerBalance,
this.eps,
this.extraParams,
this.fpx,
this.giropay,
this.grabpay,
this.ideal,
this.klarna,
this.konbini,
this.link,
this.mobilepay,
this.multibanco,
this.oxxo,
this.p24,
this.paynow,
this.paypal,
this.pix,
this.revolutPay,
this.sepaDebit,
this.sofort,
this.swish,
this.usBankAccount,
this.wechatPay);
}
/** contains details about the ACSS Debit payment method options. */
public Builder setAcssDebit(SessionCreateParams.PaymentMethodOptions.AcssDebit acssDebit) {
this.acssDebit = acssDebit;
return this;
}
/** contains details about the Affirm payment method options. */
public Builder setAffirm(SessionCreateParams.PaymentMethodOptions.Affirm affirm) {
this.affirm = affirm;
return this;
}
/** contains details about the Afterpay Clearpay payment method options. */
public Builder setAfterpayClearpay(
SessionCreateParams.PaymentMethodOptions.AfterpayClearpay afterpayClearpay) {
this.afterpayClearpay = afterpayClearpay;
return this;
}
/** contains details about the Alipay payment method options. */
public Builder setAlipay(SessionCreateParams.PaymentMethodOptions.Alipay alipay) {
this.alipay = alipay;
return this;
}
/** contains details about the AmazonPay payment method options. */
public Builder setAmazonPay(SessionCreateParams.PaymentMethodOptions.AmazonPay amazonPay) {
this.amazonPay = amazonPay;
return this;
}
/** contains details about the AU Becs Debit payment method options. */
public Builder setAuBecsDebit(
SessionCreateParams.PaymentMethodOptions.AuBecsDebit auBecsDebit) {
this.auBecsDebit = auBecsDebit;
return this;
}
/** contains details about the Bacs Debit payment method options. */
public Builder setBacsDebit(SessionCreateParams.PaymentMethodOptions.BacsDebit bacsDebit) {
this.bacsDebit = bacsDebit;
return this;
}
/** contains details about the Bancontact payment method options. */
public Builder setBancontact(SessionCreateParams.PaymentMethodOptions.Bancontact bancontact) {
this.bancontact = bancontact;
return this;
}
/** contains details about the Boleto payment method options. */
public Builder setBoleto(SessionCreateParams.PaymentMethodOptions.Boleto boleto) {
this.boleto = boleto;
return this;
}
/** contains details about the Card payment method options. */
public Builder setCard(SessionCreateParams.PaymentMethodOptions.Card card) {
this.card = card;
return this;
}
/** contains details about the Cashapp Pay payment method options. */
public Builder setCashapp(SessionCreateParams.PaymentMethodOptions.Cashapp cashapp) {
this.cashapp = cashapp;
return this;
}
/** contains details about the Customer Balance payment method options. */
public Builder setCustomerBalance(
SessionCreateParams.PaymentMethodOptions.CustomerBalance customerBalance) {
this.customerBalance = customerBalance;
return this;
}
/** contains details about the EPS payment method options. */
public Builder setEps(SessionCreateParams.PaymentMethodOptions.Eps eps) {
this.eps = eps;
return this;
}
/**
* 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 {@link
* SessionCreateParams.PaymentMethodOptions#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** contains details about the FPX payment method options. */
public Builder setFpx(SessionCreateParams.PaymentMethodOptions.Fpx fpx) {
this.fpx = fpx;
return this;
}
/** contains details about the Giropay payment method options. */
public Builder setGiropay(SessionCreateParams.PaymentMethodOptions.Giropay giropay) {
this.giropay = giropay;
return this;
}
/** contains details about the Grabpay payment method options. */
public Builder setGrabpay(SessionCreateParams.PaymentMethodOptions.Grabpay grabpay) {
this.grabpay = grabpay;
return this;
}
/** contains details about the Ideal payment method options. */
public Builder setIdeal(SessionCreateParams.PaymentMethodOptions.Ideal ideal) {
this.ideal = ideal;
return this;
}
/** contains details about the Klarna payment method options. */
public Builder setKlarna(SessionCreateParams.PaymentMethodOptions.Klarna klarna) {
this.klarna = klarna;
return this;
}
/** contains details about the Konbini payment method options. */
public Builder setKonbini(SessionCreateParams.PaymentMethodOptions.Konbini konbini) {
this.konbini = konbini;
return this;
}
/** contains details about the Link payment method options. */
public Builder setLink(SessionCreateParams.PaymentMethodOptions.Link link) {
this.link = link;
return this;
}
/** contains details about the Mobilepay payment method options. */
public Builder setMobilepay(SessionCreateParams.PaymentMethodOptions.Mobilepay mobilepay) {
this.mobilepay = mobilepay;
return this;
}
/** contains details about the Multibanco payment method options. */
public Builder setMultibanco(SessionCreateParams.PaymentMethodOptions.Multibanco multibanco) {
this.multibanco = multibanco;
return this;
}
/** contains details about the OXXO payment method options. */
public Builder setOxxo(SessionCreateParams.PaymentMethodOptions.Oxxo oxxo) {
this.oxxo = oxxo;
return this;
}
/** contains details about the P24 payment method options. */
public Builder setP24(SessionCreateParams.PaymentMethodOptions.P24 p24) {
this.p24 = p24;
return this;
}
/** contains details about the PayNow payment method options. */
public Builder setPaynow(SessionCreateParams.PaymentMethodOptions.Paynow paynow) {
this.paynow = paynow;
return this;
}
/** contains details about the PayPal payment method options. */
public Builder setPaypal(SessionCreateParams.PaymentMethodOptions.Paypal paypal) {
this.paypal = paypal;
return this;
}
/** contains details about the Pix payment method options. */
public Builder setPix(SessionCreateParams.PaymentMethodOptions.Pix pix) {
this.pix = pix;
return this;
}
/** contains details about the RevolutPay payment method options. */
public Builder setRevolutPay(SessionCreateParams.PaymentMethodOptions.RevolutPay revolutPay) {
this.revolutPay = revolutPay;
return this;
}
/** contains details about the Sepa Debit payment method options. */
public Builder setSepaDebit(SessionCreateParams.PaymentMethodOptions.SepaDebit sepaDebit) {
this.sepaDebit = sepaDebit;
return this;
}
/** contains details about the Sofort payment method options. */
public Builder setSofort(SessionCreateParams.PaymentMethodOptions.Sofort sofort) {
this.sofort = sofort;
return this;
}
/** contains details about the Swish payment method options. */
public Builder setSwish(SessionCreateParams.PaymentMethodOptions.Swish swish) {
this.swish = swish;
return this;
}
/** contains details about the Us Bank Account payment method options. */
public Builder setUsBankAccount(
SessionCreateParams.PaymentMethodOptions.UsBankAccount usBankAccount) {
this.usBankAccount = usBankAccount;
return this;
}
/** contains details about the WeChat Pay payment method options. */
public Builder setWechatPay(SessionCreateParams.PaymentMethodOptions.WechatPay wechatPay) {
this.wechatPay = wechatPay;
return this;
}
}
@Getter
public static class AcssDebit {
/**
* Three-letter ISO currency
* code, in lowercase. Must be a supported
* currency. This is only accepted for Checkout Sessions in {@code setup} mode.
*/
@SerializedName("currency")
Currency currency;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/** Additional fields for Mandate creation. */
@SerializedName("mandate_options")
MandateOptions mandateOptions;
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the
* Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe creates
* and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you comply
* with regional legislation and network rules, such as SCA.
*/
@SerializedName("setup_future_usage")
SetupFutureUsage setupFutureUsage;
/** Verification method for the intent. */
@SerializedName("verification_method")
VerificationMethod verificationMethod;
private AcssDebit(
Currency currency,
Map extraParams,
MandateOptions mandateOptions,
SetupFutureUsage setupFutureUsage,
VerificationMethod verificationMethod) {
this.currency = currency;
this.extraParams = extraParams;
this.mandateOptions = mandateOptions;
this.setupFutureUsage = setupFutureUsage;
this.verificationMethod = verificationMethod;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Currency currency;
private Map extraParams;
private MandateOptions mandateOptions;
private SetupFutureUsage setupFutureUsage;
private VerificationMethod verificationMethod;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodOptions.AcssDebit build() {
return new SessionCreateParams.PaymentMethodOptions.AcssDebit(
this.currency,
this.extraParams,
this.mandateOptions,
this.setupFutureUsage,
this.verificationMethod);
}
/**
* Three-letter ISO currency
* code, in lowercase. Must be a supported
* currency. This is only accepted for Checkout Sessions in {@code setup} mode.
*/
public Builder setCurrency(
SessionCreateParams.PaymentMethodOptions.AcssDebit.Currency currency) {
this.currency = currency;
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.AcssDebit#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.AcssDebit#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Additional fields for Mandate creation. */
public Builder setMandateOptions(
SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions mandateOptions) {
this.mandateOptions = mandateOptions;
return this;
}
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment
* method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to
* the Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe
* creates and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you
* comply with regional legislation and network rules, such as SCA.
*/
public Builder setSetupFutureUsage(
SessionCreateParams.PaymentMethodOptions.AcssDebit.SetupFutureUsage setupFutureUsage) {
this.setupFutureUsage = setupFutureUsage;
return this;
}
/** Verification method for the intent. */
public Builder setVerificationMethod(
SessionCreateParams.PaymentMethodOptions.AcssDebit.VerificationMethod
verificationMethod) {
this.verificationMethod = verificationMethod;
return this;
}
}
@Getter
public static class MandateOptions {
/**
* A URL for custom mandate text to render during confirmation step. The URL will be
* rendered with additional GET parameters {@code payment_intent} and {@code
* payment_intent_client_secret} when confirming a Payment Intent, or {@code setup_intent}
* and {@code setup_intent_client_secret} when confirming a Setup Intent.
*/
@SerializedName("custom_mandate_url")
Object customMandateUrl;
/**
* List of Stripe products where this mandate can be selected automatically. Only usable in
* {@code setup} mode.
*/
@SerializedName("default_for")
List
defaultFor;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Description of the mandate interval. Only required if 'payment_schedule' parameter is
* 'interval' or 'combined'.
*/
@SerializedName("interval_description")
String intervalDescription;
/** Payment schedule for the mandate. */
@SerializedName("payment_schedule")
PaymentSchedule paymentSchedule;
/** Transaction type of the mandate. */
@SerializedName("transaction_type")
TransactionType transactionType;
private MandateOptions(
Object customMandateUrl,
List
defaultFor,
Map extraParams,
String intervalDescription,
PaymentSchedule paymentSchedule,
TransactionType transactionType) {
this.customMandateUrl = customMandateUrl;
this.defaultFor = defaultFor;
this.extraParams = extraParams;
this.intervalDescription = intervalDescription;
this.paymentSchedule = paymentSchedule;
this.transactionType = transactionType;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Object customMandateUrl;
private List
defaultFor;
private Map extraParams;
private String intervalDescription;
private PaymentSchedule paymentSchedule;
private TransactionType transactionType;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions build() {
return new SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions(
this.customMandateUrl,
this.defaultFor,
this.extraParams,
this.intervalDescription,
this.paymentSchedule,
this.transactionType);
}
/**
* A URL for custom mandate text to render during confirmation step. The URL will be
* rendered with additional GET parameters {@code payment_intent} and {@code
* payment_intent_client_secret} when confirming a Payment Intent, or {@code setup_intent}
* and {@code setup_intent_client_secret} when confirming a Setup Intent.
*/
public Builder setCustomMandateUrl(String customMandateUrl) {
this.customMandateUrl = customMandateUrl;
return this;
}
/**
* A URL for custom mandate text to render during confirmation step. The URL will be
* rendered with additional GET parameters {@code payment_intent} and {@code
* payment_intent_client_secret} when confirming a Payment Intent, or {@code setup_intent}
* and {@code setup_intent_client_secret} when confirming a Setup Intent.
*/
public Builder setCustomMandateUrl(EmptyParam customMandateUrl) {
this.customMandateUrl = customMandateUrl;
return this;
}
/**
* Add an element to `defaultFor` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions#defaultFor} for the
* field documentation.
*/
public Builder addDefaultFor(
SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions.DefaultFor
element) {
if (this.defaultFor == null) {
this.defaultFor = new ArrayList<>();
}
this.defaultFor.add(element);
return this;
}
/**
* Add all elements to `defaultFor` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions#defaultFor} for the
* field documentation.
*/
public Builder addAllDefaultFor(
List
elements) {
if (this.defaultFor == null) {
this.defaultFor = new ArrayList<>();
}
this.defaultFor.addAll(elements);
return this;
}
/**
* 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 {@link
* SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link
* SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Description of the mandate interval. Only required if 'payment_schedule' parameter is
* 'interval' or 'combined'.
*/
public Builder setIntervalDescription(String intervalDescription) {
this.intervalDescription = intervalDescription;
return this;
}
/** Payment schedule for the mandate. */
public Builder setPaymentSchedule(
SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions.PaymentSchedule
paymentSchedule) {
this.paymentSchedule = paymentSchedule;
return this;
}
/** Transaction type of the mandate. */
public Builder setTransactionType(
SessionCreateParams.PaymentMethodOptions.AcssDebit.MandateOptions.TransactionType
transactionType) {
this.transactionType = transactionType;
return this;
}
}
public enum DefaultFor implements ApiRequestParams.EnumParam {
@SerializedName("invoice")
INVOICE("invoice"),
@SerializedName("subscription")
SUBSCRIPTION("subscription");
@Getter(onMethod_ = {@Override})
private final String value;
DefaultFor(String value) {
this.value = value;
}
}
public enum PaymentSchedule implements ApiRequestParams.EnumParam {
@SerializedName("combined")
COMBINED("combined"),
@SerializedName("interval")
INTERVAL("interval"),
@SerializedName("sporadic")
SPORADIC("sporadic");
@Getter(onMethod_ = {@Override})
private final String value;
PaymentSchedule(String value) {
this.value = value;
}
}
public enum TransactionType implements ApiRequestParams.EnumParam {
@SerializedName("business")
BUSINESS("business"),
@SerializedName("personal")
PERSONAL("personal");
@Getter(onMethod_ = {@Override})
private final String value;
TransactionType(String value) {
this.value = value;
}
}
}
public enum Currency implements ApiRequestParams.EnumParam {
@SerializedName("cad")
CAD("cad"),
@SerializedName("usd")
USD("usd");
@Getter(onMethod_ = {@Override})
private final String value;
Currency(String value) {
this.value = value;
}
}
public enum SetupFutureUsage implements ApiRequestParams.EnumParam {
@SerializedName("none")
NONE("none"),
@SerializedName("off_session")
OFF_SESSION("off_session"),
@SerializedName("on_session")
ON_SESSION("on_session");
@Getter(onMethod_ = {@Override})
private final String value;
SetupFutureUsage(String value) {
this.value = value;
}
}
public enum VerificationMethod implements ApiRequestParams.EnumParam {
@SerializedName("automatic")
AUTOMATIC("automatic"),
@SerializedName("instant")
INSTANT("instant"),
@SerializedName("microdeposits")
MICRODEPOSITS("microdeposits");
@Getter(onMethod_ = {@Override})
private final String value;
VerificationMethod(String value) {
this.value = value;
}
}
}
@Getter
public static class Affirm {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the
* Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe creates
* and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you comply
* with regional legislation and network rules, such as SCA.
*/
@SerializedName("setup_future_usage")
SetupFutureUsage setupFutureUsage;
private Affirm(Map extraParams, SetupFutureUsage setupFutureUsage) {
this.extraParams = extraParams;
this.setupFutureUsage = setupFutureUsage;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private SetupFutureUsage setupFutureUsage;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodOptions.Affirm build() {
return new SessionCreateParams.PaymentMethodOptions.Affirm(
this.extraParams, this.setupFutureUsage);
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.Affirm#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.Affirm#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment
* method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to
* the Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe
* creates and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you
* comply with regional legislation and network rules, such as SCA.
*/
public Builder setSetupFutureUsage(
SessionCreateParams.PaymentMethodOptions.Affirm.SetupFutureUsage setupFutureUsage) {
this.setupFutureUsage = setupFutureUsage;
return this;
}
}
public enum SetupFutureUsage implements ApiRequestParams.EnumParam {
@SerializedName("none")
NONE("none");
@Getter(onMethod_ = {@Override})
private final String value;
SetupFutureUsage(String value) {
this.value = value;
}
}
}
@Getter
public static class AfterpayClearpay {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the
* Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe creates
* and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you comply
* with regional legislation and network rules, such as SCA.
*/
@SerializedName("setup_future_usage")
SetupFutureUsage setupFutureUsage;
private AfterpayClearpay(Map extraParams, SetupFutureUsage setupFutureUsage) {
this.extraParams = extraParams;
this.setupFutureUsage = setupFutureUsage;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private SetupFutureUsage setupFutureUsage;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodOptions.AfterpayClearpay build() {
return new SessionCreateParams.PaymentMethodOptions.AfterpayClearpay(
this.extraParams, this.setupFutureUsage);
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.AfterpayClearpay#extraParams}
* for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.AfterpayClearpay#extraParams}
* for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment
* method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to
* the Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe
* creates and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you
* comply with regional legislation and network rules, such as SCA.
*/
public Builder setSetupFutureUsage(
SessionCreateParams.PaymentMethodOptions.AfterpayClearpay.SetupFutureUsage
setupFutureUsage) {
this.setupFutureUsage = setupFutureUsage;
return this;
}
}
public enum SetupFutureUsage implements ApiRequestParams.EnumParam {
@SerializedName("none")
NONE("none");
@Getter(onMethod_ = {@Override})
private final String value;
SetupFutureUsage(String value) {
this.value = value;
}
}
}
@Getter
public static class Alipay {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Indicates that you intend to make future payments with this PaymentIntent's payment method.
*
* If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the
* Customer after the PaymentIntent is confirmed and the customer completes any required
* actions. If you don't provide a Customer, you can still attach the payment method to a
* Customer after the transaction completes.
*
*
If the payment method is {@code card_present} and isn't a digital wallet, Stripe creates
* and attaches a generated_card
* payment method representing the card to the Customer instead.
*
*
When processing card payments, Stripe uses {@code setup_future_usage} to help you comply
* with regional legislation and network rules, such as SCA.
*/
@SerializedName("setup_future_usage")
SetupFutureUsage setupFutureUsage;
private Alipay(Map extraParams, SetupFutureUsage setupFutureUsage) {
this.extraParams = extraParams;
this.setupFutureUsage = setupFutureUsage;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private SetupFutureUsage setupFutureUsage;
/** Finalize and obtain parameter instance from this builder. */
public SessionCreateParams.PaymentMethodOptions.Alipay build() {
return new SessionCreateParams.PaymentMethodOptions.Alipay(
this.extraParams, this.setupFutureUsage);
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.Alipay#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* 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 {@link SessionCreateParams.PaymentMethodOptions.Alipay#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map