File Coverage

lib/Net/API/Stripe/Billing/PortalConfiguration.pm
Criterion Covered Total %
statement 19 32 59.3
branch n/a
condition n/a
subroutine 7 20 35.0
pod 13 13 100.0
total 39 65 60.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Plan/PortalConfiguration.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             BEGIN
11             {
12             use strict;
13 2     2   24177529 use warnings;
  2         13  
  2         70  
14 2     2   13 use parent qw( Net::API::Stripe::Generic );
  2         3  
  2         60  
15 2     2   12 use vars qw( $VERSION );
  2         3  
  2         11  
16 2     2   137 our( $VERSION ) = 'v0.2.0';
  2         4  
  2         449  
17 2     2   38 };
18              
19             use strict;
20 2     2   10 use warnings;
  2         5  
  2         35  
21 2     2   10  
  2         5  
  2         779  
22              
23 0     0 1    
24              
25 0     0 1    
26             {
27 0     0 1   headline => { type => 'scalar' },
28             privacy_policy_url => { type => 'uri' },
29 0     0 1   terms_of_service_url => { type => 'uri' },
30             }, @_ ) ); }
31 0     0 1    
32              
33              
34             {
35             customer_update => {
36             definition => {
37             allowed_updates => { type => "array" },
38 0     0 1   enabled => { type => "boolean" },
39             },
40 0     0 1   type => "class",
41             },
42 0     0 1   invoice_history => {
43             package => "Net::API::Stripe::Payment::Installment",
44             type => "object",
45             },
46             payment_method_update => {
47             package => "Net::API::Stripe::Payment::Installment",
48             type => "object",
49             },
50             subscription_cancel => {
51             definition => {
52             cancellation_reason => {
53             definition => { enabled => { type => "boolean" }, options => { type => "array" } },
54             type => "class",
55             },
56             enabled => { type => "boolean" },
57             mode => { type => "scalar" },
58             proration_behavior => { type => "scalar" },
59             },
60             type => "class",
61             },
62             subscription_pause => {
63             package => "Net::API::Stripe::Payment::Installment",
64             type => "object",
65             },
66             subscription_update => {
67             definition => {
68             default_allowed_updates => { type => "array" },
69             enabled => { type => "boolean" },
70             products => {
71             definition => { prices => { type => "array" }, product => { type => "scalar" } },
72             type => "class_array",
73             },
74             proration_behavior => { type => "scalar" },
75             },
76             type => "class",
77             },
78             }, @_ ) ); }
79              
80              
81              
82             { enabled => { type => "boolean" }, url => { type => "uri" } }, @_ ) ); }
83              
84              
85              
86             1;
87              
88              
89 0     0 1   =encoding utf8
90              
91 0     0 1   =head1 NAME
92              
93 0     0 1   Net::API::Stripe::Billing::PortalConfiguration - The portal configuration object
94              
95             =head1 SYNOPSIS
96 0     0 1    
97             my $portal = $stripe->portal_conffiguration({
98 0     0 1   created => 'now',
99             active => $stripe->true,
100             application => 'acct_fake123456789',
101             business_profile =>
102             {
103             headline = q{Welcome to Example Business payment portal},
104             privacy_policy_url => q{https://example.com/privacy-policy/},
105             terms_of_service_url => q{https://example.com/tos/},
106             },
107             default_return_url => 'https://example.com/ec/df63685a-6cd2-4c5d-9d4c-81b417646a58',
108             features =>
109             {
110             customer_update =>
111             {
112             allowed_updates => [qw( email address shipping phone tax_id )],
113             enabled => 1,
114             },
115             invoice_history =>
116             {
117             enabled => 1,
118             },
119             payment_method_update =>
120             {
121             enabled => 1,
122             },
123             subscription_cancel =>
124             {
125             cancellation_reason =>
126             {
127             enabled => 1,
128             options => [qw( too_expensive missing_features switched_service unused customer_service too_complex low_quality other )],
129             },
130             enabled => 1,
131             mode => [qw( immediately at_period_end )],
132             # Can also be 'none'
133             proration_behavior => 'create_prorations',
134             },
135             subscription_pause =>
136             {
137             enabled => 0,
138             },
139             subscription_update =>
140             {
141             default_allowed_updates => [qw( price quantity promotion_code )],
142             enabled => 1,
143             products => [
144             { prices => [qw( price12345 price6789 )], product => 'prod123456789' },
145             ],
146             # Can also be 'none' and 'always_invoice'
147             proration_behavior => 'create_prorations',
148             },
149             },
150             is_default => 1,
151             livemode => $stripe->false,
152             metadata => { my_db_key => 123456789 },
153             });
154              
155             =head1 VERSION
156              
157             v0.2.0
158              
159             =head1 DESCRIPTION
160              
161             A portal configuration describes the functionality and features that you want to provide to your customers through the portal.
162              
163             =head1 METHODS
164              
165             =head2 id string
166              
167             Unique identifier for the object.
168              
169             =head2 object string
170              
171             String representing the object's type. Objects of the same type share the same value.
172              
173             =head2 active boolean
174              
175             Whether the configuration is active and can be used to create portal sessions.
176              
177             =head2 application string
178              
179             Expandable "application" (Connect only)
180              
181             ID of the Connect Application that created the configuration.
182              
183             =head2 business_profile hash
184              
185             The business information shown to customers in the portal.
186              
187             =over 4
188              
189             =item * C<headline> string
190              
191             The messaging shown to customers in the portal.
192              
193             =item * C<privacy_policy_url> string
194              
195             A link to the business’s publicly available privacy policy.
196              
197             =item * C<terms_of_service_url> string
198              
199             A link to the business’s publicly available terms of service.
200              
201             =back
202              
203             =head2 created timestamp
204              
205             Time at which the object was created. Measured in seconds since the Unix epoch.
206              
207             =head2 default_return_url string
208              
209             The default URL to redirect customers to when they click on the portal’s link to return to your website. This can be overriden when creating the session.
210              
211             =head2 features hash
212              
213             Information about the features available in the portal.
214              
215             It has the following properties:
216              
217             =over 4
218              
219             =item C<customer_update> hash
220              
221             Information about updating customer details in the portal.
222              
223             =over 8
224              
225             =item C<allowed_updates> array
226              
227             The types of customer updates that are supported. When empty, customers are not updateable.
228              
229             =item C<enabled> boolean
230              
231             Whether the feature is enabled.
232              
233              
234             =back
235              
236             =item C<invoice_history> hash
237              
238             Information about showing invoice history in the portal.
239              
240             When expanded, this is a L<Net::API::Stripe::Payment::Installment> object.
241              
242             =item C<payment_method_update> hash
243              
244             Information about updating payment methods in the portal. View the list of supported payment methods in the L<docs|https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#supported-payment-methods>.
245              
246             When expanded, this is a L<Net::API::Stripe::Payment::Installment> object.
247              
248             =item C<subscription_cancel> hash
249              
250             Information about canceling subscriptions in the portal.
251              
252             =over 8
253              
254             =item C<cancellation_reason> hash
255              
256             Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
257              
258             =over 12
259              
260             =item C<enabled> boolean
261              
262             Whether the feature is enabled.
263              
264             =item C<options> array
265              
266             Which cancellation reasons will be given as options to the customer.
267              
268              
269             =back
270              
271             =item C<enabled> boolean
272              
273             Whether the feature is enabled.
274              
275             =item C<mode> string
276              
277             Whether to cancel subscriptions immediately or at the end of the billing period.
278              
279             =item C<proration_behavior> string
280              
281             Whether to create prorations when canceling subscriptions. Possible values are C<none> and C<create_prorations>.
282              
283              
284             =back
285              
286             =item C<subscription_pause> hash
287              
288             Information about pausing subscriptions in the portal.
289              
290             When expanded, this is a L<Net::API::Stripe::Payment::Installment> object.
291              
292             =item C<subscription_update> hash
293              
294             Information about updating subscriptions in the portal.
295              
296             =over 8
297              
298             =item C<default_allowed_updates> array
299              
300             The types of subscription updates that are supported for items listed in the C<products> attribute. When empty, subscriptions are not updateable.
301              
302             =item C<enabled> boolean
303              
304             Whether the feature is enabled.
305              
306             =item C<products> array
307              
308             The list of products that support subscription updates.
309              
310             =over 12
311              
312             =item C<prices> string_array
313              
314             The list of price IDs which, when subscribed to, a subscription can be updated.
315              
316             =item C<product> string
317              
318             The product ID.
319              
320              
321             =back
322              
323             =item C<proration_behavior> string
324              
325             Determines how to handle prorations resulting from subscription updates. Valid values are C<none>, C<create_prorations>, and C<always_invoice>.
326              
327              
328             =back
329              
330             =back
331              
332             =head2 is_default boolean
333              
334             Whether the configuration is the default. If true, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
335              
336             =head2 livemode boolean
337              
338             Has the value C<true> if the object exists in live mode or the value C<false> if the object exists in test mode.
339              
340             =head2 login_page hash
341              
342             The hosted login page for this configuration. Learn more about the portal login page in our L<integration docs|https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share>.
343              
344             It has the following properties:
345              
346             =over 4
347              
348             =item C<enabled> boolean
349              
350             If C<true>, a shareable C<url> will be generated that will take your customers to a hosted login page for the customer portal.
351              
352             If C<false>, the previously generated C<url>, if any, will be deactivated.
353              
354             =item C<url> string
355              
356             A shareable URL to the hosted portal login page. Your customers will be able to log in with their L<email|https://stripe.com/docs/api/customers/object#customer_object-email> and receive a link to their customer portal.
357              
358             =back
359              
360             =head2 metadata hash
361              
362             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
363              
364             =head2 updated timestamp
365              
366             Time at which the object was last updated. Measured in seconds since the Unix epoch.
367              
368             =head1 API SAMPLE
369              
370             {
371             "id": "bpc_1LJnbGCeyNCl6fY2uCGtb5z5",
372             "object": "billing_portal.configuration",
373             "active": true,
374             "application": null,
375             "business_profile": {
376             "headline": null,
377             "privacy_policy_url": "https://example.com/privacy",
378             "terms_of_service_url": "https://example.com/terms"
379             },
380             "created": 1657411334,
381             "default_return_url": null,
382             "features": {
383             "customer_update": {
384             "allowed_updates": [
385             "email",
386             "tax_id"
387             ],
388             "enabled": true
389             },
390             "invoice_history": {
391             "enabled": true
392             },
393             "payment_method_update": {
394             "enabled": false
395             },
396             "subscription_cancel": {
397             "cancellation_reason": {
398             "enabled": false,
399             "options": []
400             },
401             "enabled": false,
402             "mode": "at_period_end",
403             "proration_behavior": "none"
404             },
405             "subscription_pause": {
406             "enabled": false
407             },
408             "subscription_update": {
409             "default_allowed_updates": [],
410             "enabled": false,
411             "proration_behavior": "none"
412             }
413             },
414             "is_default": true,
415             "livemode": true,
416             "metadata": null,
417             "updated": 1657411334
418             }
419              
420             =head1 HISTORY
421              
422             =head2 v0.1.0
423              
424             Initial version
425              
426             =head1 AUTHOR
427              
428             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
429              
430             =head1 SEE ALSO
431              
432             Stripe API documentation:
433              
434             L<https://stripe.com/docs/api/customer_portal/configuration>
435              
436             =head1 COPYRIGHT & LICENSE
437              
438             Copyright (c) 2019-2022 DEGUEST Pte. Ltd.
439              
440             You can use, copy, modify and redistribute this package and associated
441             files under the same terms as Perl itself.
442              
443             =cut