Create Virtual Cards in Minutes with Stripe Issuing
May 12, 2026
▶ Watch the 60-second version on YouTube
The Power of Virtual Cards
Virtual cards are revolutionizing how businesses manage expenditures, providing both flexibility and enhanced security. With APIs like Stripe Issuing, creating and managing virtual cards can be achieved in a matter of minutes. This post dives into how to leverage Stripe Issuing to build a virtual card solution, complete with spending controls and effective tokenization.
Getting Started with Stripe Issuing
Before diving into the code, ensure you have a Stripe account and have enabled the Stripe Issuing functionality. You’ll need your API keys to authenticate your requests. Once you’ve got that sorted, let’s create a virtual card.
Creating a Virtual Card
Issuing a virtual card involves several steps, starting with creating a cardholder. A cardholder is an entity (like a user or business) that will use the card. After creating a cardholder, you can create a virtual card associated with that cardholder.
import stripe
# Set your secret key
stripe.api_key = 'sk_test_your_secret_key'
# Create a cardholder
cardholder = stripe.Issuing.Cardholder.create(
type="individual",
billing={"address": {"line1": "123 Main St", "city": "San Francisco", "state": "CA", "postal_code": "94105", "country": "US"}},
email="cardholder@example.com",
name="John Doe",
)
# Create a virtual card
card = stripe.Issuing.Card.create(
cardholder=cardholder.id,
currency="usd",
type="virtual",
spending_controls={
"allowed_categories": ["gas_stations", "restaurants"],
"spending_limits": [{"amount": 5000, "interval": "day"}],
},
)
print("Card created:", card.id)
In this code snippet, we first initialize the Stripe library and set our secret key. We then create a cardholder with basic billing information and an email. Next, we create a virtual card with specific spending controls that limit usage to gas stations and restaurants, with a daily limit of $5000. This setup is crucial for maintaining budgetary constraints.
Implementing Spending Controls
Spending controls in Stripe Issuing provide a robust way to manage how and where cards can be used. In our example, we allowed spending only in specific categories. You can also set multiple spending limits based on different intervals (daily, weekly, monthly). This level of granularity helps enforce compliance with financial policies.
Tokenization with Visa Token Service
When dealing with virtual cards, tokenization is key to enhancing security. By using Visa Token Service, you can tokenize card details to prevent sensitive information from being transmitted. This means that, instead of using the actual card number, you use a token that represents the card.
To incorporate Visa Token Service, you first need to set up your account with them. After that, you can integrate their API to tokenize card information. Here’s a simplified example of how to use their API:
curl -X POST https://sandbox.api.visa.com/vts/v1/tokens \
-H "Authorization: Bearer {your_token}" \
-H "Content-Type: application/json" \
-d '{
"accountNumber": "4111111111111111",
"expiration": "12/25",
"cvv": "123"
}'
This call would return a token that you can use instead of the actual card number, providing an additional layer of security.
Non-Obvious Gotcha: Cardholder Limits
One common pitfall when working with Stripe Issuing is misunderstanding the limits you can set on cardholders. If you apply spending controls to a cardholder, those limits apply to all cards issued to that cardholder. This can lead to unexpected behavior if you think each card can have independent limits.
For example, if you create multiple cards for a single cardholder with different spending controls, the cardholder's overall limits are enforced across all cards. If one card reaches its limit, it could affect the spending ability of all cards associated with that cardholder. Always keep this in mind when designing your card issuance strategy.
Real-World Applications
Virtual cards can be a game-changer in various scenarios, from managing employee spending to automating payment solutions for freelancers. By integrating Stripe Issuing with your existing workflows, you can streamline payments while retaining control over expenditures.
For instance, a company could issue virtual cards to employees for business travel, automatically enforcing spending limits based on travel policies. This not only simplifies expense management but also reduces the risk of unauthorized spending.
Conclusion
With Stripe Issuing, creating virtual cards and implementing spending controls is straightforward. By leveraging the power of APIs, you can build a secure and flexible payment system tailored to your business needs. Just remember to pay attention to cardholder limits to avoid unexpected spending issues.
Ready to take your payment solutions to the next level? Dive into the API documentation and explore the endless possibilities!
💳 Best card for API and cloud spend — earn rewards on every Stripe, AWS, and OpenAI charge.