pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
149 lines • 6.52 kB
JavaScript
;
// *** 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.Card = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* With this resource, you can create a card - [Stripe API card documentation](https://stripe.com/docs/api/cards).
*
* You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit
* cards on a recipient in order to transfer to those cards later.
*
* > Passing your cardholder’s full credit card number to Stripe’s API isn't a recommended approach. In rare cases, you
* may have to continue handling full credit card information directly. If this applies to you, you can enable unsafe
* processing in your [dashboard](https://dashboard.stripe.com/settings/integration).
*
* > Using the stripe.Card resource may potentially leak credit card information into your Terraform State.
* Please see these recommendations
* on how to treat sensitive data in Terraform State.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // card for the customer
* const cardCard = new stripe.Card("cardCard", {
* customer: stripe_customer.customer.id,
* number: "4242424242424242",
* cvc: 123,
* expMonth: 8,
* expYear: 2030,
* });
* // card for the customer with address
* const cardIndex_cardCard = new stripe.Card("cardIndex/cardCard", {
* customer: stripe_customer.customer.id,
* number: "4242424242424242",
* cvc: 123,
* expMonth: 8,
* expYear: 2030,
* address: {
* line1: "1 The Best Street",
* line2: "Apartment 401",
* city: "Sydney",
* state: "NSW",
* zip: "2000",
* country: "Australia",
* },
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import stripe:index/card:Card card <card_id>
* ```
*/
class Card extends pulumi.CustomResource {
/**
* Get an existing Card 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 Card(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Card. 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'] === Card.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["address"] = state?.address;
resourceInputs["addressLine1Check"] = state?.addressLine1Check;
resourceInputs["addressZipCheck"] = state?.addressZipCheck;
resourceInputs["availablePayoutMethods"] = state?.availablePayoutMethods;
resourceInputs["brand"] = state?.brand;
resourceInputs["country"] = state?.country;
resourceInputs["customer"] = state?.customer;
resourceInputs["cvc"] = state?.cvc;
resourceInputs["cvcCheck"] = state?.cvcCheck;
resourceInputs["expMonth"] = state?.expMonth;
resourceInputs["expYear"] = state?.expYear;
resourceInputs["fingerprint"] = state?.fingerprint;
resourceInputs["funding"] = state?.funding;
resourceInputs["last4"] = state?.last4;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["name"] = state?.name;
resourceInputs["number"] = state?.number;
resourceInputs["tokenizationMethod"] = state?.tokenizationMethod;
}
else {
const args = argsOrState;
if (args?.customer === undefined && !opts.urn) {
throw new Error("Missing required property 'customer'");
}
if (args?.expMonth === undefined && !opts.urn) {
throw new Error("Missing required property 'expMonth'");
}
if (args?.expYear === undefined && !opts.urn) {
throw new Error("Missing required property 'expYear'");
}
if (args?.number === undefined && !opts.urn) {
throw new Error("Missing required property 'number'");
}
resourceInputs["address"] = args?.address;
resourceInputs["customer"] = args?.customer;
resourceInputs["cvc"] = args?.cvc ? pulumi.secret(args.cvc) : undefined;
resourceInputs["expMonth"] = args?.expMonth;
resourceInputs["expYear"] = args?.expYear;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["name"] = args?.name;
resourceInputs["number"] = args?.number ? pulumi.secret(args.number) : undefined;
resourceInputs["addressLine1Check"] = undefined /*out*/;
resourceInputs["addressZipCheck"] = undefined /*out*/;
resourceInputs["availablePayoutMethods"] = undefined /*out*/;
resourceInputs["brand"] = undefined /*out*/;
resourceInputs["country"] = undefined /*out*/;
resourceInputs["cvcCheck"] = undefined /*out*/;
resourceInputs["fingerprint"] = undefined /*out*/;
resourceInputs["funding"] = undefined /*out*/;
resourceInputs["last4"] = undefined /*out*/;
resourceInputs["tokenizationMethod"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["cvc", "number"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Card.__pulumiType, name, resourceInputs, opts);
}
}
exports.Card = Card;
/** @internal */
Card.__pulumiType = 'stripe:index/card:Card';
//# sourceMappingURL=card.js.map