NAME

Net::API::Stripe::Product::Coupon - A Stripe Coupon Object

SYNOPSIS

my $coupon = $stripe->coupons( create => 
{
id => 'SUMMER10POFF',
currency => 'usd',
duration_in_months => 2,
max_redemptions => 12,
name => 'Summer 10% reduction',
percent_off => 10,
valid => 1
}) || die( $stripe->error );

VERSION

v0.101.0

DESCRIPTION

A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to invoices (Net::API::Stripe::Billing::Invoice / https://stripe.com/docs/api/coupons#invoices) or orders (Net::API::Stripe::Order / https://stripe.com/docs/api/coupons#create_order-coupon). Coupons do not work with conventional one-off charges (Net::API::Stripe::Charge / https://stripe.com/docs/api/coupons#create_charge), but you can implement a custom coupon system (https://stripe.com/docs/recipes/coupons-for-charges) in your application.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Product::Coupon object. It may also take an hash like arguments, that also are method of the same name.

METHODS

id string

Unique identifier for the object.

object string, value is "coupon"

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

amount_off positive integer

Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.

applies_to hash

Contains information about what this coupon applies to.

It has the following properties:

products array of strings

A list of product IDs this coupon applies to

created timestamp

Time at which the object was created. Measured in seconds since the Unix epoch.

currency currency

If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.

deleted boolean

This property exists only when the object has been deleted.

duration string

One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.

duration_in_months positive integer

If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.

livemode boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

max_redemptions positive integer

Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.

metadata hash

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.

name string

Name of the coupon displayed to customers on for instance invoices or receipts.

percent_off decimal

Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a ¥100 invoice ¥50 instead.

redeem_by timestamp

Date after which the coupon can no longer be redeemed. This is a DateTime object.

times_redeemed positive integer or zero

Number of times this coupon has been applied to a customer.

valid boolean

Taking account of the above properties, whether this coupon can still be applied to a customer.

API SAMPLE

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

HISTORY

v0.1

Initial version

STRIPE HISTORY

2018-07-27

The percent_off field of coupons was changed from Integer to Float, with a precision of two decimal places.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/coupons/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.