NAME

Net::API::Stripe::Billing::Discount - A Stripe Discount

SYNOPSIS

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',
});

VERSION

v0.100.0

DESCRIPTION

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.

CONSTRUCTOR

new( %ARG )

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.

METHODS

object string, value is "discount"

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

coupon hash, coupon object

Hash describing the coupon applied to create this discount. This is a Net::API::Stripe::Billing::Coupon object.

customer string (expandable)

This is the Stripe customer id, or when expanded, this is the Net::API::Stripe::Customer object.

end timestamp

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.

start timestamp

Date that the coupon was applied.

subscription string

The subscription that this coupon is applied to, if it is applied to a particular subscription.

API SAMPLE

{
  "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
}

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api, https://stripe.com/docs/billing/subscriptions/discounts

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.