pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
233 lines (232 loc) • 10.1 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* With this resource, you can create a coupon - [Stripe API coupon documentation](https://stripe.com/docs/api/coupons).
*
* A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.
*
* A coupon has either a `percentOff` or an `amountOff` and `currency`. If you set an `amountOff`, that amount will be subtracted from any invoice’s subtotal.
*
* For example, an invoice with a subtotal of $100 will have a final total of $0 if a coupon with an amountOff of 20000 is applied to it and an invoice with a subtotal of $300 will have a final total of $100 if a coupon with an amountOff of 20000 is applied to it.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // coupon for the amount off discount
* const couponCoupon = new stripe.Coupon("couponCoupon", {
* amountOff: 1000,
* currency: "aud",
* duration: "once",
* maxRedemptions: 10,
* });
* // coupon for the percentage off discount
* const couponIndex_couponCoupon = new stripe.Coupon("couponIndex/couponCoupon", {
* percentOff: 33.3,
* duration: "forever",
* });
* // coupon with limitation to a date and the product only
* const couponStripeIndex_couponCoupon = new stripe.Coupon("couponStripeIndex/couponCoupon", {
* amountOff: 2000,
* duration: "once",
* redeemBy: "2025-07-23T03:27:06+00:00",
* appliesTos: [stripe_product.product.id],
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import stripe:index/coupon:Coupon coupon <coupon_id>
* ```
*/
export declare class Coupon extends pulumi.CustomResource {
/**
* Get an existing Coupon resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: CouponState, opts?: pulumi.CustomResourceOptions): Coupon;
/**
* Returns true if the given object is an instance of Coupon. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Coupon;
/**
* Int. Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
*/
readonly amountOff: pulumi.Output<number | undefined>;
/**
* List(String). A list of product IDs this coupon applies to.
*/
readonly appliesTos: pulumi.Output<string[] | undefined>;
/**
* String. Unique string of your choice that will be used to identify this coupon when applying it to a customer.
*/
readonly couponId: pulumi.Output<string>;
/**
* String. Required if `amountOff` has been set, the three-letter ISO code for the currency of the amount to take off.
*/
readonly currency: pulumi.Output<string | undefined>;
/**
* String. Describes how long a customer who applies this coupon will get the discount. One of `forever`, `once`, and `repeating`.
*/
readonly duration: pulumi.Output<string | undefined>;
/**
* If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
*/
readonly durationInMonths: pulumi.Output<number | undefined>;
/**
* Int. Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
*/
readonly maxRedemptions: pulumi.Output<number | undefined>;
/**
* Map(String). 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.
*/
readonly metadata: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* String. Name of the coupon displayed to customers on for instance invoices or receipts.
*/
readonly name: pulumi.Output<string>;
/**
* Float. 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 percentOff of 50 will make a $100 invoice $50 instead.
*/
readonly percentOff: pulumi.Output<number | undefined>;
/**
* String. Date after which the coupon can no longer be redeemed. Expected format is in the `RFC3339`.
*/
readonly redeemBy: pulumi.Output<string | undefined>;
/**
* Int. Number of times this coupon has been applied to a customer.
*/
readonly timesRedeemed: pulumi.Output<number>;
/**
* Bool. Taking account of the above properties, whether this coupon can still be applied to a customer.
*/
readonly valid: pulumi.Output<boolean>;
/**
* Create a Coupon resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: CouponArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Coupon resources.
*/
export interface CouponState {
/**
* Int. Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
*/
amountOff?: pulumi.Input<number>;
/**
* List(String). A list of product IDs this coupon applies to.
*/
appliesTos?: pulumi.Input<pulumi.Input<string>[]>;
/**
* String. Unique string of your choice that will be used to identify this coupon when applying it to a customer.
*/
couponId?: pulumi.Input<string>;
/**
* String. Required if `amountOff` has been set, the three-letter ISO code for the currency of the amount to take off.
*/
currency?: pulumi.Input<string>;
/**
* String. Describes how long a customer who applies this coupon will get the discount. One of `forever`, `once`, and `repeating`.
*/
duration?: pulumi.Input<string>;
/**
* If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
*/
durationInMonths?: pulumi.Input<number>;
/**
* Int. Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
*/
maxRedemptions?: pulumi.Input<number>;
/**
* Map(String). 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.
*/
metadata?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* String. Name of the coupon displayed to customers on for instance invoices or receipts.
*/
name?: pulumi.Input<string>;
/**
* Float. 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 percentOff of 50 will make a $100 invoice $50 instead.
*/
percentOff?: pulumi.Input<number>;
/**
* String. Date after which the coupon can no longer be redeemed. Expected format is in the `RFC3339`.
*/
redeemBy?: pulumi.Input<string>;
/**
* Int. Number of times this coupon has been applied to a customer.
*/
timesRedeemed?: pulumi.Input<number>;
/**
* Bool. Taking account of the above properties, whether this coupon can still be applied to a customer.
*/
valid?: pulumi.Input<boolean>;
}
/**
* The set of arguments for constructing a Coupon resource.
*/
export interface CouponArgs {
/**
* Int. Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
*/
amountOff?: pulumi.Input<number>;
/**
* List(String). A list of product IDs this coupon applies to.
*/
appliesTos?: pulumi.Input<pulumi.Input<string>[]>;
/**
* String. Unique string of your choice that will be used to identify this coupon when applying it to a customer.
*/
couponId?: pulumi.Input<string>;
/**
* String. Required if `amountOff` has been set, the three-letter ISO code for the currency of the amount to take off.
*/
currency?: pulumi.Input<string>;
/**
* String. Describes how long a customer who applies this coupon will get the discount. One of `forever`, `once`, and `repeating`.
*/
duration?: pulumi.Input<string>;
/**
* If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
*/
durationInMonths?: pulumi.Input<number>;
/**
* Int. Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
*/
maxRedemptions?: pulumi.Input<number>;
/**
* Map(String). 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.
*/
metadata?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* String. Name of the coupon displayed to customers on for instance invoices or receipts.
*/
name?: pulumi.Input<string>;
/**
* Float. 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 percentOff of 50 will make a $100 invoice $50 instead.
*/
percentOff?: pulumi.Input<number>;
/**
* String. Date after which the coupon can no longer be redeemed. Expected format is in the `RFC3339`.
*/
redeemBy?: pulumi.Input<string>;
}