Class: Stripe::BillingPortal::Session

Inherits:
APIResource show all
Extended by:
APIOperations::Create
Defined in:
lib/stripe/resources/billing_portal/session.rb

Overview

The Billing customer portal is a Stripe-hosted UI for subscription and billing management.

A portal configuration describes the functionality and features that you want to provide to your customers through the portal.

A portal session describes the instantiation of the customer portal for a particular customer. By visiting the session’s URL, the customer can manage their subscriptions and billing details. For security reasons, sessions are short-lived and will expire if the customer does not visit the URL. Create sessions on-demand when customers intend to manage their subscriptions and billing details.

Related guide: [Customer management](stripe.com/customer-management)

Defined Under Namespace

Classes: CreateParams, Flow

Constant Summary collapse

OBJECT_NAME =
"billing_portal.session"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Methods included from APIOperations::Create

create

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#configurationObject (readonly)

The configuration used by this session, describing the features available.



277
278
279
# File 'lib/stripe/resources/billing_portal/session.rb', line 277

def configuration
  @configuration
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



279
280
281
# File 'lib/stripe/resources/billing_portal/session.rb', line 279

def created
  @created
end

#customerObject (readonly)

The ID of the customer for this session.



281
282
283
# File 'lib/stripe/resources/billing_portal/session.rb', line 281

def customer
  @customer
end

#flowObject (readonly)

Information about a specific flow for the customer to go through. See the [docs](stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.



283
284
285
# File 'lib/stripe/resources/billing_portal/session.rb', line 283

def flow
  @flow
end

#idObject (readonly)

Unique identifier for the object.



285
286
287
# File 'lib/stripe/resources/billing_portal/session.rb', line 285

def id
  @id
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



287
288
289
# File 'lib/stripe/resources/billing_portal/session.rb', line 287

def livemode
  @livemode
end

#localeObject (readonly)

The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer’s ‘preferred_locales` or browser’s locale is used.



289
290
291
# File 'lib/stripe/resources/billing_portal/session.rb', line 289

def locale
  @locale
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



291
292
293
# File 'lib/stripe/resources/billing_portal/session.rb', line 291

def object
  @object
end

#on_behalf_ofObject (readonly)

The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this ‘on_behalf_of` account appear in the portal. For more information, see the [docs](stripe.com/docs/connect/separate-charges-and-transfers#settlement-merchant). Use the [Accounts API](stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account’s branding settings, which the portal displays.



293
294
295
# File 'lib/stripe/resources/billing_portal/session.rb', line 293

def on_behalf_of
  @on_behalf_of
end

#return_urlObject (readonly)

The URL to redirect customers to when they click on the portal’s link to return to your website.



295
296
297
# File 'lib/stripe/resources/billing_portal/session.rb', line 295

def return_url
  @return_url
end

#urlObject (readonly)

The short-lived URL of the session that gives customers access to the customer portal.



297
298
299
# File 'lib/stripe/resources/billing_portal/session.rb', line 297

def url
  @url
end

Class Method Details

.create(params = {}, opts = {}) ⇒ Object

Creates a session of the customer portal.



300
301
302
303
304
305
306
307
# File 'lib/stripe/resources/billing_portal/session.rb', line 300

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/billing_portal/sessions",
    params: params,
    opts: opts
  )
end

.object_nameObject



24
25
26
# File 'lib/stripe/resources/billing_portal/session.rb', line 24

def self.object_name
  "billing_portal.session"
end