Class: Pago::V2026_04::Models::WebhookSubscriptionUpdatedPayload

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

Overview

Sent when a subscription is updated. This event fires for all changes to the subscription, including renewals.

If you want more specific events, you can listen to subscription.active, subscription.canceled, subscription.past_due, and subscription.revoked.

To listen specifically for renewals, you can listen to order.created events and check the billing_reason field.

Discord & Slack support: On cancellation, past due, and revocation. Renewals are skipped.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  type: "type",
  timestamp: "timestamp",
  data: "data"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["type", "timestamp", "data"].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(type:, timestamp:, data:) ⇒ WebhookSubscriptionUpdatedPayload

Returns a new instance of WebhookSubscriptionUpdatedPayload.

Parameters:



46313
46314
46315
46316
46317
46318
46319
46320
46321
46322
# File 'lib/pago/v2026_04/models.rb', line 46313

def initialize(
  type:,
  timestamp:,
  data:
)
  super()
  assign(:type, type)
  assign(:timestamp, timestamp)
  assign(:data, data)
end

Instance Attribute Details

#dataModels::Subscription (readonly)



46311
46312
46313
# File 'lib/pago/v2026_04/models.rb', line 46311

def data
  @data
end

#timestampString (readonly)

Returns:

  • (String)


46308
46309
46310
# File 'lib/pago/v2026_04/models.rb', line 46308

def timestamp
  @timestamp
end

#typeString (readonly)

Returns:

  • (String)


46305
46306
46307
# File 'lib/pago/v2026_04/models.rb', line 46305

def type
  @type
end

Class Method Details

.from_json(data) ⇒ WebhookSubscriptionUpdatedPayload?

Parameters:

  • data (Hash, String, nil)

Returns:



46326
46327
46328
46329
46330
46331
46332
46333
46334
46335
46336
46337
46338
46339
# File 'lib/pago/v2026_04/models.rb', line 46326

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(
      type: (data.key?("type") ? data["type"] : ::Pago::UNSET),
      timestamp: (data.key?("timestamp") ? data["timestamp"] : ::Pago::UNSET),
      data: (data.key?("data") ? Models::Subscription.from_json(data["data"]) : ::Pago::UNSET)
    ),
    data
  )
end