Class: Pago::V2026_04::Models::SubscriptionCreateExternalCustomer
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Create a subscription for an existing customer identified by an external ID.
Constant Summary collapse
- JSON_KEYS =
{ metadata: "metadata", product_id: "product_id", external_customer_id: "external_customer_id" }.freeze
- REQUIRED_KEYS =
["product_id", "external_customer_id"].freeze
Instance Attribute Summary collapse
-
#external_customer_id ⇒ String
readonly
The ID of the customer in your system to create the subscription for.
-
#metadata ⇒ Hash{String => String, Integer, Float, Boolean}
readonly
Key-value object allowing you to store additional information.
-
#product_id ⇒ String
readonly
The ID of the recurring product to subscribe to.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata: ::Pago::UNSET, product_id:, external_customer_id:) ⇒ SubscriptionCreateExternalCustomer
constructor
A new instance of SubscriptionCreateExternalCustomer.
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, product_id:, external_customer_id:) ⇒ SubscriptionCreateExternalCustomer
Returns a new instance of SubscriptionCreateExternalCustomer.
40151 40152 40153 40154 40155 40156 40157 40158 40159 40160 |
# File 'lib/pago/v2026_04/models.rb', line 40151 def initialize( metadata: ::Pago::UNSET, product_id:, external_customer_id: ) super() assign(:metadata, ) assign(:product_id, product_id) assign(:external_customer_id, external_customer_id) end |
Instance Attribute Details
#external_customer_id ⇒ String (readonly)
The ID of the customer in your system to create the subscription for. It must already exist in Pago.
40149 40150 40151 |
# File 'lib/pago/v2026_04/models.rb', line 40149 def external_customer_id @external_customer_id end |
#metadata ⇒ Hash{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.
40141 40142 40143 |
# File 'lib/pago/v2026_04/models.rb', line 40141 def @metadata end |
#product_id ⇒ String (readonly)
The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.
40145 40146 40147 |
# File 'lib/pago/v2026_04/models.rb', line 40145 def product_id @product_id end |
Class Method Details
.from_json(data) ⇒ SubscriptionCreateExternalCustomer?
40164 40165 40166 40167 40168 40169 40170 40171 40172 40173 40174 40175 40176 40177 |
# File 'lib/pago/v2026_04/models.rb', line 40164 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), product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET), external_customer_id: (data.key?("external_customer_id") ? data["external_customer_id"] : ::Pago::UNSET) ), data ) end |