Class: Stripe::Events::V1CustomerSubscriptionTrialWillEndEventNotification

Inherits:
V2::Core::EventNotification show all
Defined in:
lib/stripe/events/v1_customer_subscription_trial_will_end_event.rb

Overview

Occurs three days before a subscription's trial period is scheduled to end, or immediately when a trial is ended early (for example, with trial_end=now or when a Customer Portal plan change ends a trial). If a trial is shortened so that fewer than three days remain, this event can fire immediately, including during the same transaction that collects payment. Before sending payment-reminder communications from this webhook, check the subscription status and latest invoice to determine whether payment has already been collected.

Instance Attribute Summary collapse

Attributes inherited from V2::Core::EventNotification

#context, #created, #id, #livemode, #object, #reason, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from V2::Core::EventNotification

#fetch_event, #initialize

Constructor Details

This class inherits a constructor from Stripe::V2::Core::EventNotification

Instance Attribute Details

Returns the value of attribute related_object.



30
31
32
# File 'lib/stripe/events/v1_customer_subscription_trial_will_end_event.rb', line 30

def related_object
  @related_object
end

Class Method Details

.lookup_typeObject



26
27
28
# File 'lib/stripe/events/v1_customer_subscription_trial_will_end_event.rb', line 26

def self.lookup_type
  "v1.customer.subscription.trial_will_end"
end

Instance Method Details

Retrieves the Subscription related to this EventNotification from the Stripe API. Makes an API request on every call.



33
34
35
36
37
38
39
40
41
# File 'lib/stripe/events/v1_customer_subscription_trial_will_end_event.rb', line 33

def fetch_related_object
  resp = @client.raw_request(
    :get,
    related_object.url,
    opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
    usage: ["fetch_related_object"]
  )
  @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
end