Skip to content
GitHubXDiscord

Card

The Card resource lets you create and manage Stripe Cards attached to customers for payment processing.

Create a card using raw card details:

import { Card } from "alchemy/stripe";
const customerCard = await Card("customer-card", {
customer: "cus_xyz123",
number: "4242424242424242",
expMonth: 12,
expYear: 2025,
cvc: "123",
name: "John Doe",
});

Create a card with full billing address information:

import { Card } from "alchemy/stripe";
const cardWithAddress = await Card("card-with-address", {
customer: "cus_xyz123",
number: "4242424242424242",
expMonth: 12,
expYear: 2025,
cvc: "123",
name: "John Doe",
addressLine1: "123 Main St",
addressCity: "San Francisco",
addressState: "CA",
addressZip: "94105",
addressCountry: "US",
});

Create a card using a Stripe token:

import { Card } from "alchemy/stripe";
const tokenCard = await Card("token-card", {
customer: "cus_xyz123",
source: "tok_visa",
metadata: {
type: "primary",
source: "mobile_app",
},
});