Class: Dodopayments::Models::Payment

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/dodopayments/models/payment.rb

Overview

Direct Known Subclasses

WebhookPayload::Data::Payment

Defined Under Namespace

Classes: Discount, ProductCart

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(amount:, business_id:, code:, created_at:, discount_id:, metadata:, position:, preserve_on_plan_change:, restricted_to:, times_used:, type:, cycles_remaining: nil, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil) ⇒ Object

Some parameter documentations has been truncated, see Discount for more details.

Response struct for a discount with its position in a stack and optional cycle-tracking information (for subscriptions).

Parameters:

  • amount (Integer)

    The discount amount (basis points for percentage, USD cents for flat)

  • business_id (String)

    The business this discount belongs to

  • code (String)

    The discount code

  • created_at (Time)

    Timestamp when the discount was created

  • discount_id (String)

    The unique discount ID

  • metadata (Hash{Symbol=>String})

    Additional metadata

  • position (Integer)

    Position of this discount in the stack (0-based)

  • preserve_on_plan_change (Boolean)

    Whether this discount should be preserved when a subscription changes plans

  • restricted_to (Array<String>)

    List of product IDs to which this discount is restricted

  • times_used (Integer)

    How many times this discount has been used

  • type (Symbol, Dodopayments::Models::DiscountType)

    The type of discount

  • cycles_remaining (Integer, nil) (defaults to: nil)

    Remaining billing cycles for this discount on this subscription (None for one-ti

  • expires_at (Time, nil) (defaults to: nil)

    Optional date/time after which discount is expired

  • name (String, nil) (defaults to: nil)

    Name for the Discount

  • subscription_cycles (Integer, nil) (defaults to: nil)

    Number of subscription billing cycles this discount is valid for

  • usage_limit (Integer, nil) (defaults to: nil)

    Usage limit for this discount, if any



# File 'lib/dodopayments/models/payment.rb', line 422

Instance Attribute Details

#billingDodopayments::Models::BillingAddress

Billing address details for payments



11
# File 'lib/dodopayments/models/payment.rb', line 11

required :billing, -> { Dodopayments::BillingAddress }

#brand_idString

brand id this payment belongs to

Returns:

  • (String)


17
# File 'lib/dodopayments/models/payment.rb', line 17

required :brand_id, String

#business_idString

Identifier of the business associated with the payment

Returns:

  • (String)


23
# File 'lib/dodopayments/models/payment.rb', line 23

required :business_id, String

#card_holder_nameString?

Cardholder name

Returns:

  • (String, nil)


100
# File 'lib/dodopayments/models/payment.rb', line 100

optional :card_holder_name, String, nil?: true

#card_issuing_countrySymbol, ...

ISO2 country code of the card

Returns:



106
# File 'lib/dodopayments/models/payment.rb', line 106

optional :card_issuing_country, enum: -> { Dodopayments::CountryCode }, nil?: true

#card_last_fourString?

The last four digits of the card

Returns:

  • (String, nil)


112
# File 'lib/dodopayments/models/payment.rb', line 112

optional :card_last_four, String, nil?: true

#card_networkString?

Card network like VISA, MASTERCARD etc.

Returns:

  • (String, nil)


118
# File 'lib/dodopayments/models/payment.rb', line 118

optional :card_network, String, nil?: true

#card_typeString?

The type of card DEBIT or CREDIT

Returns:

  • (String, nil)


124
# File 'lib/dodopayments/models/payment.rb', line 124

optional :card_type, String, nil?: true

#checkout_session_idString?

If payment is made using a checkout session, this field is set to the id of the session.

Returns:

  • (String, nil)


131
# File 'lib/dodopayments/models/payment.rb', line 131

optional :checkout_session_id, String, nil?: true

#created_atTime

Timestamp when the payment was created

Returns:

  • (Time)


29
# File 'lib/dodopayments/models/payment.rb', line 29

required :created_at, Time

#currencySymbol, Dodopayments::Models::Currency

Currency used for the payment

Returns:



35
# File 'lib/dodopayments/models/payment.rb', line 35

required :currency, enum: -> { Dodopayments::Currency }

#custom_field_responsesArray<Dodopayments::Models::CustomFieldResponse>?

Customer’s responses to custom fields collected during checkout



137
138
139
# File 'lib/dodopayments/models/payment.rb', line 137

optional :custom_field_responses,
-> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::CustomFieldResponse] },
nil?: true

#customerDodopayments::Models::CustomerLimitedDetails

Details about the customer who made the payment



41
# File 'lib/dodopayments/models/payment.rb', line 41

required :customer, -> { Dodopayments::CustomerLimitedDetails }

#digital_products_deliveredBoolean

brand id this payment belongs to

Returns:

  • (Boolean)


47
# File 'lib/dodopayments/models/payment.rb', line 47

required :digital_products_delivered, Dodopayments::Internal::Type::Boolean

#discount_idString?

Deprecated.

Use ‘discounts` instead.

DEPRECATED: Use discounts instead. Returns the first discount’s ID if present.

Returns:

  • (String, nil)


147
# File 'lib/dodopayments/models/payment.rb', line 147

optional :discount_id, String, nil?: true

#discountsArray<Dodopayments::Models::Payment::Discount>?

All stacked discounts applied, ordered by position



153
154
155
# File 'lib/dodopayments/models/payment.rb', line 153

optional :discounts,
-> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Payment::Discount] },
nil?: true

#disputesArray<Dodopayments::Models::Dispute>

List of disputes associated with this payment

Returns:



53
# File 'lib/dodopayments/models/payment.rb', line 53

required :disputes, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Dispute] }

#error_codeString?

An error code if the payment failed

Returns:

  • (String, nil)


161
# File 'lib/dodopayments/models/payment.rb', line 161

optional :error_code, String, nil?: true

#error_messageString?

An error message if the payment failed

Returns:

  • (String, nil)


167
# File 'lib/dodopayments/models/payment.rb', line 167

optional :error_message, String, nil?: true

#invoice_idString?

Invoice ID for this payment. Uses India-specific invoice ID if available.

Returns:

  • (String, nil)


173
# File 'lib/dodopayments/models/payment.rb', line 173

optional :invoice_id, String, nil?: true

#invoice_urlString?

URL to download the invoice PDF for this payment.

Returns:

  • (String, nil)


179
# File 'lib/dodopayments/models/payment.rb', line 179

optional :invoice_url, String, nil?: true

#metadataHash{Symbol=>String}

Additional custom data associated with the payment

Returns:

  • (Hash{Symbol=>String})


59
# File 'lib/dodopayments/models/payment.rb', line 59

required :metadata, Dodopayments::Internal::Type::HashOf[String]

#payment_idString

Unique identifier for the payment

Returns:

  • (String)


65
# File 'lib/dodopayments/models/payment.rb', line 65

required :payment_id, String

Checkout URL

Returns:

  • (String, nil)


185
# File 'lib/dodopayments/models/payment.rb', line 185

optional :payment_link, String, nil?: true

#payment_methodString?

Payment method used by customer (e.g. “card”, “bank_transfer”)

Returns:

  • (String, nil)


191
# File 'lib/dodopayments/models/payment.rb', line 191

optional :payment_method, String, nil?: true

#payment_method_typeString?

Specific type of payment method (e.g. “visa”, “mastercard”)

Returns:

  • (String, nil)


197
# File 'lib/dodopayments/models/payment.rb', line 197

optional :payment_method_type, String, nil?: true

#product_cartArray<Dodopayments::Models::Payment::ProductCart>?

List of products purchased in a one-time payment



203
204
205
# File 'lib/dodopayments/models/payment.rb', line 203

optional :product_cart,
-> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Payment::ProductCart] },
nil?: true

#refund_statusSymbol, ...

Summary of the refund status for this payment. None if no succeeded refunds exist.



212
# File 'lib/dodopayments/models/payment.rb', line 212

optional :refund_status, enum: -> { Dodopayments::PaymentRefundStatus }, nil?: true

#refundsArray<Dodopayments::Models::RefundListItem>

List of refunds issued for this payment



71
# File 'lib/dodopayments/models/payment.rb', line 71

required :refunds, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::RefundListItem] }

#settlement_amountInteger

The amount that will be credited to your Dodo balance after currency conversion and processing. Especially relevant for adaptive pricing where the customer’s payment currency differs from your settlement currency.

Returns:

  • (Integer)


79
# File 'lib/dodopayments/models/payment.rb', line 79

required :settlement_amount, Integer

#settlement_currencySymbol, Dodopayments::Models::Currency

The currency in which the settlement_amount will be credited to your Dodo balance. This may differ from the customer’s payment currency in adaptive pricing scenarios.

Returns:



87
# File 'lib/dodopayments/models/payment.rb', line 87

required :settlement_currency, enum: -> { Dodopayments::Currency }

#settlement_taxInteger?

This represents the portion of settlement_amount that corresponds to taxes collected. Especially relevant for adaptive pricing where the tax component must be tracked separately in your Dodo balance.

Returns:

  • (Integer, nil)


220
# File 'lib/dodopayments/models/payment.rb', line 220

optional :settlement_tax, Integer, nil?: true

#statusSymbol, ...

Current status of the payment intent

Returns:



226
# File 'lib/dodopayments/models/payment.rb', line 226

optional :status, enum: -> { Dodopayments::IntentStatus }, nil?: true

#subscription_idString?

Identifier of the subscription if payment is part of a subscription

Returns:

  • (String, nil)


232
# File 'lib/dodopayments/models/payment.rb', line 232

optional :subscription_id, String, nil?: true

#taxInteger?

Amount of tax collected in smallest currency unit (e.g. cents)

Returns:

  • (Integer, nil)


238
# File 'lib/dodopayments/models/payment.rb', line 238

optional :tax, Integer, nil?: true

#total_amountInteger

Total amount charged to the customer including tax, in smallest currency unit (e.g. cents)

Returns:

  • (Integer)


94
# File 'lib/dodopayments/models/payment.rb', line 94

required :total_amount, Integer

#updated_atTime?

Timestamp when the payment was last updated

Returns:

  • (Time, nil)


244
# File 'lib/dodopayments/models/payment.rb', line 244

optional :updated_at, Time, nil?: true