Back to Recipes
Recipes15 minJanuary 15, 2025

Build a Virtual Card Issuance Platform with MoneyGraph

Complete guide to issuing virtual and physical cards with MoneyGraph. Includes customer onboarding, KYC verification, card creation, funding, and transaction monitoring.

By MoneyGraph Team

# Build a Virtual Card Issuance Platform with MoneyGraph

This recipe shows you how to build a complete card issuance platform using MoneyGraph SDK. Issue virtual and physical cards to your verified customers with full control over funding, spending limits, and transaction monitoring.

User Journey Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│                        CARD ISSUANCE USER JOURNEY                           │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  1. USER REGISTRATION                                                       │
│     ├── User signs up on your platform                                      │
│     ├── Create customer: mg.customers.create()                              │
│     └── Collect basic info (name, email, phone, country)                    │
│                                                                             │
│  2. KYC VERIFICATION (REQUIRED FOR CARDS)                                   │
│     ├── Update customer with KYC details                                    │
│     │   └── Birthday (DD-MM-YYYY), ID type, ID number                       │
│     ├── Upload ID document: mg.customers.kyc.uploadDocument()               │
│     │   └── id_front, id_back, selfie                                       │
│     ├── Submit KYC: mg.customers.kyc.submit()                               │
│     └── Wait for approval (webhook or polling)                              │
│                                                                             │
│  3. CARD ISSUANCE                                                           │
│     ├── Verify KYC: mg.customers.kyc.canPayout()                            │
│     ├── Create card: mg.cards.create()                                      │
│     │   ├── type: 'virtual' (instant) or 'physical' (ships)                 │
│     │   ├── currency: 'USD', 'EUR', etc.                                    │
│     │   └── spending_limit: Daily/monthly limit                             │
│     └── Return card details to user                                         │
│                                                                             │
│  4. CARD MANAGEMENT                                                         │
│     ├── Fund card: mg.cards.fund()                                          │
│     ├── Freeze/Unfreeze: mg.cards.freeze(), mg.cards.unfreeze()             │
│     ├── Update limit: mg.cards.updateLimit()                                │
│     └── Monitor transactions: mg.cards.transactions()                       │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

AI Agent Quick Start

Use this prompt with your AI coding assistant:

Build a virtual card issuance platform using MoneyGraph SDK with these features:
  1. USER REGISTRATION & KYC
  2. - Registration form: name, email, phone, country
  3. - Create customer: mg.customers.create()
  4. - KYC form: birthday (DD-MM-YYYY), ID type, ID number
  5. - Document upload: mg.customers.kyc.uploadDocument()
  6. - id_front, id_back, selfie
  7. - Submit KYC: mg.customers.kyc.submit()
  8. - Status check: mg.customers.kyc.getStatus()
  1. CARD ISSUANCE (Requires approved KYC!)
  2. - Verify eligibility: mg.customers.kyc.canPayout()
  3. - Issue card: mg.cards.create({ type: 'virtual', currency: 'USD' })
  4. - Display card details: mg.cards.getDetails()
  5. - Show last 4 digits, expiry, full number (once)
  1. CARD FUNDING
  2. - Fund from wallet: mg.cards.fund({ amount })
  3. - Show balance updates
  4. - Withdraw to wallet: mg.cards.withdraw({ amount })
  1. CARD MANAGEMENT
  2. - Freeze/Unfreeze: mg.cards.freeze(), mg.cards.unfreeze()
  3. - Update limit: mg.cards.updateLimit()
  4. - Cancel: mg.cards.cancel()
  1. TRANSACTION HISTORY
  2. - List transactions: mg.cards.transactions()
  3. - Show date, merchant, amount, status

KYC STATUS FLOW: - PENDING → "Your verification is under review" - APPROVED → Enable card issuance - REJECTED → Show reason, allow resubmission

CRITICAL RULES: - NEVER issue cards without approved KYC - Birthday format MUST be DD-MM-YYYY - Handle card details securely (show once, don't log) - Always check mg.customers.kyc.canPayout() before mg.cards.create()

SANDBOX TESTING: - Use mg.customers.createMockPersona('individual_verified') for instant verified customer - Cards work immediately in sandbox mode ```

KYC Compliance Requirements

Cards require approved KYC verification. Here's the complete KYC flow:

Step 1: Create Customer

import { MoneyGraph } from '@moneygraph/sdk';

const mg = new MoneyGraph({ apiKey: process.env.MONEYGRAPH_API_KEY! });

// Create customer account const customer = await mg.customers.create({ account_type: 'personal', // or 'business' first_name: 'John', last_name: 'Doe', email: '[email protected]', phone: '12025551234', phone_iso2: 'US', country: 'US', });

console.log('Customer ID:', customer.id); ```

Step 2: Submit KYC

// Upload documents
await mg.customers.kyc.uploadDocument(customer.id, 'id_front', idFrontFile, 'passport-front.jpg');
await mg.customers.kyc.uploadDocument(customer.id, 'selfie', selfieFile, 'selfie.jpg');

// Submit with ID details await mg.customers.kyc.submit(customer.id, { id_type: 'PASSPORT', id_number: 'A12345678', }); ```

Step 3: Check Status

const status = await mg.customers.kyc.getStatus(customer.id);

switch (status.status) { case 'APPROVED': console.log('KYC approved! Can issue cards.'); break; case 'PENDING': console.log('KYC under review. Check back later.'); break; case 'REJECTED': console.log('KYC rejected:', status.rejection_reason); break; } ```

Card Issuance

Issue Virtual Card

// Verify KYC first
const eligibility = await mg.customers.kyc.canPayout(customer.id);
if (!eligibility.can_payout) {
  throw new Error('Cannot issue card: KYC not approved');
}

// Create virtual card const card = await mg.cards.create(customer.id, { type: 'virtual', currency: 'USD', spending_limit: 1000, });

console.log('Card created:', card.id); console.log('Last 4 digits:', card.last_four); ```

Get Full Card Details

// Get sensitive card details (secure handling required!)
const details = await mg.cards.getDetails(card.id);

console.log('Card Number:', details.card_number); console.log('CVV:', details.cvv); console.log('Expiry:', details.expiry); ```

Card Management

// Fund card
await mg.cards.fund(card.id, { amount: 100 });

// Freeze card (temporary disable) await mg.cards.freeze(card.id);

// Unfreeze card await mg.cards.unfreeze(card.id);

// Update spending limit await mg.cards.updateLimit(card.id, 2000);

// List transactions const transactions = await mg.cards.transactions(card.id).all(); ```

Next Steps

Resources:

Ready to Build?

Install MoneyGraph SDK and start building with AI assistance