UNPKG

pulumi-stripe

Version:

A Pulumi package for creating and managing Stripe resources.

131 lines 5.05 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ShippingRate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * With this resource, you can create a shipping rate - [Stripe API shipping rate documentation](https://stripe.com/docs/api/shipping_rates). * * Shipping rates let you display various shipping options—like standard, express, and overnight—with more accurate delivery estimates. * Charge your customer for shipping using different Stripe products, some of which require coding. * * > Removal of the shipping rate isn't supported through the Stripe API. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as stripe from "pulumi-stripe"; * * // shipping rate with delivery estimate * const shippingRate = new stripe.ShippingRate("shippingRate", { * deliveryEstimates: [{ * maximum: { * unit: "day", * value: 4, * }, * minimum: { * unit: "hour", * value: 24, * }, * }], * displayName: "shipping rate", * fixedAmount: { * amount: 1000, * currency: "aud", * }, * }); * // shipping rate with currency options * // !!! Currency options have to be sorted alphabetically * // !!! by the currency field * const shipping = new stripe.ShippingRate("shipping", { * displayName: "shipping rate", * fixedAmount: { * amount: 1000, * currency: "aud", * currencyOptions: [ * { * amount: 350, * currency: "eur", * }, * { * amount: 500, * currency: "usd", * }, * ], * }, * }); * ``` * * ## Import * * ```sh * $ pulumi import stripe:index/shippingRate:ShippingRate rate <shipping_rate_id> * ``` */ class ShippingRate extends pulumi.CustomResource { /** * Get an existing ShippingRate 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, id, state, opts) { return new ShippingRate(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ShippingRate. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ShippingRate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["active"] = state?.active; resourceInputs["deliveryEstimates"] = state?.deliveryEstimates; resourceInputs["displayName"] = state?.displayName; resourceInputs["fixedAmount"] = state?.fixedAmount; resourceInputs["livemode"] = state?.livemode; resourceInputs["metadata"] = state?.metadata; resourceInputs["taxBehavior"] = state?.taxBehavior; resourceInputs["taxCode"] = state?.taxCode; resourceInputs["type"] = state?.type; } else { const args = argsOrState; if (args?.displayName === undefined && !opts.urn) { throw new Error("Missing required property 'displayName'"); } if (args?.fixedAmount === undefined && !opts.urn) { throw new Error("Missing required property 'fixedAmount'"); } resourceInputs["active"] = args?.active; resourceInputs["deliveryEstimates"] = args?.deliveryEstimates; resourceInputs["displayName"] = args?.displayName; resourceInputs["fixedAmount"] = args?.fixedAmount; resourceInputs["metadata"] = args?.metadata; resourceInputs["taxBehavior"] = args?.taxBehavior; resourceInputs["taxCode"] = args?.taxCode; resourceInputs["type"] = args?.type; resourceInputs["livemode"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ShippingRate.__pulumiType, name, resourceInputs, opts); } } exports.ShippingRate = ShippingRate; /** @internal */ ShippingRate.__pulumiType = 'stripe:index/shippingRate:ShippingRate'; //# sourceMappingURL=shippingRate.js.map