Net::API::Stripe::Billing::Discount - A Stripe Discount
my $discount = $stripe->discount({ coupon => $stripe->coupon({ id => 'SUMMER10POFF', currency => 'usd', duration_in_months => 2, max_redemptions => 12, name => 'Summer 10% reduction', percent_off => 10, valid => 1 }), customer => $customer_object, # undef() for once or forever end => '2020-12-31', start => '2020-06-01', subscription => 'sub_fake1234567', });
v0.100.0
A discount represents the actual application of a coupon to a particular customer. It contains information about when the discount began and when it will end.
Creates a new Net::API::Stripe::Billing::Discount object. It may also take an hash like arguments, that also are method of the same name.
String representing the object’s type. Objects of the same type share the same value.
The ID of the discount object. Discounts cannot be fetched by ID. Use expand[]=discounts in API calls to expand discount IDs in an array.
expand[]=discounts
The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
Hash describing the coupon applied to create this discount. This is a Net::API::Stripe::Billing::Coupon object.
This is the Stripe customer id, or when expanded, this is the Net::API::Stripe::Customer object.
If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null.
The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
The invoice item id (or invoice line item id for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
id
The promotion code applied to create this discount.
When expanded this is an Net::API::Stripe::Billing::PromotionCode object.
Date that the coupon was applied.
The subscription that this coupon is applied to, if it is applied to a particular subscription.
{ "object": "discount", "coupon": { "id": "25_5OFF", "object": "coupon", "amount_off": null, "created": 1571397911, "currency": null, "duration": "repeating", "duration_in_months": 3, "livemode": false, "max_redemptions": null, "metadata": {}, "name": "25.5% off", "percent_off": 25.5, "redeem_by": null, "times_redeemed": 0, "valid": true }, "customer": "cus_fake124567890", "end": 1579346711, "start": 1571397911, "subscription": null }
Initial version
Jacques Deguest <jack@deguest.jp>
Stripe API documentation:
https://stripe.com/docs/api, https://stripe.com/docs/billing/subscriptions/discounts
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.
To install Net::API::Stripe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::API::Stripe
CPAN shell
perl -MCPAN -e shell install Net::API::Stripe
For more information on module installation, please visit the detailed CPAN module installation guide.