Class: Pago::V2026_04::Models::CheckoutLink

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

Overview

Checkout link data.

Constant Summary collapse

JSON_KEYS =

Returns:

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

Returns:

  • (Array[String])
["id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "metadata", "payment_processor", "client_secret", "success_url", "return_url", "label", "allow_discount_codes", "require_billing_address", "discount_id", "seats", "organization_id", "products", "discount", "url"].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:, trial_interval:, trial_interval_count:, metadata:, payment_processor:, client_secret:, success_url:, return_url:, label:, allow_discount_codes:, require_billing_address:, discount_id:, seats:, organization_id:, products:, discount:, url:) ⇒ CheckoutLink

Returns a new instance of CheckoutLink.

Parameters:

  • id: (String)
  • created_at: (String)
  • modified_at: (String, nil)
  • trial_interval: (String, nil)
  • trial_interval_count: (Integer, nil)
  • metadata: (Hash[String, untyped])
  • payment_processor: (String)
  • client_secret: (String)
  • success_url: (String, nil)
  • return_url: (String, nil)
  • label: (String, nil)
  • allow_discount_codes: (Boolean)
  • require_billing_address: (Boolean)
  • discount_id: (String, nil)
  • seats: (Integer, nil)
  • organization_id: (String)
  • products: (Array[Models::CheckoutLinkProduct])
  • discount: (Object)
  • url: (String)


10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
# File 'lib/pago/v2026_04/models.rb', line 10660

def initialize(
  id:,
  created_at:,
  modified_at:,
  trial_interval:,
  trial_interval_count:,
  metadata:,
  payment_processor:,
  client_secret:,
  success_url:,
  return_url:,
  label:,
  allow_discount_codes:,
  require_billing_address:,
  discount_id:,
  seats:,
  organization_id:,
  products:,
  discount:,
  url:
)
  super()
  assign(:id, id)
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:trial_interval, trial_interval)
  assign(:trial_interval_count, trial_interval_count)
  assign(:metadata, )
  assign(:payment_processor, payment_processor)
  assign(:client_secret, client_secret)
  assign(:success_url, success_url)
  assign(:return_url, return_url)
  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(:organization_id, organization_id)
  assign(:products, products)
  assign(:discount, discount)
  assign(:url, url)
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)


10633
10634
10635
# File 'lib/pago/v2026_04/models.rb', line 10633

def allow_discount_codes
  @allow_discount_codes
end

#client_secretString (readonly)

Client secret used to access the checkout link.

Returns:

  • (String)


10617
10618
10619
# File 'lib/pago/v2026_04/models.rb', line 10617

def client_secret
  @client_secret
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


10595
10596
10597
# File 'lib/pago/v2026_04/models.rb', line 10595

def created_at
  @created_at
end

#discountModels::DiscountFixedOnceForeverDurationBase, ... (readonly)



10655
10656
10657
# File 'lib/pago/v2026_04/models.rb', line 10655

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


10641
10642
10643
# File 'lib/pago/v2026_04/models.rb', line 10641

def discount_id
  @discount_id
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


10591
10592
10593
# File 'lib/pago/v2026_04/models.rb', line 10591

def id
  @id
end

#labelString? (readonly)

Optional label to distinguish links internally

Returns:

  • (String, nil)


10629
10630
10631
# File 'lib/pago/v2026_04/models.rb', line 10629

def label
  @label
end

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

Returns:

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


10610
10611
10612
# File 'lib/pago/v2026_04/models.rb', line 10610

def 
  @metadata
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


10599
10600
10601
# File 'lib/pago/v2026_04/models.rb', line 10599

def modified_at
  @modified_at
end

#organization_idString (readonly)

The organization ID.

Returns:

  • (String)


10649
10650
10651
# File 'lib/pago/v2026_04/models.rb', line 10649

def organization_id
  @organization_id
end

#payment_processorString (readonly)

Returns:

  • (String)


10613
10614
10615
# File 'lib/pago/v2026_04/models.rb', line 10613

def payment_processor
  @payment_processor
end

#productsArray<Models::CheckoutLinkProduct> (readonly)

Returns:



10652
10653
10654
# File 'lib/pago/v2026_04/models.rb', line 10652

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)


10637
10638
10639
# File 'lib/pago/v2026_04/models.rb', line 10637

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)


10625
10626
10627
# File 'lib/pago/v2026_04/models.rb', line 10625

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)


10645
10646
10647
# File 'lib/pago/v2026_04/models.rb', line 10645

def seats
  @seats
end

#success_urlString? (readonly)

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

Returns:

  • (String, nil)


10621
10622
10623
# File 'lib/pago/v2026_04/models.rb', line 10621

def success_url
  @success_url
end

#trial_intervalString? (readonly)

The interval unit for the trial period.

Returns:

  • (String, nil)


10603
10604
10605
# File 'lib/pago/v2026_04/models.rb', line 10603

def trial_interval
  @trial_interval
end

#trial_interval_countInteger? (readonly)

The number of interval units for the trial period.

Returns:

  • (Integer, nil)


10607
10608
10609
# File 'lib/pago/v2026_04/models.rb', line 10607

def trial_interval_count
  @trial_interval_count
end

#urlString (readonly)

Returns:

  • (String)


10658
10659
10660
# File 'lib/pago/v2026_04/models.rb', line 10658

def url
  @url
end

Class Method Details

.from_json(data) ⇒ CheckoutLink?

Parameters:

  • data (Hash, String, nil)

Returns:



10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
# File 'lib/pago/v2026_04/models.rb', line 10705

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),
      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),
      payment_processor: (data.key?("payment_processor") ? data["payment_processor"] : ::Pago::UNSET),
      client_secret: (data.key?("client_secret") ? data["client_secret"] : ::Pago::UNSET),
      success_url: (data.key?("success_url") ? data["success_url"] : ::Pago::UNSET),
      return_url: (data.key?("return_url") ? data["return_url"] : ::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),
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      products: (data.key?("products") ? ::Pago::Serde.array(data["products"]) { |item0| Models::CheckoutLinkProduct.from_json(item0) } : ::Pago::UNSET),
      discount: (data.key?("discount") ? ::Pago::Serde.union(data["discount"], variants: [Models::DiscountFixedOnceForeverDurationBase, Models::DiscountFixedRepeatDurationBase, Models::DiscountPercentageOnceForeverDurationBase, Models::DiscountPercentageRepeatDurationBase]) : ::Pago::UNSET),
      url: (data.key?("url") ? data["url"] : ::Pago::UNSET)
    ),
    data
  )
end