Class: Pago::V2026_04::Models::CheckoutCreate

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

Overview

Create a new checkout session from a list of products. Customers will be able to switch between those products.

Metadata set on the checkout will be copied to the resulting order and/or subscription.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  trial_interval: "trial_interval",
  trial_interval_count: "trial_interval_count",
  metadata: "metadata",
  custom_field_data: "custom_field_data",
  discount_id: "discount_id",
  allow_discount_codes: "allow_discount_codes",
  require_billing_address: "require_billing_address",
  amount: "amount",
  seats: "seats",
  min_seats: "min_seats",
  max_seats: "max_seats",
  allow_trial: "allow_trial",
  customer_id: "customer_id",
  is_business_customer: "is_business_customer",
  external_customer_id: "external_customer_id",
  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",
  customer_metadata: "customer_metadata",
  subscription_id: "subscription_id",
  success_url: "success_url",
  return_url: "return_url",
  embed_origin: "embed_origin",
  locale: "locale",
  currency: "currency",
  products: "products",
  prices: "prices"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["products"].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(trial_interval: ::Pago::UNSET, trial_interval_count: ::Pago::UNSET, metadata: ::Pago::UNSET, custom_field_data: ::Pago::UNSET, discount_id: ::Pago::UNSET, allow_discount_codes: ::Pago::UNSET, require_billing_address: ::Pago::UNSET, amount: ::Pago::UNSET, seats: ::Pago::UNSET, min_seats: ::Pago::UNSET, max_seats: ::Pago::UNSET, allow_trial: ::Pago::UNSET, customer_id: ::Pago::UNSET, is_business_customer: ::Pago::UNSET, external_customer_id: ::Pago::UNSET, customer_name: ::Pago::UNSET, customer_email: ::Pago::UNSET, customer_ip_address: ::Pago::UNSET, customer_billing_name: ::Pago::UNSET, customer_billing_address: ::Pago::UNSET, customer_tax_id: ::Pago::UNSET, customer_metadata: ::Pago::UNSET, subscription_id: ::Pago::UNSET, success_url: ::Pago::UNSET, return_url: ::Pago::UNSET, embed_origin: ::Pago::UNSET, locale: ::Pago::UNSET, currency: ::Pago::UNSET, products:, prices: ::Pago::UNSET) ⇒ CheckoutCreate

Returns a new instance of CheckoutCreate.

Parameters:

  • trial_interval: (String, nil) (defaults to: ::Pago::UNSET)
  • trial_interval_count: (Integer, nil) (defaults to: ::Pago::UNSET)
  • metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • custom_field_data: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • discount_id: (String, nil) (defaults to: ::Pago::UNSET)
  • allow_discount_codes: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • require_billing_address: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • amount: (Integer, nil) (defaults to: ::Pago::UNSET)
  • seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • min_seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • max_seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • allow_trial: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • customer_id: (String, nil) (defaults to: ::Pago::UNSET)
  • is_business_customer: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • external_customer_id: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_name: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_email: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_ip_address: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_billing_name: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_billing_address: (Models::AddressInput, nil) (defaults to: ::Pago::UNSET)
  • customer_tax_id: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • subscription_id: (String, nil) (defaults to: ::Pago::UNSET)
  • success_url: (String, nil) (defaults to: ::Pago::UNSET)
  • return_url: (String, nil) (defaults to: ::Pago::UNSET)
  • embed_origin: (String, nil) (defaults to: ::Pago::UNSET)
  • locale: (String, nil) (defaults to: ::Pago::UNSET)
  • currency: (String, nil) (defaults to: ::Pago::UNSET)
  • products: (Array[String])
  • prices: (Hash[String, Array[untyped]], nil) (defaults to: ::Pago::UNSET)


9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
# File 'lib/pago/v2026_04/models.rb', line 9943

def initialize(
  trial_interval: ::Pago::UNSET,
  trial_interval_count: ::Pago::UNSET,
  metadata: ::Pago::UNSET,
  custom_field_data: ::Pago::UNSET,
  discount_id: ::Pago::UNSET,
  allow_discount_codes: ::Pago::UNSET,
  require_billing_address: ::Pago::UNSET,
  amount: ::Pago::UNSET,
  seats: ::Pago::UNSET,
  min_seats: ::Pago::UNSET,
  max_seats: ::Pago::UNSET,
  allow_trial: ::Pago::UNSET,
  customer_id: ::Pago::UNSET,
  is_business_customer: ::Pago::UNSET,
  external_customer_id: ::Pago::UNSET,
  customer_name: ::Pago::UNSET,
  customer_email: ::Pago::UNSET,
  customer_ip_address: ::Pago::UNSET,
  customer_billing_name: ::Pago::UNSET,
  customer_billing_address: ::Pago::UNSET,
  customer_tax_id: ::Pago::UNSET,
  customer_metadata: ::Pago::UNSET,
  subscription_id: ::Pago::UNSET,
  success_url: ::Pago::UNSET,
  return_url: ::Pago::UNSET,
  embed_origin: ::Pago::UNSET,
  locale: ::Pago::UNSET,
  currency: ::Pago::UNSET,
  products:,
  prices: ::Pago::UNSET
)
  super()
  assign(:trial_interval, trial_interval)
  assign(:trial_interval_count, trial_interval_count)
  assign(:metadata, )
  assign(:custom_field_data, custom_field_data)
  assign(:discount_id, discount_id)
  assign(:allow_discount_codes, allow_discount_codes)
  assign(:require_billing_address, require_billing_address)
  assign(:amount, amount)
  assign(:seats, seats)
  assign(:min_seats, min_seats)
  assign(:max_seats, max_seats)
  assign(:allow_trial, allow_trial)
  assign(:customer_id, customer_id)
  assign(:is_business_customer, is_business_customer)
  assign(:external_customer_id, external_customer_id)
  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(:customer_metadata, )
  assign(:subscription_id, subscription_id)
  assign(:success_url, success_url)
  assign(:return_url, return_url)
  assign(:embed_origin, embed_origin)
  assign(:locale, locale)
  assign(:currency, currency)
  assign(:products, products)
  assign(:prices, prices)
end

Instance Attribute Details

#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)


9844
9845
9846
# File 'lib/pago/v2026_04/models.rb', line 9844

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)


9867
9868
9869
# File 'lib/pago/v2026_04/models.rb', line 9867

def allow_trial
  @allow_trial
end

#amountInteger? (readonly)

Returns:

  • (Integer, nil)


9851
9852
9853
# File 'lib/pago/v2026_04/models.rb', line 9851

def amount
  @amount
end

#currencyString? (readonly)

Returns:

  • (String, nil)


9933
9934
9935
# File 'lib/pago/v2026_04/models.rb', line 9933

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})


9836
9837
9838
# File 'lib/pago/v2026_04/models.rb', line 9836

def custom_field_data
  @custom_field_data
end

#customer_billing_addressModels::AddressInput? (readonly)

Returns:



9894
9895
9896
# File 'lib/pago/v2026_04/models.rb', line 9894

def customer_billing_address
  @customer_billing_address
end

#customer_billing_nameString? (readonly)

Returns:

  • (String, nil)


9891
9892
9893
# File 'lib/pago/v2026_04/models.rb', line 9891

def customer_billing_name
  @customer_billing_name
end

#customer_emailString? (readonly)

Returns:

  • (String, nil)


9885
9886
9887
# File 'lib/pago/v2026_04/models.rb', line 9885

def customer_email
  @customer_email
end

#customer_idString? (readonly)

ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer.

Returns:

  • (String, nil)


9871
9872
9873
# File 'lib/pago/v2026_04/models.rb', line 9871

def customer_id
  @customer_id
end

#customer_ip_addressString? (readonly)

Returns:

  • (String, nil)


9888
9889
9890
# File 'lib/pago/v2026_04/models.rb', line 9888

def customer_ip_address
  @customer_ip_address
end

#customer_metadataHash{String => String, Integer, Float, Boolean} (readonly)

Key-value object allowing you to store additional information that'll be copied to the created customer.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Returns:

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


9911
9912
9913
# File 'lib/pago/v2026_04/models.rb', line 9911

def 
  @customer_metadata
end

#customer_nameString? (readonly)

Returns:

  • (String, nil)


9882
9883
9884
# File 'lib/pago/v2026_04/models.rb', line 9882

def customer_name
  @customer_name
end

#customer_tax_idString? (readonly)

Returns:

  • (String, nil)


9897
9898
9899
# File 'lib/pago/v2026_04/models.rb', line 9897

def customer_tax_id
  @customer_tax_id
end

#discount_idString? (readonly)

ID of the discount to apply to the checkout.

Returns:

  • (String, nil)


9840
9841
9842
# File 'lib/pago/v2026_04/models.rb', line 9840

def discount_id
  @discount_id
end

#embed_originString? (readonly)

If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Pago iframe to communicate with the parent page.

Returns:

  • (String, nil)


9927
9928
9929
# File 'lib/pago/v2026_04/models.rb', line 9927

def embed_origin
  @embed_origin
end

#external_customer_idString? (readonly)

ID of the customer in your system. If a matching customer exists on Pago, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set.

Returns:

  • (String, nil)


9879
9880
9881
# File 'lib/pago/v2026_04/models.rb', line 9879

def external_customer_id
  @external_customer_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)


9875
9876
9877
# File 'lib/pago/v2026_04/models.rb', line 9875

def is_business_customer
  @is_business_customer
end

#localeString? (readonly)

Returns:

  • (String, nil)


9930
9931
9932
# File 'lib/pago/v2026_04/models.rb', line 9930

def locale
  @locale
end

#max_seatsInteger? (readonly)

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

Returns:

  • (Integer, nil)


9863
9864
9865
# File 'lib/pago/v2026_04/models.rb', line 9863

def max_seats
  @max_seats
end

#metadataHash{String => String, Integer, Float, Boolean} (readonly)

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Returns:

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


9832
9833
9834
# File 'lib/pago/v2026_04/models.rb', line 9832

def 
  @metadata
end

#min_seatsInteger? (readonly)

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

Returns:

  • (Integer, nil)


9859
9860
9861
# File 'lib/pago/v2026_04/models.rb', line 9859

def min_seats
  @min_seats
end

#pricesHash{String => Array<Models::ProductPriceFixedCreate, Models::ProductPriceCustomCreate, Models::ProductPriceSeatBasedCreate, Models::ProductPriceMeteredUnitCreate>}? (readonly)

Optional mapping of product IDs to a list of ad-hoc prices to create for that product. If not set, catalog prices of the product will be used.



9941
9942
9943
# File 'lib/pago/v2026_04/models.rb', line 9941

def prices
  @prices
end

#productsArray<String> (readonly)

List of product IDs available to select at that checkout. The first one will be selected by default.

Returns:

  • (Array<String>)


9937
9938
9939
# File 'lib/pago/v2026_04/models.rb', line 9937

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)


9848
9849
9850
# File 'lib/pago/v2026_04/models.rb', line 9848

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)


9923
9924
9925
# File 'lib/pago/v2026_04/models.rb', line 9923

def return_url
  @return_url
end

#seatsInteger? (readonly)

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

Returns:

  • (Integer, nil)


9855
9856
9857
# File 'lib/pago/v2026_04/models.rb', line 9855

def seats
  @seats
end

#subscription_idString? (readonly)

ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten.

Returns:

  • (String, nil)


9915
9916
9917
# File 'lib/pago/v2026_04/models.rb', line 9915

def subscription_id
  @subscription_id
end

#success_urlString? (readonly)

URL where the customer will be redirected after a successful payment.You can add the checkout_id={CHECKOUT_ID} query parameter to retrieve the checkout session id.

Returns:

  • (String, nil)


9919
9920
9921
# File 'lib/pago/v2026_04/models.rb', line 9919

def success_url
  @success_url
end

#trial_intervalString? (readonly)

The interval unit for the trial period.

Returns:

  • (String, nil)


9814
9815
9816
# File 'lib/pago/v2026_04/models.rb', line 9814

def trial_interval
  @trial_interval
end

#trial_interval_countInteger? (readonly)

The number of interval units for the trial period.

Returns:

  • (Integer, nil)


9818
9819
9820
# File 'lib/pago/v2026_04/models.rb', line 9818

def trial_interval_count
  @trial_interval_count
end

Class Method Details

.from_json(data) ⇒ CheckoutCreate?

Parameters:

  • data (Hash, String, nil)

Returns:



10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
# File 'lib/pago/v2026_04/models.rb', line 10010

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(
      trial_interval: (data.key?("trial_interval") ? data["trial_interval"] : ::Pago::UNSET),
      trial_interval_count: (data.key?("trial_interval_count") ? data["trial_interval_count"] : ::Pago::UNSET),
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      custom_field_data: (data.key?("custom_field_data") ? data["custom_field_data"] : ::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),
      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),
      allow_trial: (data.key?("allow_trial") ? data["allow_trial"] : ::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),
      external_customer_id: (data.key?("external_customer_id") ? data["external_customer_id"] : ::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::AddressInput.from_json(data["customer_billing_address"]) : ::Pago::UNSET),
      customer_tax_id: (data.key?("customer_tax_id") ? data["customer_tax_id"] : ::Pago::UNSET),
      customer_metadata: (data.key?("customer_metadata") ? data["customer_metadata"] : ::Pago::UNSET),
      subscription_id: (data.key?("subscription_id") ? data["subscription_id"] : ::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),
      locale: (data.key?("locale") ? data["locale"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET),
      products: (data.key?("products") ? data["products"] : ::Pago::UNSET),
      prices: (data.key?("prices") ? ::Pago::Serde.map(data["prices"]) { |value0| ::Pago::Serde.array(value0) { |item1| ::Pago::Serde.union(item1, discriminator: "amount_type", mapping: { "custom" => Models::ProductPriceCustomCreate, "fixed" => Models::ProductPriceFixedCreate, "metered_unit" => Models::ProductPriceMeteredUnitCreate, "seat_based" => Models::ProductPriceSeatBasedCreate }, variants: [Models::ProductPriceFixedCreate, Models::ProductPriceCustomCreate, Models::ProductPriceSeatBasedCreate, Models::ProductPriceMeteredUnitCreate]) } } : ::Pago::UNSET)
    ),
    data
  )
end