Class: Pago::V2026_04::Models::CheckoutLinkCreateProducts

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

Overview

Schema to create a new checkout link.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  metadata: "metadata",
  trial_interval: "trial_interval",
  trial_interval_count: "trial_interval_count",
  payment_processor: "payment_processor",
  label: "label",
  allow_discount_codes: "allow_discount_codes",
  require_billing_address: "require_billing_address",
  discount_id: "discount_id",
  seats: "seats",
  success_url: "success_url",
  return_url: "return_url",
  products: "products"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["payment_processor", "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(metadata: ::Pago::UNSET, trial_interval: ::Pago::UNSET, trial_interval_count: ::Pago::UNSET, payment_processor:, label: ::Pago::UNSET, allow_discount_codes: ::Pago::UNSET, require_billing_address: ::Pago::UNSET, discount_id: ::Pago::UNSET, seats: ::Pago::UNSET, success_url: ::Pago::UNSET, return_url: ::Pago::UNSET, products:) ⇒ CheckoutLinkCreateProducts

Returns a new instance of CheckoutLinkCreateProducts.

Parameters:

  • metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • trial_interval: (String, nil) (defaults to: ::Pago::UNSET)
  • trial_interval_count: (Integer, nil) (defaults to: ::Pago::UNSET)
  • payment_processor: (String)
  • label: (String, nil) (defaults to: ::Pago::UNSET)
  • allow_discount_codes: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • require_billing_address: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • discount_id: (String, nil) (defaults to: ::Pago::UNSET)
  • seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • success_url: (String, nil) (defaults to: ::Pago::UNSET)
  • return_url: (String, nil) (defaults to: ::Pago::UNSET)
  • products: (Array[String])


11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
# File 'lib/pago/v2026_04/models.rb', line 11079

def initialize(
  metadata: ::Pago::UNSET,
  trial_interval: ::Pago::UNSET,
  trial_interval_count: ::Pago::UNSET,
  payment_processor:,
  label: ::Pago::UNSET,
  allow_discount_codes: ::Pago::UNSET,
  require_billing_address: ::Pago::UNSET,
  discount_id: ::Pago::UNSET,
  seats: ::Pago::UNSET,
  success_url: ::Pago::UNSET,
  return_url: ::Pago::UNSET,
  products:
)
  super()
  assign(:metadata, )
  assign(:trial_interval, trial_interval)
  assign(:trial_interval_count, trial_interval_count)
  assign(:payment_processor, payment_processor)
  assign(:label, label)
  assign(:allow_discount_codes, allow_discount_codes)
  assign(:require_billing_address, require_billing_address)
  assign(:discount_id, discount_id)
  assign(:seats, seats)
  assign(:success_url, success_url)
  assign(:return_url, return_url)
  assign(:products, products)
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)


11053
11054
11055
# File 'lib/pago/v2026_04/models.rb', line 11053

def allow_discount_codes
  @allow_discount_codes
end

#discount_idString? (readonly)

ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored.

Returns:

  • (String, nil)


11061
11062
11063
# File 'lib/pago/v2026_04/models.rb', line 11061

def discount_id
  @discount_id
end

#labelString? (readonly)

Optional label to distinguish links internally

Returns:

  • (String, nil)


11049
11050
11051
# File 'lib/pago/v2026_04/models.rb', line 11049

def label
  @label
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})


11033
11034
11035
# File 'lib/pago/v2026_04/models.rb', line 11033

def 
  @metadata
end

#payment_processorString (readonly)

Payment processor to use. Currently only Stripe is supported.

Returns:

  • (String)


11045
11046
11047
# File 'lib/pago/v2026_04/models.rb', line 11045

def payment_processor
  @payment_processor
end

#productsArray<String> (readonly)

List of products that will be available to select at checkout.

Returns:

  • (Array<String>)


11077
11078
11079
# File 'lib/pago/v2026_04/models.rb', line 11077

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.

Returns:

  • (Boolean)


11057
11058
11059
# File 'lib/pago/v2026_04/models.rb', line 11057

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)


11073
11074
11075
# File 'lib/pago/v2026_04/models.rb', line 11073

def return_url
  @return_url
end

#seatsInteger? (readonly)

Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored.

Returns:

  • (Integer, nil)


11065
11066
11067
# File 'lib/pago/v2026_04/models.rb', line 11065

def seats
  @seats
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)


11069
11070
11071
# File 'lib/pago/v2026_04/models.rb', line 11069

def success_url
  @success_url
end

#trial_intervalString? (readonly)

The interval unit for the trial period.

Returns:

  • (String, nil)


11037
11038
11039
# File 'lib/pago/v2026_04/models.rb', line 11037

def trial_interval
  @trial_interval
end

#trial_interval_countInteger? (readonly)

The number of interval units for the trial period.

Returns:

  • (Integer, nil)


11041
11042
11043
# File 'lib/pago/v2026_04/models.rb', line 11041

def trial_interval_count
  @trial_interval_count
end

Class Method Details

.from_json(data) ⇒ CheckoutLinkCreateProducts?

Parameters:

  • data (Hash, String, nil)

Returns:



11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
# File 'lib/pago/v2026_04/models.rb', line 11110

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(
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      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),
      payment_processor: (data.key?("payment_processor") ? data["payment_processor"] : ::Pago::UNSET),
      label: (data.key?("label") ? data["label"] : ::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),
      discount_id: (data.key?("discount_id") ? data["discount_id"] : ::Pago::UNSET),
      seats: (data.key?("seats") ? data["seats"] : ::Pago::UNSET),
      success_url: (data.key?("success_url") ? data["success_url"] : ::Pago::UNSET),
      return_url: (data.key?("return_url") ? data["return_url"] : ::Pago::UNSET),
      products: (data.key?("products") ? data["products"] : ::Pago::UNSET)
    ),
    data
  )
end