NAME
Net::API::Stripe::Product::PackageDimension - A Stripe Product Package Dimension Object
SYNOPSIS
# In inches
my $pkg = $stripe->product->package_dimensions({
height => 6,
length => 20,
# Ounce
weight => 21
width => 12
});
# Then, because we are in EU
$pkg->use_metric( 1 );
my $width = $pkg->width;
# returns in centimetres: 30.48
VERSION
v0.100.1
DESCRIPTION
The dimensions of this SKU for shipping purposes.
This is instantiated by method package_dimensions in module Net::API::Stripe::Product
CONSTRUCTOR
new( %ARG )
Creates a new Net::API::Stripe::Order::SKU::PackageDimensions object. It may also take an hash like arguments, that also are method of the same name.
METHODS
height decimal
Height, in inches.
length decimal
Length, in inches.
use_metric Boolean
By providing a boolean value, you can change the value returned to you.
Stripe uses and requires, unfortunately, the use of inch
and ounce
although the vast majority of the word uses the metric system. So this feature makes it possible to get the proper value while still sending Stripe the values in the proper measurement system.
If on, this will convert all values from inch to metric, or ounce to gram or vice versa.
Internally the values will always be in inch
and ounce
.
So, after having retrieved a Net::API::Stripe::Order::SKU object from Stripe you could do something like this:
my $sku = $stripe->skus( retrieve => $id ) || die( $stripe->error );
$sku->package_dimensions->use_metric( 1 );
# Width in centimetres
my $width = $skup->package_dimensions->width;
weight decimal
Weight, in ounces.
width decimal
Width, in inches.
API SAMPLE
{
"id": "prod_fake123456789",
"object": "product",
"active": true,
"attributes": [],
"caption": null,
"created": 1541833574,
"deactivate_on": [],
"description": null,
"images": [],
"livemode": false,
"metadata": {},
"name": "Provider, Inc investor yearly membership",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"type": "service",
"unit_label": null,
"updated": 1565089803,
"url": null
}
HISTORY
v0.1
Initial version
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Stripe API documentation:
https://stripe.com/docs/api/products/object
COPYRIGHT & LICENSE
Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.