CapsuleCredit
← All posts

Unlocking Payment Flexibility: 5 Steps to Virtual Card Issuance

May 12, 2026

▶ Watch the 60-second version on YouTube

Introduction to Virtual Card Issuance

Virtual cards offer dynamic solutions for managing spending, enhanced security, and better budgeting. As a developer, you can leverage APIs from providers like Stripe and Lithic to programmatically issue virtual cards, enabling your users to have more control over their transactions. This post will guide you through the process of setting up your virtual card issuance program step-by-step, integrating with the Stripe Issuing and Lithic APIs, and uncovering some not-so-obvious nuances that can save you headaches down the line.

Step 1: Setting Up Your API Keys

Before diving into the code, ensure you have your API keys handy. You'll need to sign up for Stripe and Lithic and retrieve your secret keys from their respective dashboards.

  • Stripe: Navigate to the API section of your dashboard to get your secret key.
  • Lithic: Similarly, grab your API key from the API credentials section.

Step 2: Create a Virtual Card with Stripe Issuing

Let’s start with Stripe. The following code snippet demonstrates how to create a virtual card using the Stripe Issuing API.

import stripe

# Set your secret key
stripe.api_key = 'sk_test_your_secret_key'

# Create a virtual card
virtual_card = stripe.Issuing.Card.create(
    cardholder='ich_123',  # Replace with your actual cardholder ID
    currency='usd',
    type='virtual',
    spending_controls={
        'spending_limits': [{
            'amount': 10000,  # Limit in cents
            'interval': 'day'
        }]
    }
)

print(f"Card created: {virtual_card.id}")  

Step 3: Integrate with Lithic for Enhanced Features

Now, let’s look at how to integrate Lithic to enhance your virtual card capabilities. Lithic offers advanced features like real-time transaction monitoring and instant card issuance.

import requests

# Lithic API endpoint for card creation
lithic_url = 'https://api.lithic.com/v1/cards'
headers = {
    'Authorization': 'Bearer your_lithic_api_key',
    'Content-Type': 'application/json'
}
payload = {
    "type": "virtual",
    "holder": {
        "name": "John Doe",
        "email": "john.doe@example.com"
    },
    "spending_controls": {
        "max_transaction_amount": 10000,  # Limit in cents
        "daily_limit": 50000  # Daily spending limit in cents
    }
}

response = requests.post(lithic_url, headers=headers, json=payload)
if response.status_code == 200:
    card_info = response.json()
    print(f"Card created: {card_info['id']}")
else:
    print(f"Error creating card: {response.status_code} - {response.text}")

Step 4: Implementing Spending Controls

Both Stripe and Lithic give you robust options for implementing spending controls. You can set limits per transaction, daily caps, or even category-based restrictions. This allows you to create a tailored experience for your users and manage the risk of fraud effectively.

Gotcha: When using Stripe's spending controls, ensure that the limits are in cents, not dollars. This small detail often trips up developers and results in unexpected behaviors.

Step 5: Monitor Transactions

Once your virtual card is set up, the next step is to monitor transactions. Utilizing webhooks can help you stay updated on transaction statuses, spending alerts, and more.

For example, you can subscribe to the issuing.transactions.created webhook on Stripe to get notified whenever a transaction occurs:

from flask import Flask, request

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def stripe_webhook():
    event = request.json
    if event['type'] == 'issuing.transaction.created':
        transaction = event['data']['object']
        print(f"New transaction: {transaction['id']}")
    return '', 200

if __name__ == '__main__':
    app.run(port=5000)

Final Thoughts

Issuing virtual cards can significantly enhance the user experience in your payment or fintech product. By leveraging APIs from Stripe and Lithic, you can create a flexible and secure payment solution. Remember to implement proper error handling and logging for a production-ready application. As you scale, consider adding features like real-time analytics, transaction insights, and personalized user notifications to truly harness the power of virtual card issuance.

By following these steps, you’ll be well on your way to integrating virtual card issuance into your product. Happy coding!

💳 Best card for API and cloud spend — earn rewards on every Stripe, AWS, and OpenAI charge.

Get Brex →