diff --git a/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java b/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java index 113acca8a2b..42556cd9b1e 100644 --- a/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java @@ -60,6 +60,15 @@ public class PaymentIntentConfirmParams extends ApiRequestParams { @SerializedName("payment_method") String paymentMethod; + /** + * If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will + * appear in the payment_method + * property on the PaymentIntent. + */ + @SerializedName("payment_method_data") + PaymentMethodData paymentMethodData; + /** Payment-method-specific configuration for this PaymentIntent. */ @SerializedName("payment_method_options") PaymentMethodOptions paymentMethodOptions; @@ -144,6 +153,7 @@ private PaymentIntentConfirmParams( Object mandateData, Object offSession, String paymentMethod, + PaymentMethodData paymentMethodData, PaymentMethodOptions paymentMethodOptions, Object receiptEmail, String returnUrl, @@ -159,6 +169,7 @@ private PaymentIntentConfirmParams( this.mandateData = mandateData; this.offSession = offSession; this.paymentMethod = paymentMethod; + this.paymentMethodData = paymentMethodData; this.paymentMethodOptions = paymentMethodOptions; this.receiptEmail = receiptEmail; this.returnUrl = returnUrl; @@ -188,6 +199,8 @@ public static class Builder { private String paymentMethod; + private PaymentMethodData paymentMethodData; + private PaymentMethodOptions paymentMethodOptions; private Object receiptEmail; @@ -214,6 +227,7 @@ public PaymentIntentConfirmParams build() { this.mandateData, this.offSession, this.paymentMethod, + this.paymentMethodData, this.paymentMethodOptions, this.receiptEmail, this.returnUrl, @@ -332,6 +346,17 @@ public Builder setPaymentMethod(String paymentMethod) { return this; } + /** + * If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will + * appear in the payment_method + * property on the PaymentIntent. + */ + public Builder setPaymentMethodData(PaymentMethodData paymentMethodData) { + this.paymentMethodData = paymentMethodData; + return this; + } + /** Payment-method-specific configuration for this PaymentIntent. */ public Builder setPaymentMethodOptions(PaymentMethodOptions paymentMethodOptions) { this.paymentMethodOptions = paymentMethodOptions; @@ -823,6 +848,1189 @@ public enum Type implements ApiRequestParams.EnumParam { } } + @Getter + public static class PaymentMethodData { + /** + * If this is an {@code au_becs_debit} PaymentMethod, this hash contains details about the bank + * account. + */ + @SerializedName("au_becs_debit") + AuBecsDebit auBecsDebit; + + /** + * Billing information associated with the PaymentMethod that may be used or required by + * particular types of payment methods. + */ + @SerializedName("billing_details") + BillingDetails billingDetails; + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + @SerializedName("card") + Object card; + + /** + * 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; + + /** + * If this is an {@code fpx} PaymentMethod, this hash contains details about the FPX payment + * method. + */ + @SerializedName("fpx") + Fpx fpx; + + /** + * If this is an {@code ideal} PaymentMethod, this hash contains details about the iDEAL payment + * method. + */ + @SerializedName("ideal") + Ideal ideal; + + /** + * 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; + + /** + * If this is a {@code sepa_debit} PaymentMethod, this hash contains details about the SEPA + * debit bank account. + */ + @SerializedName("sepa_debit") + SepaDebit sepaDebit; + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a + * name matching this value. It contains additional information specific to the PaymentMethod + * type. + */ + @SerializedName("type") + Type type; + + private PaymentMethodData( + AuBecsDebit auBecsDebit, + BillingDetails billingDetails, + Object card, + Map extraParams, + Fpx fpx, + Ideal ideal, + Map metadata, + SepaDebit sepaDebit, + Type type) { + this.auBecsDebit = auBecsDebit; + this.billingDetails = billingDetails; + this.card = card; + this.extraParams = extraParams; + this.fpx = fpx; + this.ideal = ideal; + this.metadata = metadata; + this.sepaDebit = sepaDebit; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private AuBecsDebit auBecsDebit; + + private BillingDetails billingDetails; + + private Object card; + + private Map extraParams; + + private Fpx fpx; + + private Ideal ideal; + + private Map metadata; + + private SepaDebit sepaDebit; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentMethodData build() { + return new PaymentMethodData( + this.auBecsDebit, + this.billingDetails, + this.card, + this.extraParams, + this.fpx, + this.ideal, + this.metadata, + this.sepaDebit, + this.type); + } + + /** + * If this is an {@code au_becs_debit} PaymentMethod, this hash contains details about the + * bank account. + */ + public Builder setAuBecsDebit(AuBecsDebit auBecsDebit) { + this.auBecsDebit = auBecsDebit; + return this; + } + + /** + * Billing information associated with the PaymentMethod that may be used or required by + * particular types of payment methods. + */ + public Builder setBillingDetails(BillingDetails billingDetails) { + this.billingDetails = billingDetails; + return this; + } + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + public Builder setCard(CardDetails card) { + this.card = card; + return this; + } + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + public Builder setCard(Token card) { + this.card = card; + 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 + * PaymentIntentConfirmParams.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 PaymentIntentConfirmParams.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; + } + + /** + * If this is an {@code fpx} PaymentMethod, this hash contains details about the FPX payment + * method. + */ + public Builder setFpx(Fpx fpx) { + this.fpx = fpx; + return this; + } + + /** + * If this is an {@code ideal} PaymentMethod, this hash contains details about the iDEAL + * payment method. + */ + public Builder setIdeal(Ideal ideal) { + this.ideal = ideal; + 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 + * PaymentIntentConfirmParams.PaymentMethodData#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 PaymentIntentConfirmParams.PaymentMethodData#metadata} for the field + * documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** + * If this is a {@code sepa_debit} PaymentMethod, this hash contains details about the SEPA + * debit bank account. + */ + public Builder setSepaDebit(SepaDebit sepaDebit) { + this.sepaDebit = sepaDebit; + return this; + } + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a + * name matching this value. It contains additional information specific to the PaymentMethod + * type. + */ + public Builder setType(Type type) { + this.type = type; + return this; + } + } + + @Getter + public static class AuBecsDebit { + /** The account number for the bank account. */ + @SerializedName("account_number") + String accountNumber; + + /** Bank-State-Branch number of the bank account. */ + @SerializedName("bsb_number") + String bsbNumber; + + /** + * 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 AuBecsDebit(String accountNumber, String bsbNumber, Map extraParams) { + this.accountNumber = accountNumber; + this.bsbNumber = bsbNumber; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String accountNumber; + + private String bsbNumber; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AuBecsDebit build() { + return new AuBecsDebit(this.accountNumber, this.bsbNumber, this.extraParams); + } + + /** The account number for the bank account. */ + public Builder setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** Bank-State-Branch number of the bank account. */ + public Builder setBsbNumber(String bsbNumber) { + this.bsbNumber = bsbNumber; + 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 PaymentIntentConfirmParams.PaymentMethodData.AuBecsDebit#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 PaymentIntentConfirmParams.PaymentMethodData.AuBecsDebit#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 BillingDetails { + /** Billing address. */ + @SerializedName("address") + Address address; + + /** Email address. */ + @SerializedName("email") + String email; + + /** + * 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; + + /** Full name. */ + @SerializedName("name") + String name; + + /** Billing phone number (including extension). */ + @SerializedName("phone") + String phone; + + private BillingDetails( + Address address, + String email, + Map extraParams, + String name, + String phone) { + this.address = address; + this.email = email; + this.extraParams = extraParams; + this.name = name; + this.phone = phone; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Address address; + + private String email; + + private Map extraParams; + + private String name; + + private String phone; + + /** Finalize and obtain parameter instance from this builder. */ + public BillingDetails build() { + return new BillingDetails( + this.address, this.email, this.extraParams, this.name, this.phone); + } + + /** Billing address. */ + public Builder setAddress(Address address) { + this.address = address; + return this; + } + + /** Email address. */ + public Builder setEmail(String email) { + this.email = email; + 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 PaymentIntentConfirmParams.PaymentMethodData.BillingDetails#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 PaymentIntentConfirmParams.PaymentMethodData.BillingDetails#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Full name. */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** Billing phone number (including extension). */ + public Builder setPhone(String phone) { + this.phone = phone; + 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; + + /** 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 Address build() { + return new 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 + * PaymentIntentConfirmParams.PaymentMethodData.BillingDetails.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 + * PaymentIntentConfirmParams.PaymentMethodData.BillingDetails.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; + } + + /** 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 CardDetails { + /** The card's CVC. It is highly recommended to always include this value. */ + @SerializedName("cvc") + String cvc; + + /** Two-digit number representing the card's expiration month. */ + @SerializedName("exp_month") + Long expMonth; + + /** Four-digit number representing the card's expiration year. */ + @SerializedName("exp_year") + Long expYear; + + /** + * 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 card number, as a string without any separators. */ + @SerializedName("number") + String number; + + private CardDetails( + String cvc, Long expMonth, Long expYear, Map extraParams, String number) { + this.cvc = cvc; + this.expMonth = expMonth; + this.expYear = expYear; + this.extraParams = extraParams; + this.number = number; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String cvc; + + private Long expMonth; + + private Long expYear; + + private Map extraParams; + + private String number; + + /** Finalize and obtain parameter instance from this builder. */ + public CardDetails build() { + return new CardDetails( + this.cvc, this.expMonth, this.expYear, this.extraParams, this.number); + } + + /** The card's CVC. It is highly recommended to always include this value. */ + public Builder setCvc(String cvc) { + this.cvc = cvc; + return this; + } + + /** Two-digit number representing the card's expiration month. */ + public Builder setExpMonth(Long expMonth) { + this.expMonth = expMonth; + return this; + } + + /** Four-digit number representing the card's expiration year. */ + public Builder setExpYear(Long expYear) { + this.expYear = expYear; + 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 PaymentIntentConfirmParams.PaymentMethodData.CardDetails#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 PaymentIntentConfirmParams.PaymentMethodData.CardDetails#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 card number, as a string without any separators. */ + public Builder setNumber(String number) { + this.number = number; + return this; + } + } + } + + @Getter + public static class Token { + /** + * 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; + + @SerializedName("token") + String token; + + private Token(Map extraParams, String token) { + this.extraParams = extraParams; + this.token = token; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String token; + + /** Finalize and obtain parameter instance from this builder. */ + public Token build() { + return new Token(this.extraParams, this.token); + } + + /** + * 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 PaymentIntentConfirmParams.PaymentMethodData.Token#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 PaymentIntentConfirmParams.PaymentMethodData.Token#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 Builder setToken(String token) { + this.token = token; + return this; + } + } + } + + @Getter + public static class Fpx { + /** Account holder type for FPX transaction. */ + @SerializedName("account_holder_type") + AccountHolderType accountHolderType; + + /** The customer's bank. */ + @SerializedName("bank") + Bank bank; + + /** + * 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 Fpx(AccountHolderType accountHolderType, Bank bank, Map extraParams) { + this.accountHolderType = accountHolderType; + this.bank = bank; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private AccountHolderType accountHolderType; + + private Bank bank; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public Fpx build() { + return new Fpx(this.accountHolderType, this.bank, this.extraParams); + } + + /** Account holder type for FPX transaction. */ + public Builder setAccountHolderType(AccountHolderType accountHolderType) { + this.accountHolderType = accountHolderType; + return this; + } + + /** The customer's bank. */ + public Builder setBank(Bank bank) { + this.bank = bank; + 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 PaymentIntentConfirmParams.PaymentMethodData.Fpx#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 PaymentIntentConfirmParams.PaymentMethodData.Fpx#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 AccountHolderType implements ApiRequestParams.EnumParam { + @SerializedName("company") + COMPANY("company"), + + @SerializedName("individual") + INDIVIDUAL("individual"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + AccountHolderType(String value) { + this.value = value; + } + } + + public enum Bank implements ApiRequestParams.EnumParam { + @SerializedName("affin_bank") + AFFIN_BANK("affin_bank"), + + @SerializedName("alliance_bank") + ALLIANCE_BANK("alliance_bank"), + + @SerializedName("ambank") + AMBANK("ambank"), + + @SerializedName("bank_islam") + BANK_ISLAM("bank_islam"), + + @SerializedName("bank_muamalat") + BANK_MUAMALAT("bank_muamalat"), + + @SerializedName("bank_rakyat") + BANK_RAKYAT("bank_rakyat"), + + @SerializedName("bsn") + BSN("bsn"), + + @SerializedName("cimb") + CIMB("cimb"), + + @SerializedName("deutsche_bank") + DEUTSCHE_BANK("deutsche_bank"), + + @SerializedName("hong_leong_bank") + HONG_LEONG_BANK("hong_leong_bank"), + + @SerializedName("hsbc") + HSBC("hsbc"), + + @SerializedName("kfh") + KFH("kfh"), + + @SerializedName("maybank2e") + MAYBANK2E("maybank2e"), + + @SerializedName("maybank2u") + MAYBANK2U("maybank2u"), + + @SerializedName("ocbc") + OCBC("ocbc"), + + @SerializedName("pb_enterprise") + PB_ENTERPRISE("pb_enterprise"), + + @SerializedName("public_bank") + PUBLIC_BANK("public_bank"), + + @SerializedName("rhb") + RHB("rhb"), + + @SerializedName("standard_chartered") + STANDARD_CHARTERED("standard_chartered"), + + @SerializedName("uob") + UOB("uob"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Bank(String value) { + this.value = value; + } + } + } + + @Getter + public static class Ideal { + /** The customer's bank. */ + @SerializedName("bank") + Bank bank; + + /** + * 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 Ideal(Bank bank, Map extraParams) { + this.bank = bank; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Bank bank; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public Ideal build() { + return new Ideal(this.bank, this.extraParams); + } + + /** The customer's bank. */ + public Builder setBank(Bank bank) { + this.bank = bank; + 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 PaymentIntentConfirmParams.PaymentMethodData.Ideal#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 PaymentIntentConfirmParams.PaymentMethodData.Ideal#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 Bank implements ApiRequestParams.EnumParam { + @SerializedName("abn_amro") + ABN_AMRO("abn_amro"), + + @SerializedName("asn_bank") + ASN_BANK("asn_bank"), + + @SerializedName("bunq") + BUNQ("bunq"), + + @SerializedName("handelsbanken") + HANDELSBANKEN("handelsbanken"), + + @SerializedName("ing") + ING("ing"), + + @SerializedName("knab") + KNAB("knab"), + + @SerializedName("moneyou") + MONEYOU("moneyou"), + + @SerializedName("rabobank") + RABOBANK("rabobank"), + + @SerializedName("regiobank") + REGIOBANK("regiobank"), + + @SerializedName("sns_bank") + SNS_BANK("sns_bank"), + + @SerializedName("triodos_bank") + TRIODOS_BANK("triodos_bank"), + + @SerializedName("van_lanschot") + VAN_LANSCHOT("van_lanschot"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Bank(String value) { + this.value = value; + } + } + } + + @Getter + public static class SepaDebit { + /** + * 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; + + /** IBAN of the bank account. */ + @SerializedName("iban") + String iban; + + private SepaDebit(Map extraParams, String iban) { + this.extraParams = extraParams; + this.iban = iban; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String iban; + + /** Finalize and obtain parameter instance from this builder. */ + public SepaDebit build() { + return new SepaDebit(this.extraParams, this.iban); + } + + /** + * 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 PaymentIntentConfirmParams.PaymentMethodData.SepaDebit#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 PaymentIntentConfirmParams.PaymentMethodData.SepaDebit#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** IBAN of the bank account. */ + public Builder setIban(String iban) { + this.iban = iban; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("au_becs_debit") + AU_BECS_DEBIT("au_becs_debit"), + + @SerializedName("card") + CARD("card"), + + @SerializedName("card_present") + CARD_PRESENT("card_present"), + + @SerializedName("fpx") + FPX("fpx"), + + @SerializedName("ideal") + IDEAL("ideal"), + + @SerializedName("sepa_debit") + SEPA_DEBIT("sepa_debit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + @Getter public static class PaymentMethodOptions { /** Configuration for any card payments attempted on this PaymentIntent. */ diff --git a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java index b9aa4c3b03d..28c302e2037 100644 --- a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java @@ -156,6 +156,15 @@ public class PaymentIntentCreateParams extends ApiRequestParams { @SerializedName("payment_method") String paymentMethod; + /** + * If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will + * appear in the payment_method + * property on the PaymentIntent. + */ + @SerializedName("payment_method_data") + PaymentMethodData paymentMethodData; + /** Payment-method-specific configuration for this PaymentIntent. */ @SerializedName("payment_method_options") PaymentMethodOptions paymentMethodOptions; @@ -290,6 +299,7 @@ private PaymentIntentCreateParams( Object offSession, String onBehalfOf, String paymentMethod, + PaymentMethodData paymentMethodData, PaymentMethodOptions paymentMethodOptions, List paymentMethodTypes, String receiptEmail, @@ -320,6 +330,7 @@ private PaymentIntentCreateParams( this.offSession = offSession; this.onBehalfOf = onBehalfOf; this.paymentMethod = paymentMethod; + this.paymentMethodData = paymentMethodData; this.paymentMethodOptions = paymentMethodOptions; this.paymentMethodTypes = paymentMethodTypes; this.receiptEmail = receiptEmail; @@ -374,6 +385,8 @@ public static class Builder { private String paymentMethod; + private PaymentMethodData paymentMethodData; + private PaymentMethodOptions paymentMethodOptions; private List paymentMethodTypes; @@ -420,6 +433,7 @@ public PaymentIntentCreateParams build() { this.offSession, this.onBehalfOf, this.paymentMethod, + this.paymentMethodData, this.paymentMethodOptions, this.paymentMethodTypes, this.receiptEmail, @@ -681,6 +695,17 @@ public Builder setPaymentMethod(String paymentMethod) { return this; } + /** + * If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will + * appear in the payment_method + * property on the PaymentIntent. + */ + public Builder setPaymentMethodData(PaymentMethodData paymentMethodData) { + this.paymentMethodData = paymentMethodData; + return this; + } + /** Payment-method-specific configuration for this PaymentIntent. */ public Builder setPaymentMethodOptions(PaymentMethodOptions paymentMethodOptions) { this.paymentMethodOptions = paymentMethodOptions; @@ -1205,6 +1230,1189 @@ public enum Type implements ApiRequestParams.EnumParam { } } + @Getter + public static class PaymentMethodData { + /** + * If this is an {@code au_becs_debit} PaymentMethod, this hash contains details about the bank + * account. + */ + @SerializedName("au_becs_debit") + AuBecsDebit auBecsDebit; + + /** + * Billing information associated with the PaymentMethod that may be used or required by + * particular types of payment methods. + */ + @SerializedName("billing_details") + BillingDetails billingDetails; + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + @SerializedName("card") + Object card; + + /** + * 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; + + /** + * If this is an {@code fpx} PaymentMethod, this hash contains details about the FPX payment + * method. + */ + @SerializedName("fpx") + Fpx fpx; + + /** + * If this is an {@code ideal} PaymentMethod, this hash contains details about the iDEAL payment + * method. + */ + @SerializedName("ideal") + Ideal ideal; + + /** + * 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; + + /** + * If this is a {@code sepa_debit} PaymentMethod, this hash contains details about the SEPA + * debit bank account. + */ + @SerializedName("sepa_debit") + SepaDebit sepaDebit; + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a + * name matching this value. It contains additional information specific to the PaymentMethod + * type. + */ + @SerializedName("type") + Type type; + + private PaymentMethodData( + AuBecsDebit auBecsDebit, + BillingDetails billingDetails, + Object card, + Map extraParams, + Fpx fpx, + Ideal ideal, + Map metadata, + SepaDebit sepaDebit, + Type type) { + this.auBecsDebit = auBecsDebit; + this.billingDetails = billingDetails; + this.card = card; + this.extraParams = extraParams; + this.fpx = fpx; + this.ideal = ideal; + this.metadata = metadata; + this.sepaDebit = sepaDebit; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private AuBecsDebit auBecsDebit; + + private BillingDetails billingDetails; + + private Object card; + + private Map extraParams; + + private Fpx fpx; + + private Ideal ideal; + + private Map metadata; + + private SepaDebit sepaDebit; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentMethodData build() { + return new PaymentMethodData( + this.auBecsDebit, + this.billingDetails, + this.card, + this.extraParams, + this.fpx, + this.ideal, + this.metadata, + this.sepaDebit, + this.type); + } + + /** + * If this is an {@code au_becs_debit} PaymentMethod, this hash contains details about the + * bank account. + */ + public Builder setAuBecsDebit(AuBecsDebit auBecsDebit) { + this.auBecsDebit = auBecsDebit; + return this; + } + + /** + * Billing information associated with the PaymentMethod that may be used or required by + * particular types of payment methods. + */ + public Builder setBillingDetails(BillingDetails billingDetails) { + this.billingDetails = billingDetails; + return this; + } + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + public Builder setCard(CardDetails card) { + this.card = card; + return this; + } + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + public Builder setCard(Token card) { + this.card = card; + 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 + * PaymentIntentCreateParams.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 PaymentIntentCreateParams.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; + } + + /** + * If this is an {@code fpx} PaymentMethod, this hash contains details about the FPX payment + * method. + */ + public Builder setFpx(Fpx fpx) { + this.fpx = fpx; + return this; + } + + /** + * If this is an {@code ideal} PaymentMethod, this hash contains details about the iDEAL + * payment method. + */ + public Builder setIdeal(Ideal ideal) { + this.ideal = ideal; + 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 + * PaymentIntentCreateParams.PaymentMethodData#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 PaymentIntentCreateParams.PaymentMethodData#metadata} for the field + * documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** + * If this is a {@code sepa_debit} PaymentMethod, this hash contains details about the SEPA + * debit bank account. + */ + public Builder setSepaDebit(SepaDebit sepaDebit) { + this.sepaDebit = sepaDebit; + return this; + } + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a + * name matching this value. It contains additional information specific to the PaymentMethod + * type. + */ + public Builder setType(Type type) { + this.type = type; + return this; + } + } + + @Getter + public static class AuBecsDebit { + /** The account number for the bank account. */ + @SerializedName("account_number") + String accountNumber; + + /** Bank-State-Branch number of the bank account. */ + @SerializedName("bsb_number") + String bsbNumber; + + /** + * 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 AuBecsDebit(String accountNumber, String bsbNumber, Map extraParams) { + this.accountNumber = accountNumber; + this.bsbNumber = bsbNumber; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String accountNumber; + + private String bsbNumber; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AuBecsDebit build() { + return new AuBecsDebit(this.accountNumber, this.bsbNumber, this.extraParams); + } + + /** The account number for the bank account. */ + public Builder setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** Bank-State-Branch number of the bank account. */ + public Builder setBsbNumber(String bsbNumber) { + this.bsbNumber = bsbNumber; + 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 PaymentIntentCreateParams.PaymentMethodData.AuBecsDebit#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 PaymentIntentCreateParams.PaymentMethodData.AuBecsDebit#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 BillingDetails { + /** Billing address. */ + @SerializedName("address") + Address address; + + /** Email address. */ + @SerializedName("email") + String email; + + /** + * 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; + + /** Full name. */ + @SerializedName("name") + String name; + + /** Billing phone number (including extension). */ + @SerializedName("phone") + String phone; + + private BillingDetails( + Address address, + String email, + Map extraParams, + String name, + String phone) { + this.address = address; + this.email = email; + this.extraParams = extraParams; + this.name = name; + this.phone = phone; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Address address; + + private String email; + + private Map extraParams; + + private String name; + + private String phone; + + /** Finalize and obtain parameter instance from this builder. */ + public BillingDetails build() { + return new BillingDetails( + this.address, this.email, this.extraParams, this.name, this.phone); + } + + /** Billing address. */ + public Builder setAddress(Address address) { + this.address = address; + return this; + } + + /** Email address. */ + public Builder setEmail(String email) { + this.email = email; + 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 PaymentIntentCreateParams.PaymentMethodData.BillingDetails#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 PaymentIntentCreateParams.PaymentMethodData.BillingDetails#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Full name. */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** Billing phone number (including extension). */ + public Builder setPhone(String phone) { + this.phone = phone; + 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; + + /** 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 Address build() { + return new 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 + * PaymentIntentCreateParams.PaymentMethodData.BillingDetails.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 + * PaymentIntentCreateParams.PaymentMethodData.BillingDetails.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; + } + + /** 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 CardDetails { + /** The card's CVC. It is highly recommended to always include this value. */ + @SerializedName("cvc") + String cvc; + + /** Two-digit number representing the card's expiration month. */ + @SerializedName("exp_month") + Long expMonth; + + /** Four-digit number representing the card's expiration year. */ + @SerializedName("exp_year") + Long expYear; + + /** + * 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 card number, as a string without any separators. */ + @SerializedName("number") + String number; + + private CardDetails( + String cvc, Long expMonth, Long expYear, Map extraParams, String number) { + this.cvc = cvc; + this.expMonth = expMonth; + this.expYear = expYear; + this.extraParams = extraParams; + this.number = number; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String cvc; + + private Long expMonth; + + private Long expYear; + + private Map extraParams; + + private String number; + + /** Finalize and obtain parameter instance from this builder. */ + public CardDetails build() { + return new CardDetails( + this.cvc, this.expMonth, this.expYear, this.extraParams, this.number); + } + + /** The card's CVC. It is highly recommended to always include this value. */ + public Builder setCvc(String cvc) { + this.cvc = cvc; + return this; + } + + /** Two-digit number representing the card's expiration month. */ + public Builder setExpMonth(Long expMonth) { + this.expMonth = expMonth; + return this; + } + + /** Four-digit number representing the card's expiration year. */ + public Builder setExpYear(Long expYear) { + this.expYear = expYear; + 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 PaymentIntentCreateParams.PaymentMethodData.CardDetails#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 PaymentIntentCreateParams.PaymentMethodData.CardDetails#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 card number, as a string without any separators. */ + public Builder setNumber(String number) { + this.number = number; + return this; + } + } + } + + @Getter + public static class Token { + /** + * 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; + + @SerializedName("token") + String token; + + private Token(Map extraParams, String token) { + this.extraParams = extraParams; + this.token = token; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String token; + + /** Finalize and obtain parameter instance from this builder. */ + public Token build() { + return new Token(this.extraParams, this.token); + } + + /** + * 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 PaymentIntentCreateParams.PaymentMethodData.Token#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 PaymentIntentCreateParams.PaymentMethodData.Token#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 Builder setToken(String token) { + this.token = token; + return this; + } + } + } + + @Getter + public static class Fpx { + /** Account holder type for FPX transaction. */ + @SerializedName("account_holder_type") + AccountHolderType accountHolderType; + + /** The customer's bank. */ + @SerializedName("bank") + Bank bank; + + /** + * 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 Fpx(AccountHolderType accountHolderType, Bank bank, Map extraParams) { + this.accountHolderType = accountHolderType; + this.bank = bank; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private AccountHolderType accountHolderType; + + private Bank bank; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public Fpx build() { + return new Fpx(this.accountHolderType, this.bank, this.extraParams); + } + + /** Account holder type for FPX transaction. */ + public Builder setAccountHolderType(AccountHolderType accountHolderType) { + this.accountHolderType = accountHolderType; + return this; + } + + /** The customer's bank. */ + public Builder setBank(Bank bank) { + this.bank = bank; + 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 PaymentIntentCreateParams.PaymentMethodData.Fpx#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 PaymentIntentCreateParams.PaymentMethodData.Fpx#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 AccountHolderType implements ApiRequestParams.EnumParam { + @SerializedName("company") + COMPANY("company"), + + @SerializedName("individual") + INDIVIDUAL("individual"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + AccountHolderType(String value) { + this.value = value; + } + } + + public enum Bank implements ApiRequestParams.EnumParam { + @SerializedName("affin_bank") + AFFIN_BANK("affin_bank"), + + @SerializedName("alliance_bank") + ALLIANCE_BANK("alliance_bank"), + + @SerializedName("ambank") + AMBANK("ambank"), + + @SerializedName("bank_islam") + BANK_ISLAM("bank_islam"), + + @SerializedName("bank_muamalat") + BANK_MUAMALAT("bank_muamalat"), + + @SerializedName("bank_rakyat") + BANK_RAKYAT("bank_rakyat"), + + @SerializedName("bsn") + BSN("bsn"), + + @SerializedName("cimb") + CIMB("cimb"), + + @SerializedName("deutsche_bank") + DEUTSCHE_BANK("deutsche_bank"), + + @SerializedName("hong_leong_bank") + HONG_LEONG_BANK("hong_leong_bank"), + + @SerializedName("hsbc") + HSBC("hsbc"), + + @SerializedName("kfh") + KFH("kfh"), + + @SerializedName("maybank2e") + MAYBANK2E("maybank2e"), + + @SerializedName("maybank2u") + MAYBANK2U("maybank2u"), + + @SerializedName("ocbc") + OCBC("ocbc"), + + @SerializedName("pb_enterprise") + PB_ENTERPRISE("pb_enterprise"), + + @SerializedName("public_bank") + PUBLIC_BANK("public_bank"), + + @SerializedName("rhb") + RHB("rhb"), + + @SerializedName("standard_chartered") + STANDARD_CHARTERED("standard_chartered"), + + @SerializedName("uob") + UOB("uob"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Bank(String value) { + this.value = value; + } + } + } + + @Getter + public static class Ideal { + /** The customer's bank. */ + @SerializedName("bank") + Bank bank; + + /** + * 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 Ideal(Bank bank, Map extraParams) { + this.bank = bank; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Bank bank; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public Ideal build() { + return new Ideal(this.bank, this.extraParams); + } + + /** The customer's bank. */ + public Builder setBank(Bank bank) { + this.bank = bank; + 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 PaymentIntentCreateParams.PaymentMethodData.Ideal#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 PaymentIntentCreateParams.PaymentMethodData.Ideal#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 Bank implements ApiRequestParams.EnumParam { + @SerializedName("abn_amro") + ABN_AMRO("abn_amro"), + + @SerializedName("asn_bank") + ASN_BANK("asn_bank"), + + @SerializedName("bunq") + BUNQ("bunq"), + + @SerializedName("handelsbanken") + HANDELSBANKEN("handelsbanken"), + + @SerializedName("ing") + ING("ing"), + + @SerializedName("knab") + KNAB("knab"), + + @SerializedName("moneyou") + MONEYOU("moneyou"), + + @SerializedName("rabobank") + RABOBANK("rabobank"), + + @SerializedName("regiobank") + REGIOBANK("regiobank"), + + @SerializedName("sns_bank") + SNS_BANK("sns_bank"), + + @SerializedName("triodos_bank") + TRIODOS_BANK("triodos_bank"), + + @SerializedName("van_lanschot") + VAN_LANSCHOT("van_lanschot"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Bank(String value) { + this.value = value; + } + } + } + + @Getter + public static class SepaDebit { + /** + * 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; + + /** IBAN of the bank account. */ + @SerializedName("iban") + String iban; + + private SepaDebit(Map extraParams, String iban) { + this.extraParams = extraParams; + this.iban = iban; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String iban; + + /** Finalize and obtain parameter instance from this builder. */ + public SepaDebit build() { + return new SepaDebit(this.extraParams, this.iban); + } + + /** + * 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 PaymentIntentCreateParams.PaymentMethodData.SepaDebit#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 PaymentIntentCreateParams.PaymentMethodData.SepaDebit#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** IBAN of the bank account. */ + public Builder setIban(String iban) { + this.iban = iban; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("au_becs_debit") + AU_BECS_DEBIT("au_becs_debit"), + + @SerializedName("card") + CARD("card"), + + @SerializedName("card_present") + CARD_PRESENT("card_present"), + + @SerializedName("fpx") + FPX("fpx"), + + @SerializedName("ideal") + IDEAL("ideal"), + + @SerializedName("sepa_debit") + SEPA_DEBIT("sepa_debit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + @Getter public static class PaymentMethodOptions { /** Configuration for any card payments attempted on this PaymentIntent. */ diff --git a/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java b/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java index 680c00a381c..fabbe6af2bb 100644 --- a/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java @@ -86,6 +86,15 @@ public class PaymentIntentUpdateParams extends ApiRequestParams { @SerializedName("payment_method") Object paymentMethod; + /** + * If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will + * appear in the payment_method + * property on the PaymentIntent. + */ + @SerializedName("payment_method_data") + PaymentMethodData paymentMethodData; + /** Payment-method-specific configuration for this PaymentIntent. */ @SerializedName("payment_method_options") PaymentMethodOptions paymentMethodOptions; @@ -192,6 +201,7 @@ private PaymentIntentUpdateParams( Map extraParams, Object metadata, Object paymentMethod, + PaymentMethodData paymentMethodData, PaymentMethodOptions paymentMethodOptions, List paymentMethodTypes, Object receiptEmail, @@ -212,6 +222,7 @@ private PaymentIntentUpdateParams( this.extraParams = extraParams; this.metadata = metadata; this.paymentMethod = paymentMethod; + this.paymentMethodData = paymentMethodData; this.paymentMethodOptions = paymentMethodOptions; this.paymentMethodTypes = paymentMethodTypes; this.receiptEmail = receiptEmail; @@ -248,6 +259,8 @@ public static class Builder { private Object paymentMethod; + private PaymentMethodData paymentMethodData; + private PaymentMethodOptions paymentMethodOptions; private List paymentMethodTypes; @@ -282,6 +295,7 @@ public PaymentIntentUpdateParams build() { this.extraParams, this.metadata, this.paymentMethod, + this.paymentMethodData, this.paymentMethodOptions, this.paymentMethodTypes, this.receiptEmail, @@ -513,6 +527,17 @@ public Builder setPaymentMethod(EmptyParam paymentMethod) { return this; } + /** + * If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will + * appear in the payment_method + * property on the PaymentIntent. + */ + public Builder setPaymentMethodData(PaymentMethodData paymentMethodData) { + this.paymentMethodData = paymentMethodData; + return this; + } + /** Payment-method-specific configuration for this PaymentIntent. */ public Builder setPaymentMethodOptions(PaymentMethodOptions paymentMethodOptions) { this.paymentMethodOptions = paymentMethodOptions; @@ -733,6 +758,1281 @@ public Builder setTransferGroup(EmptyParam transferGroup) { } } + @Getter + public static class PaymentMethodData { + /** + * If this is an {@code au_becs_debit} PaymentMethod, this hash contains details about the bank + * account. + */ + @SerializedName("au_becs_debit") + AuBecsDebit auBecsDebit; + + /** + * Billing information associated with the PaymentMethod that may be used or required by + * particular types of payment methods. + */ + @SerializedName("billing_details") + BillingDetails billingDetails; + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + @SerializedName("card") + Object card; + + /** + * 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; + + /** + * If this is an {@code fpx} PaymentMethod, this hash contains details about the FPX payment + * method. + */ + @SerializedName("fpx") + Fpx fpx; + + /** + * If this is an {@code ideal} PaymentMethod, this hash contains details about the iDEAL payment + * method. + */ + @SerializedName("ideal") + Ideal ideal; + + /** + * 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; + + /** + * If this is a {@code sepa_debit} PaymentMethod, this hash contains details about the SEPA + * debit bank account. + */ + @SerializedName("sepa_debit") + SepaDebit sepaDebit; + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a + * name matching this value. It contains additional information specific to the PaymentMethod + * type. + */ + @SerializedName("type") + Type type; + + private PaymentMethodData( + AuBecsDebit auBecsDebit, + BillingDetails billingDetails, + Object card, + Map extraParams, + Fpx fpx, + Ideal ideal, + Map metadata, + SepaDebit sepaDebit, + Type type) { + this.auBecsDebit = auBecsDebit; + this.billingDetails = billingDetails; + this.card = card; + this.extraParams = extraParams; + this.fpx = fpx; + this.ideal = ideal; + this.metadata = metadata; + this.sepaDebit = sepaDebit; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private AuBecsDebit auBecsDebit; + + private BillingDetails billingDetails; + + private Object card; + + private Map extraParams; + + private Fpx fpx; + + private Ideal ideal; + + private Map metadata; + + private SepaDebit sepaDebit; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentMethodData build() { + return new PaymentMethodData( + this.auBecsDebit, + this.billingDetails, + this.card, + this.extraParams, + this.fpx, + this.ideal, + this.metadata, + this.sepaDebit, + this.type); + } + + /** + * If this is an {@code au_becs_debit} PaymentMethod, this hash contains details about the + * bank account. + */ + public Builder setAuBecsDebit(AuBecsDebit auBecsDebit) { + this.auBecsDebit = auBecsDebit; + return this; + } + + /** + * Billing information associated with the PaymentMethod that may be used or required by + * particular types of payment methods. + */ + public Builder setBillingDetails(BillingDetails billingDetails) { + this.billingDetails = billingDetails; + return this; + } + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + public Builder setCard(CardDetails card) { + this.card = card; + return this; + } + + /** + * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For + * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, + * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: + * {token: "tok_visa"}}. When providing a card number, you must meet the requirements for PCI compliance. We + * strongly recommend using Stripe.js instead of interacting with this API directly. + */ + public Builder setCard(Token card) { + this.card = card; + 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 + * PaymentIntentUpdateParams.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 PaymentIntentUpdateParams.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; + } + + /** + * If this is an {@code fpx} PaymentMethod, this hash contains details about the FPX payment + * method. + */ + public Builder setFpx(Fpx fpx) { + this.fpx = fpx; + return this; + } + + /** + * If this is an {@code ideal} PaymentMethod, this hash contains details about the iDEAL + * payment method. + */ + public Builder setIdeal(Ideal ideal) { + this.ideal = ideal; + 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 + * PaymentIntentUpdateParams.PaymentMethodData#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 PaymentIntentUpdateParams.PaymentMethodData#metadata} for the field + * documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** + * If this is a {@code sepa_debit} PaymentMethod, this hash contains details about the SEPA + * debit bank account. + */ + public Builder setSepaDebit(SepaDebit sepaDebit) { + this.sepaDebit = sepaDebit; + return this; + } + + /** + * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a + * name matching this value. It contains additional information specific to the PaymentMethod + * type. + */ + public Builder setType(Type type) { + this.type = type; + return this; + } + } + + @Getter + public static class AuBecsDebit { + /** The account number for the bank account. */ + @SerializedName("account_number") + Object accountNumber; + + /** Bank-State-Branch number of the bank account. */ + @SerializedName("bsb_number") + Object bsbNumber; + + /** + * 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 AuBecsDebit(Object accountNumber, Object bsbNumber, Map extraParams) { + this.accountNumber = accountNumber; + this.bsbNumber = bsbNumber; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object accountNumber; + + private Object bsbNumber; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AuBecsDebit build() { + return new AuBecsDebit(this.accountNumber, this.bsbNumber, this.extraParams); + } + + /** The account number for the bank account. */ + public Builder setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** The account number for the bank account. */ + public Builder setAccountNumber(EmptyParam accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** Bank-State-Branch number of the bank account. */ + public Builder setBsbNumber(String bsbNumber) { + this.bsbNumber = bsbNumber; + return this; + } + + /** Bank-State-Branch number of the bank account. */ + public Builder setBsbNumber(EmptyParam bsbNumber) { + this.bsbNumber = bsbNumber; + 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 PaymentIntentUpdateParams.PaymentMethodData.AuBecsDebit#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 PaymentIntentUpdateParams.PaymentMethodData.AuBecsDebit#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 BillingDetails { + /** Billing address. */ + @SerializedName("address") + Address address; + + /** Email address. */ + @SerializedName("email") + Object email; + + /** + * 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; + + /** Full name. */ + @SerializedName("name") + Object name; + + /** Billing phone number (including extension). */ + @SerializedName("phone") + Object phone; + + private BillingDetails( + Address address, + Object email, + Map extraParams, + Object name, + Object phone) { + this.address = address; + this.email = email; + this.extraParams = extraParams; + this.name = name; + this.phone = phone; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Address address; + + private Object email; + + private Map extraParams; + + private Object name; + + private Object phone; + + /** Finalize and obtain parameter instance from this builder. */ + public BillingDetails build() { + return new BillingDetails( + this.address, this.email, this.extraParams, this.name, this.phone); + } + + /** Billing address. */ + public Builder setAddress(Address address) { + this.address = address; + return this; + } + + /** Email address. */ + public Builder setEmail(String email) { + this.email = email; + return this; + } + + /** Email address. */ + public Builder setEmail(EmptyParam email) { + this.email = email; + 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 PaymentIntentUpdateParams.PaymentMethodData.BillingDetails#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 PaymentIntentUpdateParams.PaymentMethodData.BillingDetails#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Full name. */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** Full name. */ + public Builder setName(EmptyParam name) { + this.name = name; + return this; + } + + /** Billing phone number (including extension). */ + public Builder setPhone(String phone) { + this.phone = phone; + return this; + } + + /** Billing phone number (including extension). */ + public Builder setPhone(EmptyParam phone) { + this.phone = phone; + return this; + } + } + + @Getter + public static class Address { + /** City, district, suburb, town, or village. */ + @SerializedName("city") + Object city; + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + @SerializedName("country") + Object 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; + + /** Address line 1 (e.g., street, PO Box, or company name). */ + @SerializedName("line1") + Object line1; + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + @SerializedName("line2") + Object line2; + + /** ZIP or postal code. */ + @SerializedName("postal_code") + Object postalCode; + + /** State, county, province, or region. */ + @SerializedName("state") + Object state; + + private Address( + Object city, + Object country, + Map extraParams, + Object line1, + Object line2, + Object postalCode, + Object 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 Object city; + + private Object country; + + private Map extraParams; + + private Object line1; + + private Object line2; + + private Object postalCode; + + private Object state; + + /** Finalize and obtain parameter instance from this builder. */ + public Address build() { + return new 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; + } + + /** City, district, suburb, town, or village. */ + public Builder setCity(EmptyParam 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; + } + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + public Builder setCountry(EmptyParam 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 + * PaymentIntentUpdateParams.PaymentMethodData.BillingDetails.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 + * PaymentIntentUpdateParams.PaymentMethodData.BillingDetails.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; + } + + /** Address line 1 (e.g., street, PO Box, or company name). */ + public Builder setLine1(String line1) { + this.line1 = line1; + return this; + } + + /** Address line 1 (e.g., street, PO Box, or company name). */ + public Builder setLine1(EmptyParam 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; + } + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + public Builder setLine2(EmptyParam line2) { + this.line2 = line2; + return this; + } + + /** ZIP or postal code. */ + public Builder setPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** ZIP or postal code. */ + public Builder setPostalCode(EmptyParam postalCode) { + this.postalCode = postalCode; + return this; + } + + /** State, county, province, or region. */ + public Builder setState(String state) { + this.state = state; + return this; + } + + /** State, county, province, or region. */ + public Builder setState(EmptyParam state) { + this.state = state; + return this; + } + } + } + } + + @Getter + public static class CardDetails { + /** The card's CVC. It is highly recommended to always include this value. */ + @SerializedName("cvc") + Object cvc; + + /** Two-digit number representing the card's expiration month. */ + @SerializedName("exp_month") + Long expMonth; + + /** Four-digit number representing the card's expiration year. */ + @SerializedName("exp_year") + Long expYear; + + /** + * 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 card number, as a string without any separators. */ + @SerializedName("number") + Object number; + + private CardDetails( + Object cvc, Long expMonth, Long expYear, Map extraParams, Object number) { + this.cvc = cvc; + this.expMonth = expMonth; + this.expYear = expYear; + this.extraParams = extraParams; + this.number = number; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object cvc; + + private Long expMonth; + + private Long expYear; + + private Map extraParams; + + private Object number; + + /** Finalize and obtain parameter instance from this builder. */ + public CardDetails build() { + return new CardDetails( + this.cvc, this.expMonth, this.expYear, this.extraParams, this.number); + } + + /** The card's CVC. It is highly recommended to always include this value. */ + public Builder setCvc(String cvc) { + this.cvc = cvc; + return this; + } + + /** The card's CVC. It is highly recommended to always include this value. */ + public Builder setCvc(EmptyParam cvc) { + this.cvc = cvc; + return this; + } + + /** Two-digit number representing the card's expiration month. */ + public Builder setExpMonth(Long expMonth) { + this.expMonth = expMonth; + return this; + } + + /** Four-digit number representing the card's expiration year. */ + public Builder setExpYear(Long expYear) { + this.expYear = expYear; + 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 PaymentIntentUpdateParams.PaymentMethodData.CardDetails#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 PaymentIntentUpdateParams.PaymentMethodData.CardDetails#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 card number, as a string without any separators. */ + public Builder setNumber(String number) { + this.number = number; + return this; + } + + /** The card number, as a string without any separators. */ + public Builder setNumber(EmptyParam number) { + this.number = number; + return this; + } + } + } + + @Getter + public static class Token { + /** + * 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; + + @SerializedName("token") + Object token; + + private Token(Map extraParams, Object token) { + this.extraParams = extraParams; + this.token = token; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Object token; + + /** Finalize and obtain parameter instance from this builder. */ + public Token build() { + return new Token(this.extraParams, this.token); + } + + /** + * 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 PaymentIntentUpdateParams.PaymentMethodData.Token#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 PaymentIntentUpdateParams.PaymentMethodData.Token#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 Builder setToken(String token) { + this.token = token; + return this; + } + + public Builder setToken(EmptyParam token) { + this.token = token; + return this; + } + } + } + + @Getter + public static class Fpx { + /** Account holder type for FPX transaction. */ + @SerializedName("account_holder_type") + AccountHolderType accountHolderType; + + /** The customer's bank. */ + @SerializedName("bank") + Bank bank; + + /** + * 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 Fpx(AccountHolderType accountHolderType, Bank bank, Map extraParams) { + this.accountHolderType = accountHolderType; + this.bank = bank; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private AccountHolderType accountHolderType; + + private Bank bank; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public Fpx build() { + return new Fpx(this.accountHolderType, this.bank, this.extraParams); + } + + /** Account holder type for FPX transaction. */ + public Builder setAccountHolderType(AccountHolderType accountHolderType) { + this.accountHolderType = accountHolderType; + return this; + } + + /** The customer's bank. */ + public Builder setBank(Bank bank) { + this.bank = bank; + 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 PaymentIntentUpdateParams.PaymentMethodData.Fpx#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 PaymentIntentUpdateParams.PaymentMethodData.Fpx#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 AccountHolderType implements ApiRequestParams.EnumParam { + @SerializedName("company") + COMPANY("company"), + + @SerializedName("individual") + INDIVIDUAL("individual"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + AccountHolderType(String value) { + this.value = value; + } + } + + public enum Bank implements ApiRequestParams.EnumParam { + @SerializedName("affin_bank") + AFFIN_BANK("affin_bank"), + + @SerializedName("alliance_bank") + ALLIANCE_BANK("alliance_bank"), + + @SerializedName("ambank") + AMBANK("ambank"), + + @SerializedName("bank_islam") + BANK_ISLAM("bank_islam"), + + @SerializedName("bank_muamalat") + BANK_MUAMALAT("bank_muamalat"), + + @SerializedName("bank_rakyat") + BANK_RAKYAT("bank_rakyat"), + + @SerializedName("bsn") + BSN("bsn"), + + @SerializedName("cimb") + CIMB("cimb"), + + @SerializedName("deutsche_bank") + DEUTSCHE_BANK("deutsche_bank"), + + @SerializedName("hong_leong_bank") + HONG_LEONG_BANK("hong_leong_bank"), + + @SerializedName("hsbc") + HSBC("hsbc"), + + @SerializedName("kfh") + KFH("kfh"), + + @SerializedName("maybank2e") + MAYBANK2E("maybank2e"), + + @SerializedName("maybank2u") + MAYBANK2U("maybank2u"), + + @SerializedName("ocbc") + OCBC("ocbc"), + + @SerializedName("pb_enterprise") + PB_ENTERPRISE("pb_enterprise"), + + @SerializedName("public_bank") + PUBLIC_BANK("public_bank"), + + @SerializedName("rhb") + RHB("rhb"), + + @SerializedName("standard_chartered") + STANDARD_CHARTERED("standard_chartered"), + + @SerializedName("uob") + UOB("uob"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Bank(String value) { + this.value = value; + } + } + } + + @Getter + public static class Ideal { + /** The customer's bank. */ + @SerializedName("bank") + Bank bank; + + /** + * 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 Ideal(Bank bank, Map extraParams) { + this.bank = bank; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Bank bank; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public Ideal build() { + return new Ideal(this.bank, this.extraParams); + } + + /** The customer's bank. */ + public Builder setBank(Bank bank) { + this.bank = bank; + 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 PaymentIntentUpdateParams.PaymentMethodData.Ideal#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 PaymentIntentUpdateParams.PaymentMethodData.Ideal#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 Bank implements ApiRequestParams.EnumParam { + @SerializedName("abn_amro") + ABN_AMRO("abn_amro"), + + @SerializedName("asn_bank") + ASN_BANK("asn_bank"), + + @SerializedName("bunq") + BUNQ("bunq"), + + @SerializedName("handelsbanken") + HANDELSBANKEN("handelsbanken"), + + @SerializedName("ing") + ING("ing"), + + @SerializedName("knab") + KNAB("knab"), + + @SerializedName("moneyou") + MONEYOU("moneyou"), + + @SerializedName("rabobank") + RABOBANK("rabobank"), + + @SerializedName("regiobank") + REGIOBANK("regiobank"), + + @SerializedName("sns_bank") + SNS_BANK("sns_bank"), + + @SerializedName("triodos_bank") + TRIODOS_BANK("triodos_bank"), + + @SerializedName("van_lanschot") + VAN_LANSCHOT("van_lanschot"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Bank(String value) { + this.value = value; + } + } + } + + @Getter + public static class SepaDebit { + /** + * 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; + + /** IBAN of the bank account. */ + @SerializedName("iban") + Object iban; + + private SepaDebit(Map extraParams, Object iban) { + this.extraParams = extraParams; + this.iban = iban; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Object iban; + + /** Finalize and obtain parameter instance from this builder. */ + public SepaDebit build() { + return new SepaDebit(this.extraParams, this.iban); + } + + /** + * 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 PaymentIntentUpdateParams.PaymentMethodData.SepaDebit#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 PaymentIntentUpdateParams.PaymentMethodData.SepaDebit#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** IBAN of the bank account. */ + public Builder setIban(String iban) { + this.iban = iban; + return this; + } + + /** IBAN of the bank account. */ + public Builder setIban(EmptyParam iban) { + this.iban = iban; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("au_becs_debit") + AU_BECS_DEBIT("au_becs_debit"), + + @SerializedName("card") + CARD("card"), + + @SerializedName("card_present") + CARD_PRESENT("card_present"), + + @SerializedName("fpx") + FPX("fpx"), + + @SerializedName("ideal") + IDEAL("ideal"), + + @SerializedName("sepa_debit") + SEPA_DEBIT("sepa_debit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + @Getter public static class PaymentMethodOptions { /** Configuration for any card payments attempted on this PaymentIntent. */ diff --git a/src/main/java/com/stripe/param/PaymentMethodCreateParams.java b/src/main/java/com/stripe/param/PaymentMethodCreateParams.java index a74e21f8cb8..2f46b32ad1a 100644 --- a/src/main/java/com/stripe/param/PaymentMethodCreateParams.java +++ b/src/main/java/com/stripe/param/PaymentMethodCreateParams.java @@ -28,7 +28,7 @@ public class PaymentMethodCreateParams extends ApiRequestParams { * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: {token: - * "tok_visa"}}. When creating with a card number, you must meet the requirements for PCI compliance. We * strongly recommend using Stripe.js instead of interacting with this API directly. */ @@ -89,9 +89,6 @@ public class PaymentMethodCreateParams extends ApiRequestParams { /** * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name * matching this value. It contains additional information specific to the PaymentMethod type. - * Required unless {@code payment_method} is specified (see the Cloning - * PaymentMethods guide) */ @SerializedName("type") Type type; @@ -191,7 +188,7 @@ public Builder setBillingDetails(BillingDetails billingDetails) { * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: - * {token: "tok_visa"}}. When creating with a card number, you must meet the requirements for PCI compliance. We * strongly recommend using Stripe.js instead of interacting with this API directly. */ @@ -204,7 +201,7 @@ public Builder setCard(CardDetails card) { * If this is a {@code card} PaymentMethod, this hash contains the user's card details. For * backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, * Amex Express Checkout, or legacy Checkout) into the card hash with format {@code card: - * {token: "tok_visa"}}. When creating with a card number, you must meet the requirements for PCI compliance. We * strongly recommend using Stripe.js instead of interacting with this API directly. */ @@ -333,9 +330,7 @@ public Builder setSepaDebit(SepaDebit sepaDebit) { /** * The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a * name matching this value. It contains additional information specific to the PaymentMethod - * type. Required unless {@code payment_method} is specified (see the Cloning - * PaymentMethods guide) + * type. */ public Builder setType(Type type) { this.type = type;