| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## Stripe API - ~/lib/Net/API/Stripe/Product.pm | ||
| 3 | ## Version v0.100.0 | ||
| 4 | ## Copyright(c) 2019 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp> | ||
| 6 | ## Created 2019/11/02 | ||
| 7 | ## Modified 2020/05/15 | ||
| 8 | ## | ||
| 9 | ##---------------------------------------------------------------------------- | ||
| 10 | ## "A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]). Only applicable to products of type=good." | ||
| 11 | package Net::API::Stripe::Product; | ||
| 12 | BEGIN | ||
| 13 | { | ||
| 14 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use parent qw( Net::API::Stripe::Generic ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | our( $VERSION ) = 'v0.100.0'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | }; | ||
| 18 | |||
| 19 | 0 | ▶ | sub id { shift->_set_get_scalar( 'id', @_ ); } |
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 20 | |||
| 21 | 0 | ▶ | sub object { shift->_set_get_scalar( 'object', @_ ); } |
|
Subroutine
object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 22 | |||
| 23 | 0 | ▶ | sub active { shift->_set_get_boolean( 'active', @_ ); } |
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | |||
| 25 | 0 | ▶ | sub attributes { shift->_set_get_array( 'attributes', @_ ); } |
|
Subroutine
attributes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | |||
| 27 | 0 | ▶ | sub caption { shift->_set_get_scalar( 'caption', @_ ); } |
|
Subroutine
caption: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | 0 | ▶ | sub created { shift->_set_get_datetime( 'created', @_ ); } |
|
Subroutine
created: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 0 | ▶ | sub deactivate_on { shift->_set_get_array( 'deactivate_on', @_ ); } |
|
Subroutine
deactivate_on: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | ▶ | sub deleted { return( shift->_set_get_boolean( 'deleted', @_ ) ); } |
|
Subroutine
deleted: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | |||
| 35 | 0 | ▶ | sub description { shift->_set_get_scalar( 'description', @_ ); } |
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | |||
| 37 | 0 | ▶ | sub images { shift->_set_get_array( 'images', @_ ); } |
|
Subroutine
images: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | |||
| 39 | 0 | ▶ | sub livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
|
Subroutine
livemode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | |||
| 41 | 0 | ▶ | sub metadata { shift->_set_get_hash( 'metadata', @_ ); } |
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | ▶ | sub name { shift->_set_get_scalar( 'name', @_ ); } |
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | |||
| 45 | 0 | ▶ | sub package_dimensions { shift->_set_get_object( 'package_dimensions', 'Net::API::Stripe::Product::PackageDimension', @_ ); } |
|
Subroutine
package_dimensions: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | |||
| 47 | 0 | ▶ | sub shippable { shift->_set_get_scalar( 'shippable', @_ ); } |
|
Subroutine
shippable: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 48 | |||
| 49 | ## List of Net::API::Stripe::Order::SKU objects | ||
| 50 | 0 | ▶ | sub skus { return( shift->_set_get_object( 'Net::API::Stripe::List', @_ ) ); } |
|
Subroutine
skus: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 51 | |||
| 52 | 0 | ▶ | sub statement_descriptor { shift->_set_get_scalar( 'statement_descriptor', @_ ); } |
|
Subroutine
statement_descriptor: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 53 | |||
| 54 | 0 | ▶ | sub type { shift->_set_get_scalar( 'type', @_ ); } |
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 55 | |||
| 56 | 0 | ▶ | sub unit_label { shift->_set_get_scalar( 'unit_label', @_ ); } |
|
Subroutine
unit_label: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 57 | |||
| 58 | 0 | ▶ | sub updated { shift->_set_get_datetime( 'updated', @_ ); } |
|
Subroutine
updated: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 59 | |||
| 60 | 0 | ▶ | sub url { shift->_set_get_uri( 'url', @_ ); } |
|
Subroutine
url: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 61 | |||
| 62 | 1 | 1; | |
| 63 | |||
| 64 | __END__ | ||
| 65 | |||
| 66 | =encoding utf8 | ||
| 67 | |||
| 68 | =head1 NAME | ||
| 69 | |||
| 70 | Net::API::Stripe::Product - A Stripe Product Object | ||
| 71 | |||
| 72 | =head1 SYNOPSIS | ||
| 73 | |||
| 74 | my $prod = $stripe->product({ | ||
| 75 | active => $stripe->true, | ||
| 76 | attributes => [qw( colour size gender )], | ||
| 77 | caption => 'Fashionable T-shirt', | ||
| 78 | description => 'Product for limited edition t-shirt', | ||
| 79 | images => [qw( | ||
| 80 | https://img.example.com/p12/file1.jpg | ||
| 81 | https://img.example.com/p12/file2.jpg | ||
| 82 | https://img.example.com/p12/file3.jpg | ||
| 83 | )], | ||
| 84 | livemode => $stripe->false, | ||
| 85 | metadata => { product_id => 123, customer_id => 456 }, | ||
| 86 | name => 'Limited Edition Shirt', | ||
| 87 | package_dimensions => | ||
| 88 | { | ||
| 89 | use_metric => 1, | ||
| 90 | width => 30, | ||
| 91 | length => 50, | ||
| 92 | height => 15, | ||
| 93 | weight => 500, | ||
| 94 | }, | ||
| 95 | shippable => $stripe->true, | ||
| 96 | type => 'good', | ||
| 97 | url => 'https://store.example.com/p12/', | ||
| 98 | }); | ||
| 99 | |||
| 100 | See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. | ||
| 101 | |||
| 102 | =head1 VERSION | ||
| 103 | |||
| 104 | v0.100.0 | ||
| 105 | |||
| 106 | =head1 DESCRIPTION | ||
| 107 | |||
| 108 | Store representations of products you sell in Product objects, used in conjunction with L<SKUs|https://stripe.com/docs/api/products#skus>. Products may be physical goods, to be shipped, or digital. | ||
| 109 | |||
| 110 | Documentation on Products for use with Subscriptions can be found at L<Subscription Products|https://stripe.com/docs/api/products#service_products>. | ||
| 111 | |||
| 112 | =head1 CONSTRUCTOR | ||
| 113 | |||
| 114 | =over 4 | ||
| 115 | |||
| 116 | =item B<new>( %ARG ) | ||
| 117 | |||
| 118 | Creates a new L<Net::API::Stripe::Product> object. | ||
| 119 | |||
| 120 | =back | ||
| 121 | |||
| 122 | =head1 METHODS | ||
| 123 | |||
| 124 | =over 4 | ||
| 125 | |||
| 126 | =item B<id> string | ||
| 127 | |||
| 128 | Unique identifier for the object. | ||
| 129 | |||
| 130 | =item B<object> string, value is "product" | ||
| 131 | |||
| 132 | String representing the object’s type. Objects of the same type share the same value. | ||
| 133 | |||
| 134 | =item B<active> boolean | ||
| 135 | |||
| 136 | Whether the product is currently available for purchase. | ||
| 137 | |||
| 138 | =item B<attributes> array containing strings | ||
| 139 | |||
| 140 | A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]). Only applicable to products of type=good. | ||
| 141 | |||
| 142 | =item B<caption> string | ||
| 143 | |||
| 144 | A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of type=good. | ||
| 145 | |||
| 146 | =item B<created> timestamp | ||
| 147 | |||
| 148 | Time at which the object was created. Measured in seconds since the Unix epoch. | ||
| 149 | |||
| 150 | =item B<deactivate_on> array containing strings | ||
| 151 | |||
| 152 | An array of connect application identifiers that cannot purchase this product. Only applicable to products of type=good. | ||
| 153 | |||
| 154 | =item B<deleted> boolean | ||
| 155 | |||
| 156 | Set to true when the product has been deleted. | ||
| 157 | |||
| 158 | =item B<description> string | ||
| 159 | |||
| 160 | The product’s description, meant to be displayable to the customer. Only applicable to products of type=good. | ||
| 161 | |||
| 162 | =item B<images> array containing strings | ||
| 163 | |||
| 164 | A list of up to 8 URLs of images for this product, meant to be displayable to the customer. Only applicable to products of type=good. | ||
| 165 | |||
| 166 | =item B<livemode> boolean | ||
| 167 | |||
| 168 | Has the value true if the object exists in live mode or the value false if the object exists in test mode. | ||
| 169 | |||
| 170 | =item B<metadata> hash | ||
| 171 | |||
| 172 | 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. | ||
| 173 | |||
| 174 | =item B<name> string | ||
| 175 | |||
| 176 | The product’s name, meant to be displayable to the customer. Applicable to both service and good types. | ||
| 177 | |||
| 178 | =item B<package_dimensions> hash | ||
| 179 | |||
| 180 | The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own package_dimensions. Only applicable to products of type=good. | ||
| 181 | |||
| 182 | This is a L<Net::API::Stripe::Product::PackageDimension> object. | ||
| 183 | |||
| 184 | =item B<shippable> boolean | ||
| 185 | |||
| 186 | Whether this product is a shipped good. Only applicable to products of type=good. | ||
| 187 | |||
| 188 | =item B<skus> list | ||
| 189 | |||
| 190 | This is a list (L<Net::API::Stripe::List>) of L<Net::API::Stripe::Order::SKU> objects. | ||
| 191 | |||
| 192 | This is an undocumented property. | ||
| 193 | |||
| 194 | =item B<statement_descriptor> string | ||
| 195 | |||
| 196 | Extra information about a product which will appear on your customer’s credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. Only available on products of type=service. | ||
| 197 | |||
| 198 | =item B<type> string | ||
| 199 | |||
| 200 | The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for use with Subscriptions and Plans. | ||
| 201 | |||
| 202 | =item B<unit_label> string | ||
| 203 | |||
| 204 | A label that represents units of this product, such as seat(s), in Stripe and on customers’ receipts and invoices. Only available on products of type=service. | ||
| 205 | |||
| 206 | =item B<updated> timestamp | ||
| 207 | |||
| 208 | =item B<url> string | ||
| 209 | |||
| 210 | A URL of a publicly-accessible webpage for this product. Only applicable to products of type=good | ||
| 211 | |||
| 212 | This returns a L<URI> object. | ||
| 213 | |||
| 214 | =back | ||
| 215 | |||
| 216 | =head1 API SAMPLE | ||
| 217 | |||
| 218 | { | ||
| 219 | "id": "prod_fake123456789", | ||
| 220 | "object": "product", | ||
| 221 | "active": true, | ||
| 222 | "attributes": [], | ||
| 223 | "caption": null, | ||
| 224 | "created": 1541833574, | ||
| 225 | "deactivate_on": [], | ||
| 226 | "description": null, | ||
| 227 | "images": [], | ||
| 228 | "livemode": false, | ||
| 229 | "metadata": {}, | ||
| 230 | "name": "Provider, Inc investor yearly membership", | ||
| 231 | "package_dimensions": null, | ||
| 232 | "shippable": null, | ||
| 233 | "statement_descriptor": null, | ||
| 234 | "type": "service", | ||
| 235 | "unit_label": null, | ||
| 236 | "updated": 1565089803, | ||
| 237 | "url": null | ||
| 238 | } | ||
| 239 | |||
| 240 | =head1 HISTORY | ||
| 241 | |||
| 242 | =head2 v0.1 | ||
| 243 | |||
| 244 | Initial version | ||
| 245 | |||
| 246 | =head1 STRIPE HISTORY | ||
| 247 | |||
| 248 | =head2 2018-05-21 | ||
| 249 | |||
| 250 | Products no longer have SKU lists embedded. | ||
| 251 | |||
| 252 | =head1 AUTHOR | ||
| 253 | |||
| 254 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 255 | |||
| 256 | =head1 SEE ALSO | ||
| 257 | |||
| 258 | Stripe API documentation: | ||
| 259 | |||
| 260 | L<https://stripe.com/docs/api/products>, L<https://stripe.com/docs/orders#define-products-skus>, L<https://stripe.com/docs/billing/subscriptions/products-and-plans#products> | ||
| 261 | |||
| 262 | =head1 COPYRIGHT & LICENSE | ||
| 263 | |||
| 264 | Copyright (c) 2019-2020 DEGUEST Pte. Ltd. | ||
| 265 | |||
| 266 | You can use, copy, modify and redistribute this package and associated | ||
| 267 | files under the same terms as Perl itself. | ||
| 268 | |||
| 269 | =cut | ||