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.
# 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:- USER REGISTRATION & KYC
- - Registration form: name, email, phone, country
- - Create customer: mg.customers.create()
- - KYC form: birthday (DD-MM-YYYY), ID type, ID number
- - Document upload: mg.customers.kyc.uploadDocument()
- - id_front, id_back, selfie
- - Submit KYC: mg.customers.kyc.submit()
- - Status check: mg.customers.kyc.getStatus()
- CARD ISSUANCE (Requires approved KYC!)
- - Verify eligibility: mg.customers.kyc.canPayout()
- - Issue card: mg.cards.create({ type: 'virtual', currency: 'USD' })
- - Display card details: mg.cards.getDetails()
- - Show last 4 digits, expiry, full number (once)
- CARD FUNDING
- - Fund from wallet: mg.cards.fund({ amount })
- - Show balance updates
- - Withdraw to wallet: mg.cards.withdraw({ amount })
- CARD MANAGEMENT
- - Freeze/Unfreeze: mg.cards.freeze(), mg.cards.unfreeze()
- - Update limit: mg.cards.updateLimit()
- - Cancel: mg.cards.cancel()
- TRANSACTION HISTORY
- - List transactions: mg.cards.transactions()
- - 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:
- MoneyGraph SDK Documentation - Complete API reference
- Card Issuance Guide - Detailed implementation
- KYC Compliance - Verification requirements
Ready to Build?
Install MoneyGraph SDK and start building with AI assistance