class Stripe::CheckoutSession
- Stripe::CheckoutSession
- Reference
- Object
Overview
A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout or Payment Links. We recommend creating a new Session each time your customer attempts to pay. Once payment is successful, the Checkout Session will contain a reference to the Customer, and either the successful PaymentIntent or an active Subscription. You can create a Checkout Session on your server and redirect to its URL to begin Checkout. Related guide: Checkout quickstart
Included Modules
- JSON::Serializable
- JSON::Serializable::Unmapped
- OpenApi::Json
- OpenApi::Validatable
Defined in:
stripe/models/checkout_session.crConstant Summary
-
ERROR_MESSAGE_FOR_BILLING_ADDRESS_COLLECTION =
"invalid value for \"billing_address_collection\", must be one of [auto, required]."
-
ERROR_MESSAGE_FOR_CUSTOMER_CREATION =
"invalid value for \"customer_creation\", must be one of [always, if_required]."
-
ERROR_MESSAGE_FOR_LOCALE =
"invalid value for \"locale\", must be one of [auto, bg, cs, da, de, el, en, en-GB, es, es-419, et, fi, fil, fr, fr-CA, hr, hu, id, it, ja, ko, lt, lv, ms, mt, nb, nl, pl, pt, pt-BR, ro, ru, sk, sl, sv, th, tr, vi, zh, zh-HK, zh-TW]."
-
ERROR_MESSAGE_FOR_MODE =
"invalid value for \"mode\", must be one of [payment, setup, subscription]."
-
ERROR_MESSAGE_FOR_OBJECT =
"invalid value for \"object\", must be one of [checkout.session]."
-
ERROR_MESSAGE_FOR_PAYMENT_METHOD_COLLECTION =
"invalid value for \"payment_method_collection\", must be one of [always, if_required]."
-
ERROR_MESSAGE_FOR_PAYMENT_STATUS =
"invalid value for \"payment_status\", must be one of [no_payment_required, paid, unpaid]."
-
ERROR_MESSAGE_FOR_REDIRECT_ON_COMPLETION =
"invalid value for \"redirect_on_completion\", must be one of [always, if_required, never]."
-
ERROR_MESSAGE_FOR_STATUS =
"invalid value for \"status\", must be one of [complete, expired, open]."
-
ERROR_MESSAGE_FOR_SUBMIT_TYPE =
"invalid value for \"submit_type\", must be one of [auto, book, donate, pay]."
-
ERROR_MESSAGE_FOR_UI_MODE =
"invalid value for \"ui_mode\", must be one of [embedded, hosted]."
-
MAX_LENGTH_FOR_CANCEL_URL =
5000
-
MAX_LENGTH_FOR_CLIENT_REFERENCE_ID =
5000
-
MAX_LENGTH_FOR_CLIENT_SECRET =
5000
-
MAX_LENGTH_FOR_CUSTOMER_EMAIL =
5000
-
MAX_LENGTH_FOR_ID =
5000
-
MAX_LENGTH_FOR_RECOVERED_FROM =
5000
-
MAX_LENGTH_FOR_RETURN_URL =
5000
-
MAX_LENGTH_FOR_SUCCESS_URL =
5000
-
MAX_LENGTH_FOR_URL =
5000
-
VALID_VALUES_FOR_BILLING_ADDRESS_COLLECTION =
String.static_array("auto", "required")
-
VALID_VALUES_FOR_CUSTOMER_CREATION =
String.static_array("always", "if_required")
-
VALID_VALUES_FOR_LOCALE =
String.static_array("auto", "bg", "cs", "da", "de", "el", "en", "en-GB", "es", "es-419", "et", "fi", "fil", "fr", "fr-CA", "hr", "hu", "id", "it", "ja", "ko", "lt", "lv", "ms", "mt", "nb", "nl", "pl", "pt", "pt-BR", "ro", "ru", "sk", "sl", "sv", "th", "tr", "vi", "zh", "zh-HK", "zh-TW")
-
VALID_VALUES_FOR_MODE =
String.static_array("payment", "setup", "subscription")
-
VALID_VALUES_FOR_OBJECT =
String.static_array("checkout.session")
-
VALID_VALUES_FOR_PAYMENT_METHOD_COLLECTION =
String.static_array("always", "if_required")
-
VALID_VALUES_FOR_PAYMENT_STATUS =
String.static_array("no_payment_required", "paid", "unpaid")
-
VALID_VALUES_FOR_REDIRECT_ON_COMPLETION =
String.static_array("always", "if_required", "never")
-
VALID_VALUES_FOR_STATUS =
String.static_array("complete", "expired", "open")
-
VALID_VALUES_FOR_SUBMIT_TYPE =
String.static_array("auto", "book", "donate", "pay")
-
VALID_VALUES_FOR_UI_MODE =
String.static_array("embedded", "hosted")
Constructors
- .new(pull : JSON::PullParser)
-
.new(*, after_expiration : Stripe::CheckoutSessionAfterExpiration | Nil = nil, allow_promotion_codes : Bool | Nil = nil, amount_subtotal : Int64 | Nil = nil, amount_total : Int64 | Nil = nil, automatic_tax : Stripe::PaymentPagesCheckoutSessionAutomaticTax | Nil = nil, billing_address_collection : String | Nil = nil, cancel_url : String | Nil = nil, client_reference_id : String | Nil = nil, client_secret : String | Nil = nil, consent : Stripe::CheckoutSessionConsent | Nil = nil, consent_collection : Stripe::CheckoutSessionConsentCollection | Nil = nil, created : Int64 | Nil = nil, currency : String | Nil = nil, currency_conversion : Stripe::CheckoutSessionCurrencyConversion | Nil = nil, custom_fields : Array(Stripe::PaymentPagesCheckoutSessionCustomFields) | Nil = nil, custom_text : Stripe::PaymentPagesCheckoutSessionCustomText | Nil = nil, customer : Stripe::CheckoutSessionCustomer | Nil = nil, customer_creation : String | Nil = nil, customer_details : Stripe::CheckoutSessionCustomerDetails | Nil = nil, customer_email : String | Nil = nil, expires_at : Int64 | Nil = nil, id : String | Nil = nil, invoice : Stripe::CheckoutSessionInvoice | Nil = nil, invoice_creation : Stripe::CheckoutSessionInvoiceCreation | Nil = nil, livemode : Bool | Nil = nil, locale : String | Nil = nil, metadata : Hash(String, String) | Nil = nil, mode : String | Nil = nil, object : String | Nil = nil, payment_intent : Stripe::CheckoutSessionPaymentIntent | Nil = nil, payment_link : Stripe::CheckoutSessionPaymentLink | Nil = nil, payment_method_collection : String | Nil = nil, payment_method_configuration_details : Stripe::CheckoutSessionPaymentMethodConfigurationDetails | Nil = nil, payment_method_options : Stripe::CheckoutSessionPaymentMethodOptions1 | Nil = nil, payment_method_types : Array(String) | Nil = nil, payment_status : String | Nil = nil, recovered_from : String | Nil = nil, saved_payment_method_options : Stripe::CheckoutSessionSavedPaymentMethodOptions | Nil = nil, setup_intent : Stripe::CheckoutSessionSetupIntent | Nil = nil, shipping_address_collection : Stripe::CheckoutSessionShippingAddressCollection | Nil = nil, shipping_cost : Stripe::CheckoutSessionShippingCost | Nil = nil, shipping_details : Stripe::CheckoutSessionShippingDetails | Nil = nil, shipping_options : Array(Stripe::PaymentPagesCheckoutSessionShippingOption) | Nil = nil, status : String | Nil = nil, submit_type : String | Nil = nil, subscription : Stripe::CheckoutSessionSubscription | Nil = nil, success_url : String | Nil = nil, total_details : Stripe::CheckoutSessionTotalDetails | Nil = nil, ui_mode : String | Nil = nil, url : String | Nil = nil, line_items : Stripe::PaymentPagesCheckoutSessionListLineItems | Nil = nil, phone_number_collection : Stripe::PaymentPagesCheckoutSessionPhoneNumberCollection | Nil = nil, redirect_on_completion : String | Nil = nil, return_url : String | Nil = nil, tax_id_collection : Stripe::PaymentPagesCheckoutSessionTaxIdCollection | Nil = nil)
Initializes the object @param [Hash] attributes Model attributes in the form of hash
Instance Method Summary
-
#==(other : self)
Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes.
- #after_expiration : Stripe::CheckoutSessionAfterExpiration | Nil
-
#after_expiration=(new_value : Stripe::CheckoutSessionAfterExpiration | Nil)
Custom attribute writer method checking allowed values (enum).
- #allow_promotion_codes : Bool | Nil
-
#allow_promotion_codes=(new_value : Bool | Nil)
Custom attribute writer method checking allowed values (enum).
- #amount_subtotal : Int64 | Nil
-
#amount_subtotal=(new_value : Int64 | Nil)
Custom attribute writer method checking allowed values (enum).
- #amount_total : Int64 | Nil
-
#amount_total=(new_value : Int64 | Nil)
Custom attribute writer method checking allowed values (enum).
- #automatic_tax : Stripe::PaymentPagesCheckoutSessionAutomaticTax | Nil
-
#automatic_tax=(new_value : Stripe::PaymentPagesCheckoutSessionAutomaticTax | Nil)
Custom attribute writer method checking allowed values (enum).
- #billing_address_collection : String | Nil
-
#billing_address_collection=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #cancel_url : String | Nil
-
#cancel_url=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #client_reference_id : String | Nil
-
#client_reference_id=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #client_secret : String | Nil
-
#client_secret=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #consent : Stripe::CheckoutSessionConsent | Nil
-
#consent=(new_value : Stripe::CheckoutSessionConsent | Nil)
Custom attribute writer method checking allowed values (enum).
- #consent_collection : Stripe::CheckoutSessionConsentCollection | Nil
-
#consent_collection=(new_value : Stripe::CheckoutSessionConsentCollection | Nil)
Custom attribute writer method checking allowed values (enum).
- #created : Int64 | Nil
-
#created=(new_value : Int64 | Nil)
Custom attribute writer method checking allowed values (enum).
- #currency : String | Nil
-
#currency=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #currency_conversion : Stripe::CheckoutSessionCurrencyConversion | Nil
-
#currency_conversion=(new_value : Stripe::CheckoutSessionCurrencyConversion | Nil)
Custom attribute writer method checking allowed values (enum).
- #custom_fields : Array(Stripe::PaymentPagesCheckoutSessionCustomFields) | Nil
-
#custom_fields=(new_value : Array(Stripe::PaymentPagesCheckoutSessionCustomFields) | Nil)
Custom attribute writer method checking allowed values (enum).
- #custom_text : Stripe::PaymentPagesCheckoutSessionCustomText | Nil
-
#custom_text=(new_value : Stripe::PaymentPagesCheckoutSessionCustomText | Nil)
Custom attribute writer method checking allowed values (enum).
- #customer : Stripe::CheckoutSessionCustomer | Nil
-
#customer=(new_value : Stripe::CheckoutSessionCustomer | Nil)
Custom attribute writer method checking allowed values (enum).
- #customer_creation : String | Nil
-
#customer_creation=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #customer_details : Stripe::CheckoutSessionCustomerDetails | Nil
-
#customer_details=(new_value : Stripe::CheckoutSessionCustomerDetails | Nil)
Custom attribute writer method checking allowed values (enum).
- #customer_email : String | Nil
-
#customer_email=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #expires_at : Int64 | Nil
-
#expires_at=(new_value : Int64 | Nil)
Custom attribute writer method checking allowed values (enum).
-
#hash(hasher)
Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes.
- #id : String | Nil
-
#id=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #invoice : Stripe::CheckoutSessionInvoice | Nil
-
#invoice=(new_value : Stripe::CheckoutSessionInvoice | Nil)
Custom attribute writer method checking allowed values (enum).
- #invoice_creation : Stripe::CheckoutSessionInvoiceCreation | Nil
-
#invoice_creation=(new_value : Stripe::CheckoutSessionInvoiceCreation | Nil)
Custom attribute writer method checking allowed values (enum).
- #line_items : Stripe::PaymentPagesCheckoutSessionListLineItems | Nil
-
#line_items=(new_value : Stripe::PaymentPagesCheckoutSessionListLineItems | Nil)
Custom attribute writer method checking allowed values (enum).
-
#list_invalid_properties : Array(String)
Show invalid properties with the reasons.
- #livemode : Bool | Nil
-
#livemode=(new_value : Bool | Nil)
Custom attribute writer method checking allowed values (enum).
- #locale : String | Nil
-
#locale=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #metadata : Hash(String, String) | Nil
-
#metadata=(new_value : Hash(String, String) | Nil)
Custom attribute writer method checking allowed values (enum).
- #mode : String | Nil
-
#mode=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #object : String | Nil
-
#object=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_intent : Stripe::CheckoutSessionPaymentIntent | Nil
-
#payment_intent=(new_value : Stripe::CheckoutSessionPaymentIntent | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_link : Stripe::CheckoutSessionPaymentLink | Nil
-
#payment_link=(new_value : Stripe::CheckoutSessionPaymentLink | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_method_collection : String | Nil
-
#payment_method_collection=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_method_configuration_details : Stripe::CheckoutSessionPaymentMethodConfigurationDetails | Nil
-
#payment_method_configuration_details=(new_value : Stripe::CheckoutSessionPaymentMethodConfigurationDetails | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_method_options : Stripe::CheckoutSessionPaymentMethodOptions1 | Nil
-
#payment_method_options=(new_value : Stripe::CheckoutSessionPaymentMethodOptions1 | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_method_types : Array(String) | Nil
-
#payment_method_types=(new_value : Array(String) | Nil)
Custom attribute writer method checking allowed values (enum).
- #payment_status : String | Nil
-
#payment_status=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #phone_number_collection : Stripe::PaymentPagesCheckoutSessionPhoneNumberCollection | Nil
-
#phone_number_collection=(new_value : Stripe::PaymentPagesCheckoutSessionPhoneNumberCollection | Nil)
Custom attribute writer method checking allowed values (enum).
- #recovered_from : String | Nil
-
#recovered_from=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #redirect_on_completion : String | Nil
-
#redirect_on_completion=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #return_url : String | Nil
-
#return_url=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #saved_payment_method_options : Stripe::CheckoutSessionSavedPaymentMethodOptions | Nil
-
#saved_payment_method_options=(new_value : Stripe::CheckoutSessionSavedPaymentMethodOptions | Nil)
Custom attribute writer method checking allowed values (enum).
- #setup_intent : Stripe::CheckoutSessionSetupIntent | Nil
-
#setup_intent=(new_value : Stripe::CheckoutSessionSetupIntent | Nil)
Custom attribute writer method checking allowed values (enum).
- #shipping_address_collection : Stripe::CheckoutSessionShippingAddressCollection | Nil
-
#shipping_address_collection=(new_value : Stripe::CheckoutSessionShippingAddressCollection | Nil)
Custom attribute writer method checking allowed values (enum).
- #shipping_cost : Stripe::CheckoutSessionShippingCost | Nil
-
#shipping_cost=(new_value : Stripe::CheckoutSessionShippingCost | Nil)
Custom attribute writer method checking allowed values (enum).
- #shipping_details : Stripe::CheckoutSessionShippingDetails | Nil
-
#shipping_details=(new_value : Stripe::CheckoutSessionShippingDetails | Nil)
Custom attribute writer method checking allowed values (enum).
- #shipping_options : Array(Stripe::PaymentPagesCheckoutSessionShippingOption) | Nil
-
#shipping_options=(new_value : Array(Stripe::PaymentPagesCheckoutSessionShippingOption) | Nil)
Custom attribute writer method checking allowed values (enum).
- #status : String | Nil
-
#status=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #submit_type : String | Nil
-
#submit_type=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #subscription : Stripe::CheckoutSessionSubscription | Nil
-
#subscription=(new_value : Stripe::CheckoutSessionSubscription | Nil)
Custom attribute writer method checking allowed values (enum).
- #success_url : String | Nil
-
#success_url=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #tax_id_collection : Stripe::PaymentPagesCheckoutSessionTaxIdCollection | Nil
-
#tax_id_collection=(new_value : Stripe::PaymentPagesCheckoutSessionTaxIdCollection | Nil)
Custom attribute writer method checking allowed values (enum).
- #total_details : Stripe::CheckoutSessionTotalDetails | Nil
-
#total_details=(new_value : Stripe::CheckoutSessionTotalDetails | Nil)
Custom attribute writer method checking allowed values (enum).
- #ui_mode : String | Nil
-
#ui_mode=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
- #url : String | Nil
-
#url=(new_value : String | Nil)
Custom attribute writer method checking allowed values (enum).
-
#valid? : Bool
Check to see if the all the properties in the model are valid @return true if the model is valid
Instance methods inherited from module OpenApi::Json
after_initialize
after_initialize,
clone
clone,
eql?(o : self)
eql?,
to_hash : Hash(String, JSON::Any)
to_hash,
to_json_any : JSON::Any
to_json_any
Class methods inherited from module OpenApi::Json
build_from_hash(hash : Hash)
build_from_hash,
build_from_json_any(json_any : JSON::Any)
build_from_json_any
Instance methods inherited from module OpenApi::Validatable
list_invalid_properties : Array(String)
list_invalid_properties,
list_invalid_properties_for(key : String) : Array(String)
list_invalid_properties_for,
valid? : Bool
valid?,
validate : Nil
validate
Constructor Detail
Initializes the object @param [Hash] attributes Model attributes in the form of hash
Instance Method Detail
Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code
Custom attribute writer method checking allowed values (enum). @param [Object] after_expiration Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] allow_promotion_codes Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] amount_subtotal Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] amount_total Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] automatic_tax Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] billing_address_collection Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] cancel_url Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] client_reference_id Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] client_secret Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] consent Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] consent_collection Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] created Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] currency Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] currency_conversion Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] custom_fields Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] custom_text Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] customer Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] customer_creation Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] customer_details Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] customer_email Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] expires_at Object to be assigned
Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code
Custom attribute writer method checking allowed values (enum). @param [Object] id Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] invoice Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] invoice_creation Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] line_items Object to be assigned
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
Custom attribute writer method checking allowed values (enum). @param [Object] livemode Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] locale Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] metadata Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] mode Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] object Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_intent Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_link Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_method_collection Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_method_configuration_details Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_method_options Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_method_types Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] payment_status Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] phone_number_collection Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] recovered_from Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] redirect_on_completion Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] return_url Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] saved_payment_method_options Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] setup_intent Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] shipping_address_collection Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] shipping_cost Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] shipping_details Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] shipping_options Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] status Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] submit_type Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] subscription Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] success_url Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] tax_id_collection Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] total_details Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] ui_mode Object to be assigned
Custom attribute writer method checking allowed values (enum). @param [Object] url Object to be assigned
Check to see if the all the properties in the model are valid @return true if the model is valid