pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
186 lines (185 loc) • 8.64 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* With this resource, you can create a promotion code - [Stripe API promotion code documentation](https://stripe.com/docs/api/promotion_codes).
*
* A Promotion Code represents a customer-redeemable code for a coupon. It can be used to create multiple codes for a single coupon.
*
* > Removal of the promotion code isn't supported through the Stripe SDK.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // promotion code for the coupon
* const codePromotionCode = new stripe.PromotionCode("codePromotionCode", {
* coupon: stripe_coupon.coupon.id,
* code: "FREE",
* });
* // promotion code for the coupon with limitations
* const codeIndex_promotionCodePromotionCode = new stripe.PromotionCode("codeIndex/promotionCodePromotionCode", {
* coupon: stripe_coupon.coupon.id,
* code: "FREE",
* maxRedemptions: 5,
* expiresAt: "2025-08-03T08:37:18+00:00",
* });
* // promotion code for the coupon to customer
* const codeStripeIndex_promotionCodePromotionCode = new stripe.PromotionCode("codeStripeIndex/promotionCodePromotionCode", {
* coupon: stripe_coupon.coupon.id,
* code: "FREE",
* customer: "cus...",
* });
* // promotion code for the coupon with restrictions
* const codeStripeIndex_promotionCodePromotionCode1 = new stripe.PromotionCode("codeStripeIndex/promotionCodePromotionCode1", {
* coupon: stripe_coupon.coupon.id,
* code: "FREE",
* restrictions: {
* firstTimeTransaction: true,
* minimumAmount: 100,
* minimumAmountCurrency: "aud",
* },
* });
* ```
* <!--End PulumiCodeChooser -->
*/
export declare class PromotionCode extends pulumi.CustomResource {
/**
* Get an existing PromotionCode 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?: PromotionCodeState, opts?: pulumi.CustomResourceOptions): PromotionCode;
/**
* Returns true if the given object is an instance of PromotionCode. 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 PromotionCode;
/**
* Bool. Whether the promotion code is currently active. Defaults to `true`.
*/
readonly active: pulumi.Output<boolean | undefined>;
/**
* String. The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically.
*/
readonly code: pulumi.Output<string | undefined>;
/**
* String. The coupon for this promotion code.
*/
readonly coupon: pulumi.Output<string>;
/**
* String. The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers.
*/
readonly customer: pulumi.Output<string | undefined>;
/**
* String. The timestamp at which this promotion code will expire. If the coupon has specified a `redeemsBy`, then this value cannot be after the coupon’s `redeemsBy`. Expected format is `RFC3339`.
*/
readonly expiresAt: pulumi.Output<string | undefined>;
/**
* Int. A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `maxRedemptions`, then this value cannot be greater than the coupon’s `maxRedemptions`.
*/
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>;
/**
* List(Resource). Settings that restrict the redemption of the promotion code. For details of individual arguments see Restrictions.
*/
readonly restrictions: pulumi.Output<outputs.PromotionCodeRestrictions | undefined>;
/**
* Create a PromotionCode 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: PromotionCodeArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering PromotionCode resources.
*/
export interface PromotionCodeState {
/**
* Bool. Whether the promotion code is currently active. Defaults to `true`.
*/
active?: pulumi.Input<boolean>;
/**
* String. The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically.
*/
code?: pulumi.Input<string>;
/**
* String. The coupon for this promotion code.
*/
coupon?: pulumi.Input<string>;
/**
* String. The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers.
*/
customer?: pulumi.Input<string>;
/**
* String. The timestamp at which this promotion code will expire. If the coupon has specified a `redeemsBy`, then this value cannot be after the coupon’s `redeemsBy`. Expected format is `RFC3339`.
*/
expiresAt?: pulumi.Input<string>;
/**
* Int. A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `maxRedemptions`, then this value cannot be greater than the coupon’s `maxRedemptions`.
*/
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>;
}>;
/**
* List(Resource). Settings that restrict the redemption of the promotion code. For details of individual arguments see Restrictions.
*/
restrictions?: pulumi.Input<inputs.PromotionCodeRestrictions>;
}
/**
* The set of arguments for constructing a PromotionCode resource.
*/
export interface PromotionCodeArgs {
/**
* Bool. Whether the promotion code is currently active. Defaults to `true`.
*/
active?: pulumi.Input<boolean>;
/**
* String. The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically.
*/
code?: pulumi.Input<string>;
/**
* String. The coupon for this promotion code.
*/
coupon: pulumi.Input<string>;
/**
* String. The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers.
*/
customer?: pulumi.Input<string>;
/**
* String. The timestamp at which this promotion code will expire. If the coupon has specified a `redeemsBy`, then this value cannot be after the coupon’s `redeemsBy`. Expected format is `RFC3339`.
*/
expiresAt?: pulumi.Input<string>;
/**
* Int. A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `maxRedemptions`, then this value cannot be greater than the coupon’s `maxRedemptions`.
*/
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>;
}>;
/**
* List(Resource). Settings that restrict the redemption of the promotion code. For details of individual arguments see Restrictions.
*/
restrictions?: pulumi.Input<inputs.PromotionCodeRestrictions>;
}