Class: Pago::V2026_04::Models::CheckoutPublic

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Overview

Checkout session data retrieved using the client secret.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  id: "id",
  created_at: "created_at",
  modified_at: "modified_at",
  custom_field_data: "custom_field_data",
  payment_processor: "payment_processor",
  status: "status",
  client_secret: "client_secret",
  url: "url",
  expires_at: "expires_at",
  success_url: "success_url",
  return_url: "return_url",
  embed_origin: "embed_origin",
  amount: "amount",
  seats: "seats",
  min_seats: "min_seats",
  max_seats: "max_seats",
  discount_amount: "discount_amount",
  net_amount: "net_amount",
  tax_amount: "tax_amount",
  tax_behavior: "tax_behavior",
  total_amount: "total_amount",
  currency: "currency",
  allow_trial: "allow_trial",
  active_trial_interval: "active_trial_interval",
  active_trial_interval_count: "active_trial_interval_count",
  trial_end: "trial_end",
  organization_id: "organization_id",
  product_id: "product_id",
  product_price_id: "product_price_id",
  discount_id: "discount_id",
  allow_discount_codes: "allow_discount_codes",
  require_billing_address: "require_billing_address",
  is_discount_applicable: "is_discount_applicable",
  is_free_product_price: "is_free_product_price",
  is_payment_required: "is_payment_required",
  is_payment_setup_required: "is_payment_setup_required",
  is_payment_form_required: "is_payment_form_required",
  customer_id: "customer_id",
  is_business_customer: "is_business_customer",
  customer_name: "customer_name",
  customer_email: "customer_email",
  customer_ip_address: "customer_ip_address",
  customer_billing_name: "customer_billing_name",
  customer_billing_address: "customer_billing_address",
  customer_tax_id: "customer_tax_id",
  locale: "locale",
  payment_processor_metadata: "payment_processor_metadata",
  billing_address_fields: "billing_address_fields",
  products: "products",
  product: "product",
  product_price: "product_price",
  prices: "prices",
  discount: "discount",
  organization: "organization",
  attached_custom_fields: "attached_custom_fields"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["id", "created_at", "modified_at", "payment_processor", "status", "client_secret", "url", "expires_at", "success_url", "return_url", "embed_origin", "amount", "discount_amount", "net_amount", "tax_amount", "tax_behavior", "total_amount", "currency", "allow_trial", "active_trial_interval", "active_trial_interval_count", "trial_end", "organization_id", "product_id", "product_price_id", "discount_id", "allow_discount_codes", "require_billing_address", "is_discount_applicable", "is_free_product_price", "is_payment_required", "is_payment_setup_required", "is_payment_form_required", "customer_id", "is_business_customer", "customer_name", "customer_email", "customer_ip_address", "customer_billing_name", "customer_billing_address", "customer_tax_id", "payment_processor_metadata", "billing_address_fields", "products", "product", "product_price", "prices", "discount", "organization", "attached_custom_fields"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(id:, created_at:, modified_at:, custom_field_data: ::Pago::UNSET, payment_processor:, status:, client_secret:, url:, expires_at:, success_url:, return_url:, embed_origin:, amount:, seats: ::Pago::UNSET, min_seats: ::Pago::UNSET, max_seats: ::Pago::UNSET, discount_amount:, net_amount:, tax_amount:, tax_behavior:, total_amount:, currency:, allow_trial:, active_trial_interval:, active_trial_interval_count:, trial_end:, organization_id:, product_id:, product_price_id:, discount_id:, allow_discount_codes:, require_billing_address:, is_discount_applicable:, is_free_product_price:, is_payment_required:, is_payment_setup_required:, is_payment_form_required:, customer_id:, is_business_customer:, customer_name:, customer_email:, customer_ip_address:, customer_billing_name:, customer_billing_address:, customer_tax_id:, locale: ::Pago::UNSET, payment_processor_metadata:, billing_address_fields:, products:, product:, product_price:, prices:, discount:, organization:, attached_custom_fields:) ⇒ CheckoutPublic

Returns a new instance of CheckoutPublic.

Parameters:

  • id: (String)
  • created_at: (String)
  • modified_at: (String, nil)
  • custom_field_data: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • payment_processor: (String)
  • status: (String)
  • client_secret: (String)
  • url: (String)
  • expires_at: (String)
  • success_url: (String)
  • return_url: (String, nil)
  • embed_origin: (String, nil)
  • amount: (Integer)
  • seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • min_seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • max_seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • discount_amount: (Integer)
  • net_amount: (Integer)
  • tax_amount: (Integer, nil)
  • tax_behavior: (String, nil)
  • total_amount: (Integer)
  • currency: (String)
  • allow_trial: (Boolean, nil)
  • active_trial_interval: (String, nil)
  • active_trial_interval_count: (Integer, nil)
  • trial_end: (String, nil)
  • organization_id: (String)
  • product_id: (String, nil)
  • product_price_id: (String, nil)
  • discount_id: (String, nil)
  • allow_discount_codes: (Boolean)
  • require_billing_address: (Boolean)
  • is_discount_applicable: (Boolean)
  • is_free_product_price: (Boolean)
  • is_payment_required: (Boolean)
  • is_payment_setup_required: (Boolean)
  • is_payment_form_required: (Boolean)
  • customer_id: (String, nil)
  • is_business_customer: (Boolean)
  • customer_name: (String, nil)
  • customer_email: (String, nil)
  • customer_ip_address: (String, nil)
  • customer_billing_name: (String, nil)
  • customer_billing_address: (Models::Address, nil)
  • customer_tax_id: (String, nil)
  • locale: (String, nil) (defaults to: ::Pago::UNSET)
  • payment_processor_metadata: (Hash[String, String])
  • billing_address_fields: (Models::CheckoutBillingAddressFields)
  • products: (Array[Models::CheckoutProduct])
  • product: (Models::CheckoutProduct, nil)
  • product_price: (Object)
  • prices: (Hash[String, Array[untyped]], nil)
  • discount: (Object)
  • organization: (Models::CheckoutOrganization)
  • attached_custom_fields: (Array[Models::AttachedCustomField], nil)


11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
# File 'lib/pago/v2026_04/models.rb', line 11961

def initialize(
  id:,
  created_at:,
  modified_at:,
  custom_field_data: ::Pago::UNSET,
  payment_processor:,
  status:,
  client_secret:,
  url:,
  expires_at:,
  success_url:,
  return_url:,
  embed_origin:,
  amount:,
  seats: ::Pago::UNSET,
  min_seats: ::Pago::UNSET,
  max_seats: ::Pago::UNSET,
  discount_amount:,
  net_amount:,
  tax_amount:,
  tax_behavior:,
  total_amount:,
  currency:,
  allow_trial:,
  active_trial_interval:,
  active_trial_interval_count:,
  trial_end:,
  organization_id:,
  product_id:,
  product_price_id:,
  discount_id:,
  allow_discount_codes:,
  require_billing_address:,
  is_discount_applicable:,
  is_free_product_price:,
  is_payment_required:,
  is_payment_setup_required:,
  is_payment_form_required:,
  customer_id:,
  is_business_customer:,
  customer_name:,
  customer_email:,
  customer_ip_address:,
  customer_billing_name:,
  customer_billing_address:,
  customer_tax_id:,
  locale: ::Pago::UNSET,
  payment_processor_metadata:,
  billing_address_fields:,
  products:,
  product:,
  product_price:,
  prices:,
  discount:,
  organization:,
  attached_custom_fields:
)
  super()
  assign(:id, id)
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:custom_field_data, custom_field_data)
  assign(:payment_processor, payment_processor)
  assign(:status, status)
  assign(:client_secret, client_secret)
  assign(:url, url)
  assign(:expires_at, expires_at)
  assign(:success_url, success_url)
  assign(:return_url, return_url)
  assign(:embed_origin, embed_origin)
  assign(:amount, amount)
  assign(:seats, seats)
  assign(:min_seats, min_seats)
  assign(:max_seats, max_seats)
  assign(:discount_amount, discount_amount)
  assign(:net_amount, net_amount)
  assign(:tax_amount, tax_amount)
  assign(:tax_behavior, tax_behavior)
  assign(:total_amount, total_amount)
  assign(:currency, currency)
  assign(:allow_trial, allow_trial)
  assign(:active_trial_interval, active_trial_interval)
  assign(:active_trial_interval_count, active_trial_interval_count)
  assign(:trial_end, trial_end)
  assign(:organization_id, organization_id)
  assign(:product_id, product_id)
  assign(:product_price_id, product_price_id)
  assign(:discount_id, discount_id)
  assign(:allow_discount_codes, allow_discount_codes)
  assign(:require_billing_address, require_billing_address)
  assign(:is_discount_applicable, is_discount_applicable)
  assign(:is_free_product_price, is_free_product_price)
  assign(:is_payment_required, is_payment_required)
  assign(:is_payment_setup_required, is_payment_setup_required)
  assign(:is_payment_form_required, is_payment_form_required)
  assign(:customer_id, customer_id)
  assign(:is_business_customer, is_business_customer)
  assign(:customer_name, customer_name)
  assign(:customer_email, customer_email)
  assign(:customer_ip_address, customer_ip_address)
  assign(:customer_billing_name, customer_billing_name)
  assign(:customer_billing_address, customer_billing_address)
  assign(:customer_tax_id, customer_tax_id)
  assign(:locale, locale)
  assign(:payment_processor_metadata, )
  assign(:billing_address_fields, billing_address_fields)
  assign(:products, products)
  assign(:product, product)
  assign(:product_price, product_price)
  assign(:prices, prices)
  assign(:discount, discount)
  assign(:organization, organization)
  assign(:attached_custom_fields, attached_custom_fields)
end

Instance Attribute Details

#active_trial_intervalString? (readonly)

Interval unit of the trial period, if any. This value is either set from the checkout, if trial_interval is set, or from the selected product.

Returns:

  • (String, nil)


11844
11845
11846
# File 'lib/pago/v2026_04/models.rb', line 11844

def active_trial_interval
  @active_trial_interval
end

#active_trial_interval_countInteger? (readonly)

Number of interval units of the trial period, if any. This value is either set from the checkout, if trial_interval_count is set, or from the selected product.

Returns:

  • (Integer, nil)


11848
11849
11850
# File 'lib/pago/v2026_04/models.rb', line 11848

def active_trial_interval_count
  @active_trial_interval_count
end

#allow_discount_codesBoolean (readonly)

Whether to allow the customer to apply discount codes. If you apply a discount through discount_id, it'll still be applied, but the customer won't be able to change it.

Returns:

  • (Boolean)


11873
11874
11875
# File 'lib/pago/v2026_04/models.rb', line 11873

def allow_discount_codes
  @allow_discount_codes
end

#allow_trialBoolean? (readonly)

Whether to enable the trial period for the checkout session. If false, the trial period will be disabled, even if the selected product has a trial configured.

Returns:

  • (Boolean, nil)


11840
11841
11842
# File 'lib/pago/v2026_04/models.rb', line 11840

def allow_trial
  @allow_trial
end

#amountInteger (readonly)

Amount in cents, before discounts and taxes.

Returns:

  • (Integer)


11800
11801
11802
# File 'lib/pago/v2026_04/models.rb', line 11800

def amount
  @amount
end

#attached_custom_fieldsArray<Models::AttachedCustomField>? (readonly)

Returns:



11959
11960
11961
# File 'lib/pago/v2026_04/models.rb', line 11959

def attached_custom_fields
  @attached_custom_fields
end

#billing_address_fieldsModels::CheckoutBillingAddressFields (readonly)



11933
11934
11935
# File 'lib/pago/v2026_04/models.rb', line 11933

def billing_address_fields
  @billing_address_fields
end

#client_secretString (readonly)

Client secret used to update and complete the checkout session from the client.

Returns:

  • (String)


11776
11777
11778
# File 'lib/pago/v2026_04/models.rb', line 11776

def client_secret
  @client_secret
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


11758
11759
11760
# File 'lib/pago/v2026_04/models.rb', line 11758

def created_at
  @created_at
end

#currencyString (readonly)

Currency code of the checkout session.

Returns:

  • (String)


11836
11837
11838
# File 'lib/pago/v2026_04/models.rb', line 11836

def currency
  @currency
end

#custom_field_dataHash{String => String, Integer, Boolean, nil} (readonly)

Key-value object storing custom field values.

Returns:

  • (Hash{String => String, Integer, Boolean, nil})


11766
11767
11768
# File 'lib/pago/v2026_04/models.rb', line 11766

def custom_field_data
  @custom_field_data
end

#customer_billing_addressModels::Address? (readonly)

Returns:



11921
11922
11923
# File 'lib/pago/v2026_04/models.rb', line 11921

def customer_billing_address
  @customer_billing_address
end

#customer_billing_nameString? (readonly)

Returns:

  • (String, nil)


11918
11919
11920
# File 'lib/pago/v2026_04/models.rb', line 11918

def customer_billing_name
  @customer_billing_name
end

#customer_emailString? (readonly)

Email address of the customer.

Returns:

  • (String, nil)


11912
11913
11914
# File 'lib/pago/v2026_04/models.rb', line 11912

def customer_email
  @customer_email
end

#customer_idString? (readonly)

Returns:

  • (String, nil)


11900
11901
11902
# File 'lib/pago/v2026_04/models.rb', line 11900

def customer_id
  @customer_id
end

#customer_ip_addressString? (readonly)

Returns:

  • (String, nil)


11915
11916
11917
# File 'lib/pago/v2026_04/models.rb', line 11915

def customer_ip_address
  @customer_ip_address
end

#customer_nameString? (readonly)

Name of the customer.

Returns:

  • (String, nil)


11908
11909
11910
# File 'lib/pago/v2026_04/models.rb', line 11908

def customer_name
  @customer_name
end

#customer_tax_idString? (readonly)

Returns:

  • (String, nil)


11924
11925
11926
# File 'lib/pago/v2026_04/models.rb', line 11924

def customer_tax_id
  @customer_tax_id
end

#discount_amountInteger (readonly)

Discount amount in cents.

Returns:

  • (Integer)


11816
11817
11818
# File 'lib/pago/v2026_04/models.rb', line 11816

def discount_amount
  @discount_amount
end

#discount_idString? (readonly)

ID of the discount applied to the checkout.

Returns:

  • (String, nil)


11869
11870
11871
# File 'lib/pago/v2026_04/models.rb', line 11869

def discount_id
  @discount_id
end

#embed_originString? (readonly)

When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.

Returns:

  • (String, nil)


11796
11797
11798
# File 'lib/pago/v2026_04/models.rb', line 11796

def embed_origin
  @embed_origin
end

#expires_atString (readonly)

Expiration date and time of the checkout session.

Returns:

  • (String)


11784
11785
11786
# File 'lib/pago/v2026_04/models.rb', line 11784

def expires_at
  @expires_at
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


11754
11755
11756
# File 'lib/pago/v2026_04/models.rb', line 11754

def id
  @id
end

#is_business_customerBoolean (readonly)

Whether the customer is a business or an individual. If true, the customer will be required to fill their full billing address and billing name.

Returns:

  • (Boolean)


11904
11905
11906
# File 'lib/pago/v2026_04/models.rb', line 11904

def is_business_customer
  @is_business_customer
end

#is_discount_applicableBoolean (readonly)

Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable.

Returns:

  • (Boolean)


11881
11882
11883
# File 'lib/pago/v2026_04/models.rb', line 11881

def is_discount_applicable
  @is_discount_applicable
end

#is_free_product_priceBoolean (readonly)

Whether the product price is free, regardless of discounts.

Returns:

  • (Boolean)


11885
11886
11887
# File 'lib/pago/v2026_04/models.rb', line 11885

def is_free_product_price
  @is_free_product_price
end

#is_payment_form_requiredBoolean (readonly)

Whether the checkout requires a payment form, whether because of a payment or payment method setup.

Returns:

  • (Boolean)


11897
11898
11899
# File 'lib/pago/v2026_04/models.rb', line 11897

def is_payment_form_required
  @is_payment_form_required
end

#is_payment_requiredBoolean (readonly)

Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount.

Returns:

  • (Boolean)


11889
11890
11891
# File 'lib/pago/v2026_04/models.rb', line 11889

def is_payment_required
  @is_payment_required
end

#is_payment_setup_requiredBoolean (readonly)

Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles.

Returns:

  • (Boolean)


11893
11894
11895
# File 'lib/pago/v2026_04/models.rb', line 11893

def is_payment_setup_required
  @is_payment_setup_required
end

#localeString? (readonly)

Returns:

  • (String, nil)


11927
11928
11929
# File 'lib/pago/v2026_04/models.rb', line 11927

def locale
  @locale
end

#max_seatsInteger? (readonly)

Maximum number of seats (works with seat-based pricing only)

Returns:

  • (Integer, nil)


11812
11813
11814
# File 'lib/pago/v2026_04/models.rb', line 11812

def max_seats
  @max_seats
end

#min_seatsInteger? (readonly)

Minimum number of seats (works with seat-based pricing only)

Returns:

  • (Integer, nil)


11808
11809
11810
# File 'lib/pago/v2026_04/models.rb', line 11808

def min_seats
  @min_seats
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


11762
11763
11764
# File 'lib/pago/v2026_04/models.rb', line 11762

def modified_at
  @modified_at
end

#net_amountInteger (readonly)

Amount in cents, after discounts but before taxes.

Returns:

  • (Integer)


11820
11821
11822
# File 'lib/pago/v2026_04/models.rb', line 11820

def net_amount
  @net_amount
end

#organizationModels::CheckoutOrganization (readonly)



11956
11957
11958
# File 'lib/pago/v2026_04/models.rb', line 11956

def organization
  @organization
end

#organization_idString (readonly)

ID of the organization owning the checkout session.

Returns:

  • (String)


11856
11857
11858
# File 'lib/pago/v2026_04/models.rb', line 11856

def organization_id
  @organization_id
end

#payment_processorString (readonly)

Returns:

  • (String)


11769
11770
11771
# File 'lib/pago/v2026_04/models.rb', line 11769

def payment_processor
  @payment_processor
end

#payment_processor_metadataHash{String => String} (readonly)

Returns:

  • (Hash{String => String})


11930
11931
11932
# File 'lib/pago/v2026_04/models.rb', line 11930

def 
  @payment_processor_metadata
end

#pricesHash{String => Array<Object>}? (readonly)

Mapping of product IDs to their list of prices.

Returns:

  • (Hash{String => Array<Object>}, nil)


11950
11951
11952
# File 'lib/pago/v2026_04/models.rb', line 11950

def prices
  @prices
end

#productModels::CheckoutProduct? (readonly)

Product selected to checkout.

Returns:



11941
11942
11943
# File 'lib/pago/v2026_04/models.rb', line 11941

def product
  @product
end

#product_idString? (readonly)

ID of the product to checkout.

Returns:

  • (String, nil)


11860
11861
11862
# File 'lib/pago/v2026_04/models.rb', line 11860

def product_id
  @product_id
end

#product_priceObject? (readonly)

Deprecated.

Price of the selected product.

Returns:

  • (Object, nil)


11946
11947
11948
# File 'lib/pago/v2026_04/models.rb', line 11946

def product_price
  @product_price
end

#product_price_idString? (readonly)

Deprecated.

ID of the product price to checkout.

Returns:

  • (String, nil)


11865
11866
11867
# File 'lib/pago/v2026_04/models.rb', line 11865

def product_price_id
  @product_price_id
end

#productsArray<Models::CheckoutProduct> (readonly)

List of products available to select.

Returns:



11937
11938
11939
# File 'lib/pago/v2026_04/models.rb', line 11937

def products
  @products
end

#require_billing_addressBoolean (readonly)

Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to true.

Returns:

  • (Boolean)


11877
11878
11879
# File 'lib/pago/v2026_04/models.rb', line 11877

def require_billing_address
  @require_billing_address
end

#return_urlString? (readonly)

When set, a back button will be shown in the checkout to return to this URL.

Returns:

  • (String, nil)


11792
11793
11794
# File 'lib/pago/v2026_04/models.rb', line 11792

def return_url
  @return_url
end

#seatsInteger? (readonly)

Predefined number of seats (works with seat-based pricing only)

Returns:

  • (Integer, nil)


11804
11805
11806
# File 'lib/pago/v2026_04/models.rb', line 11804

def seats
  @seats
end

#statusString (readonly)

Returns:

  • (String)


11772
11773
11774
# File 'lib/pago/v2026_04/models.rb', line 11772

def status
  @status
end

#success_urlString (readonly)

URL where the customer will be redirected after a successful payment.

Returns:

  • (String)


11788
11789
11790
# File 'lib/pago/v2026_04/models.rb', line 11788

def success_url
  @success_url
end

#tax_amountInteger? (readonly)

Sales tax amount in cents. If null, it means there is no enough information yet to calculate it.

Returns:

  • (Integer, nil)


11824
11825
11826
# File 'lib/pago/v2026_04/models.rb', line 11824

def tax_amount
  @tax_amount
end

#tax_behaviorString? (readonly)

Tax behavior of the checkout. inclusive means the price includes tax, exclusive means tax is added on top. If null, tax is not yet calculated.

Returns:

  • (String, nil)


11828
11829
11830
# File 'lib/pago/v2026_04/models.rb', line 11828

def tax_behavior
  @tax_behavior
end

#total_amountInteger (readonly)

Amount in cents, after discounts and taxes.

Returns:

  • (Integer)


11832
11833
11834
# File 'lib/pago/v2026_04/models.rb', line 11832

def total_amount
  @total_amount
end

#trial_endString? (readonly)

End date and time of the trial period, if any.

Returns:

  • (String, nil)


11852
11853
11854
# File 'lib/pago/v2026_04/models.rb', line 11852

def trial_end
  @trial_end
end

#urlString (readonly)

URL where the customer can access the checkout session.

Returns:

  • (String)


11780
11781
11782
# File 'lib/pago/v2026_04/models.rb', line 11780

def url
  @url
end

Class Method Details

.from_json(data) ⇒ CheckoutPublic?

Parameters:

  • data (Hash, String, nil)

Returns:



12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
# File 'lib/pago/v2026_04/models.rb', line 12078

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      custom_field_data: (data.key?("custom_field_data") ? data["custom_field_data"] : ::Pago::UNSET),
      payment_processor: (data.key?("payment_processor") ? data["payment_processor"] : ::Pago::UNSET),
      status: (data.key?("status") ? data["status"] : ::Pago::UNSET),
      client_secret: (data.key?("client_secret") ? data["client_secret"] : ::Pago::UNSET),
      url: (data.key?("url") ? data["url"] : ::Pago::UNSET),
      expires_at: (data.key?("expires_at") ? data["expires_at"] : ::Pago::UNSET),
      success_url: (data.key?("success_url") ? data["success_url"] : ::Pago::UNSET),
      return_url: (data.key?("return_url") ? data["return_url"] : ::Pago::UNSET),
      embed_origin: (data.key?("embed_origin") ? data["embed_origin"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      seats: (data.key?("seats") ? data["seats"] : ::Pago::UNSET),
      min_seats: (data.key?("min_seats") ? data["min_seats"] : ::Pago::UNSET),
      max_seats: (data.key?("max_seats") ? data["max_seats"] : ::Pago::UNSET),
      discount_amount: (data.key?("discount_amount") ? data["discount_amount"] : ::Pago::UNSET),
      net_amount: (data.key?("net_amount") ? data["net_amount"] : ::Pago::UNSET),
      tax_amount: (data.key?("tax_amount") ? data["tax_amount"] : ::Pago::UNSET),
      tax_behavior: (data.key?("tax_behavior") ? data["tax_behavior"] : ::Pago::UNSET),
      total_amount: (data.key?("total_amount") ? data["total_amount"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET),
      allow_trial: (data.key?("allow_trial") ? data["allow_trial"] : ::Pago::UNSET),
      active_trial_interval: (data.key?("active_trial_interval") ? data["active_trial_interval"] : ::Pago::UNSET),
      active_trial_interval_count: (data.key?("active_trial_interval_count") ? data["active_trial_interval_count"] : ::Pago::UNSET),
      trial_end: (data.key?("trial_end") ? data["trial_end"] : ::Pago::UNSET),
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      product_price_id: (data.key?("product_price_id") ? data["product_price_id"] : ::Pago::UNSET),
      discount_id: (data.key?("discount_id") ? data["discount_id"] : ::Pago::UNSET),
      allow_discount_codes: (data.key?("allow_discount_codes") ? data["allow_discount_codes"] : ::Pago::UNSET),
      require_billing_address: (data.key?("require_billing_address") ? data["require_billing_address"] : ::Pago::UNSET),
      is_discount_applicable: (data.key?("is_discount_applicable") ? data["is_discount_applicable"] : ::Pago::UNSET),
      is_free_product_price: (data.key?("is_free_product_price") ? data["is_free_product_price"] : ::Pago::UNSET),
      is_payment_required: (data.key?("is_payment_required") ? data["is_payment_required"] : ::Pago::UNSET),
      is_payment_setup_required: (data.key?("is_payment_setup_required") ? data["is_payment_setup_required"] : ::Pago::UNSET),
      is_payment_form_required: (data.key?("is_payment_form_required") ? data["is_payment_form_required"] : ::Pago::UNSET),
      customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET),
      is_business_customer: (data.key?("is_business_customer") ? data["is_business_customer"] : ::Pago::UNSET),
      customer_name: (data.key?("customer_name") ? data["customer_name"] : ::Pago::UNSET),
      customer_email: (data.key?("customer_email") ? data["customer_email"] : ::Pago::UNSET),
      customer_ip_address: (data.key?("customer_ip_address") ? data["customer_ip_address"] : ::Pago::UNSET),
      customer_billing_name: (data.key?("customer_billing_name") ? data["customer_billing_name"] : ::Pago::UNSET),
      customer_billing_address: (data.key?("customer_billing_address") ? Models::Address.from_json(data["customer_billing_address"]) : ::Pago::UNSET),
      customer_tax_id: (data.key?("customer_tax_id") ? data["customer_tax_id"] : ::Pago::UNSET),
      locale: (data.key?("locale") ? data["locale"] : ::Pago::UNSET),
      payment_processor_metadata: (data.key?("payment_processor_metadata") ? data["payment_processor_metadata"] : ::Pago::UNSET),
      billing_address_fields: (data.key?("billing_address_fields") ? Models::CheckoutBillingAddressFields.from_json(data["billing_address_fields"]) : ::Pago::UNSET),
      products: (data.key?("products") ? ::Pago::Serde.array(data["products"]) { |item0| Models::CheckoutProduct.from_json(item0) } : ::Pago::UNSET),
      product: (data.key?("product") ? Models::CheckoutProduct.from_json(data["product"]) : ::Pago::UNSET),
      product_price: (data.key?("product_price") ? ::Pago::Serde.union(data["product_price"], variants: [Unions::LegacyRecurringProductPrice, Unions::ProductPrice]) : ::Pago::UNSET),
      prices: (data.key?("prices") ? ::Pago::Serde.map(data["prices"]) { |value0| ::Pago::Serde.array(value0) { |item1| ::Pago::Serde.union(item1, variants: [Unions::LegacyRecurringProductPrice, Unions::ProductPrice]) } } : ::Pago::UNSET),
      discount: (data.key?("discount") ? ::Pago::Serde.union(data["discount"], variants: [Models::CheckoutDiscountFixedOnceForeverDuration, Models::CheckoutDiscountFixedRepeatDuration, Models::CheckoutDiscountPercentageOnceForeverDuration, Models::CheckoutDiscountPercentageRepeatDuration]) : ::Pago::UNSET),
      organization: (data.key?("organization") ? Models::CheckoutOrganization.from_json(data["organization"]) : ::Pago::UNSET),
      attached_custom_fields: (data.key?("attached_custom_fields") ? ::Pago::Serde.array(data["attached_custom_fields"]) { |item0| Models::AttachedCustomField.from_json(item0) } : ::Pago::UNSET)
    ),
    data
  )
end