Class: Pago::V2026_04::Models::OrderCreate
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Schema to create a draft order for an off-session charge.
Constant Summary collapse
- JSON_KEYS =
{ custom_field_data: "custom_field_data", metadata: "metadata", organization_id: "organization_id", customer_id: "customer_id", product_id: "product_id", currency: "currency", amount: "amount", description: "description" }.freeze
- REQUIRED_KEYS =
["customer_id", "product_id"].freeze
Instance Attribute Summary collapse
-
#amount ⇒ Integer?
readonly
A custom amount to charge, in the smallest currency unit.
-
#currency ⇒ String?
readonly
The currency to charge in (ISO 4217, lowercase, e.g.
usd). -
#custom_field_data ⇒ Hash{String => String, Integer, Boolean, nil}
readonly
Key-value object storing custom field values.
-
#customer_id ⇒ String
readonly
The ID of the customer the order is for.
-
#description ⇒ String?
readonly
A custom description for the order's line item, shown on the invoice and receipt (e.g.
5,000 tokens). -
#metadata ⇒ Hash{String => String, Integer, Float, Boolean}
readonly
Key-value object allowing you to store additional information.
-
#organization_id ⇒ String?
readonly
The ID of the organization the order belongs to.
-
#product_id ⇒ String
readonly
The ID of the one-time product to charge for.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(custom_field_data: ::Pago::UNSET, metadata: ::Pago::UNSET, organization_id: ::Pago::UNSET, customer_id:, product_id:, currency: ::Pago::UNSET, amount: ::Pago::UNSET, description: ::Pago::UNSET) ⇒ OrderCreate
constructor
A new instance of OrderCreate.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(custom_field_data: ::Pago::UNSET, metadata: ::Pago::UNSET, organization_id: ::Pago::UNSET, customer_id:, product_id:, currency: ::Pago::UNSET, amount: ::Pago::UNSET, description: ::Pago::UNSET) ⇒ OrderCreate
Returns a new instance of OrderCreate.
32234 32235 32236 32237 32238 32239 32240 32241 32242 32243 32244 32245 32246 32247 32248 32249 32250 32251 32252 32253 |
# File 'lib/pago/v2026_04/models.rb', line 32234 def initialize( custom_field_data: ::Pago::UNSET, metadata: ::Pago::UNSET, organization_id: ::Pago::UNSET, customer_id:, product_id:, currency: ::Pago::UNSET, amount: ::Pago::UNSET, description: ::Pago::UNSET ) super() assign(:custom_field_data, custom_field_data) assign(:metadata, ) assign(:organization_id, organization_id) assign(:customer_id, customer_id) assign(:product_id, product_id) assign(:currency, currency) assign(:amount, amount) assign(:description, description) end |
Instance Attribute Details
#amount ⇒ Integer? (readonly)
A custom amount to charge, in the smallest currency unit. Overrides the product's price; defaults to the product's configured price (0 for free products). A positive amount must be at least the currency's minimum.
32228 32229 32230 |
# File 'lib/pago/v2026_04/models.rb', line 32228 def amount @amount end |
#currency ⇒ String? (readonly)
The currency to charge in (ISO 4217, lowercase, e.g. usd). Defaults to the organization's default currency; specify it to force a different one, or when the product isn't priced in the organization's default currency.
32224 32225 32226 |
# File 'lib/pago/v2026_04/models.rb', line 32224 def currency @currency end |
#custom_field_data ⇒ Hash{String => String, Integer, Boolean, nil} (readonly)
Key-value object storing custom field values.
32194 32195 32196 |
# File 'lib/pago/v2026_04/models.rb', line 32194 def custom_field_data @custom_field_data end |
#customer_id ⇒ String (readonly)
The ID of the customer the order is for. Must belong to the order's organization.
32216 32217 32218 |
# File 'lib/pago/v2026_04/models.rb', line 32216 def customer_id @customer_id end |
#description ⇒ String? (readonly)
A custom description for the order's line item, shown on the invoice and receipt (e.g. 5,000 tokens). Defaults to the product name.
32232 32233 32234 |
# File 'lib/pago/v2026_04/models.rb', line 32232 def description @description 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.
32208 32209 32210 |
# File 'lib/pago/v2026_04/models.rb', line 32208 def @metadata end |
#organization_id ⇒ String? (readonly)
The ID of the organization the order belongs to. Required unless you use an organization token. The customer and product must belong to this organization.
32212 32213 32214 |
# File 'lib/pago/v2026_04/models.rb', line 32212 def organization_id @organization_id end |
#product_id ⇒ String (readonly)
The ID of the one-time product to charge for. Must belong to the order's organization. Only fixed-price and free products are supported.
32220 32221 32222 |
# File 'lib/pago/v2026_04/models.rb', line 32220 def product_id @product_id end |
Class Method Details
.from_json(data) ⇒ OrderCreate?
32257 32258 32259 32260 32261 32262 32263 32264 32265 32266 32267 32268 32269 32270 32271 32272 32273 32274 32275 |
# File 'lib/pago/v2026_04/models.rb', line 32257 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( custom_field_data: (data.key?("custom_field_data") ? data["custom_field_data"] : ::Pago::UNSET), metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET), organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET), customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET), product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET), currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET), amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET), description: (data.key?("description") ? data["description"] : ::Pago::UNSET) ), data ) end |