Visa API - Complete Visa Checkout & Payment Processing
The Visa API provides comprehensive Visa card payment processing capabilities including card validation, checkout transactions, refunds, and transaction management. Built for enterprise-grade payment processing with multi-currency support, fee management, and webhook integration.
🎯 What Can You Manage?
Your complete Visa payment ecosystem with these powerful tools:
- Card Validation: Validate Visa cards before processing payments
- Checkout Processing: Pull funds from Visa cards to wallets
- Refund Management: Reverse transactions and manual refunds
- Transaction History: Track all Visa transactions with detailed records
- Fee Management: Dynamic fee calculation and revenue tracking
- Webhook Integration: Real-time transaction status updates
- Multi-Currency: Support for BRDZ currencies (USD, IDR, SGD, AUD, INR, VND)
🧩 Your Visa Payment Building Blocks
💳 Card Validation Blocks
POST /vs-checkout/visa/validate- Validate Visa card (legacy)POST /vs-checkout/visa/validatecc- Validate with currency selection
🛒 Checkout Processing Blocks
POST /vs-checkout/visa- Visa checkout (legacy USD only)POST /vs-checkout/visacc- Visa checkout with currency selectionGET /vs-checkout/visa/fee- Get checkout fee percentage
💰 Refund & Transfer Blocks
POST /vs-checkout/visa/refund- Reverse funds (refund)POST /vs-checkout/visa/manual_refund- Manual push to card
📊 Transaction Management Blocks
GET /vs-checkout/visa/reference/:reference_id- Get transaction by RRNGET /vs-checkout/visa/history- Transaction historyPOST /vs-checkout/visa/callback- Webhook callback handler
🏗️ Common Visa Payment Patterns
Pattern 1: "I want to process a Visa payment"
Validate card → Check fees → Process checkout → Track transaction
Use: POST /vs-checkout/visa/validatecc → GET /vs-checkout/visa/fee → POST /vs-checkout/visacc
Pattern 2: "I want to refund a transaction"
Find transaction → Process refund → Update records
Use: GET /vs-checkout/visa/reference/:reference_id → POST /vs-checkout/visa/refund
Pattern 3: "I want to track payment history"
Get user transactions → Review details → Generate reports
Use: GET /vs-checkout/visa/history
Pattern 4: "I want to handle webhook notifications"
Receive callback → Process status → Update transaction
Use: POST /vs-checkout/visa/callback
💳 Card Validation Operations
Validate Visa Card (Legacy)
Validate Visa Card (Legacy - USD Only)
Validate Visa card information before processing payments. Legacy endpoint that automatically uses USD wallet. Performs card verification with address validation and merchant information.
Parameters
card_numberstringrequiredVisa card number (16 digits)
expiry_datestringrequiredCard expiry date (MMYY format)
cvvstringrequiredCard verification value (3 digits)
Request Body
{
"card_number": "4111111111111111",
"expiry_date": "1225",
"cvv": "123"
}Response
{
"message": "Visa Card Validation Successful",
"data": {
"wallet_id": "wallet_456789",
"card_last4": "1111",
"validation_status": "APPROVED",
"merchant_info": {
"name": "AOL Checkout",
"terminal_id": "AOL00001",
"id_code": "AOL0000000001"
},
"address_verification": {
"street": "801 Metro Center Blv",
"postal_code": "94404",
"city": "Foster City",
"state": "CA",
"country": "US"
}
}
}{
"error": "Card number, expiry date, CVV, street, and postal code are required."
}{
"error": "Unauthorized: user_id missing"
}{
"error": "USD Wallet not found for user"
}{
"error": "Visa Card Validation Failed",
"details": "Invalid card number or expired card"
}Validate Visa Card with Currency
Validate Visa Card with Currency Selection
Validate Visa card with specific currency wallet selection. Updated endpoint that allows users to choose which currency wallet to use for the transaction.
Parameters
card_numberstringrequiredVisa card number (16 digits)
expiry_datestringrequiredCard expiry date (MMYY format)
cvvstringrequiredCard verification value (3 digits)
currencystringrequiredTarget wallet currency (USD, IDR, SGD, AUD, INR, VND)
Request Body
{
"card_number": "4111111111111111",
"expiry_date": "1225",
"cvv": "123",
"currency": "IDR"
}Response
{
"message": "Visa Card Validation Successful",
"data": {
"wallet_id": "wallet_789012",
"card_last4": "1111",
"currency": "IDR",
"validation_status": "APPROVED",
"merchant_info": {
"name": "AOL Checkout",
"terminal_id": "AOL00001",
"id_code": "AOL0000000001"
}
}
}{
"error": "Card number, expiry date, CVV, and currency are required."
}{
"error": "IDR Wallet not found for user"
}🛒 Checkout Processing Operations
Visa Checkout (Legacy)
Visa Checkout (Legacy - USD Only)
Process Visa card payment by pulling funds from card to USD wallet. Legacy endpoint with fixed USD currency and automatic fee calculation with platform revenue tracking.
Parameters
card_numberstringrequiredVisa card number (16 digits)
expiry_datestringrequiredCard expiry date (MMYY format)
amountnumberrequiredAmount to charge from card
currency_codestringrequiredCurrency code (must be USD for legacy endpoint)
Request Body
{
"card_number": "4111111111111111",
"expiry_date": "1225",
"amount": 100,
"currency_code": "USD"
}Response
{
"message": "Visa Checkout (Pull Funds) successful",
"data": {
"reference_id": "visa_1705123456789",
"approval_code": "AUTH123456",
"transaction_identifier": "TXN789012345",
"card_last4": "1111",
"amount": 100,
"currency": "USD",
"status": "SUCCESS_RECEIVED",
"wallet_id": "wallet_456789",
"platform_fee": 3,
"net_amount": 97,
"steps": [
{
"step": 1,
"description": "Paid via Visa: $100.00"
},
{
"step": 2,
"description": "Transaction fee: $3.00"
},
{
"step": 3,
"description": "Net credited to wallet: $97.00"
}
]
}
}{
"error": "user_id, card number, expiry date, amount and currency_code are required."
}{
"error": "USD Wallet not found for user"
}{
"error": "Visa Checkout Failed",
"details": "Card declined or insufficient funds"
}Visa Checkout with Currency
Visa Checkout with Currency Selection
Process Visa card payment with specific currency wallet selection. Updated endpoint that allows charging to any supported BRDZ currency wallet with dynamic fee calculation.
Parameters
card_numberstringrequiredVisa card number (16 digits)
expiry_datestringrequiredCard expiry date (MMYY format)
amountnumberrequiredAmount to charge from card
currency_codestringrequiredTarget wallet currency (USD, IDR, SGD, AUD, INR, VND)
Request Body
{
"card_number": "4111111111111111",
"expiry_date": "1225",
"amount": 2500000,
"currency_code": "IDR"
}Response
{
"message": "Visa Checkout (Pull Funds) successful",
"data": {
"reference_id": "visa_1705123456790",
"approval_code": "AUTH789012",
"transaction_identifier": "TXN345678901",
"card_last4": "1111",
"amount": 2500000,
"currency": "IDR",
"status": "SUCCESS_RECEIVED",
"wallet_id": "wallet_789012",
"platform_fee": 75000,
"net_amount": 2425000,
"steps": [
{
"step": 1,
"description": "Paid via Visa: RP2,500,000.00"
},
{
"step": 2,
"description": "Transaction fee: RP75,000.00"
},
{
"step": 3,
"description": "Net credited to wallet: RP2,425,000.00"
}
]
}
}{
"error": "IDR Wallet not found for user"
}Get Visa Checkout Fee
Get Visa Checkout Fee Percentage
Retrieve current Visa checkout fee percentage for transaction cost calculation. Used by frontend to display fees before processing payments.
Response
{
"fee_percentage": 3
}{
"error": "Failed to retrieve Visa fee"
}💰 Refund & Transfer Operations
Visa Refund (Reverse Funds)
Visa Refund via Reverse Funds
Process refund by reversing a previous Visa transaction. Returns funds from wallet back to the original Visa card using the transaction reference ID.
Parameters
amountnumberrequiredRefund amount
currency_codestringrequiredCurrency code for refund (USD, IDR, SGD, AUD, INR, VND)
card_numberstringrequiredOriginal Visa card number
expiry_datestringrequiredCard expiry date (MMYY format)
reference_idstringrequiredOriginal transaction reference ID
Request Body
{
"amount": 500000,
"currency_code": "IDR",
"card_number": "4111111111111111",
"expiry_date": "1225",
"reference_id": "visa_1705123456789"
}Response
{
"message": "Visa Refund (Reverse) successful",
"data": {
"refund_id": "refund_1705123456800",
"original_reference": "visa_1705123456789",
"amount": 500000,
"currency": "IDR",
"status": "REFUND_PROCESSED",
"refund_method": "REVERSE_FUNDS",
"processed_at": "2024-01-15T11:00:00Z"
}
}{
"error": "All refund fields are required."
}{
"error": "Visa Refund Failed",
"details": "Original transaction not found or already refunded"
}Manual Refund (Push Funds)
Manual Refund via Push Funds
Manually push funds to a Visa card without requiring an original transaction reference. Used for compensation, bonuses, or manual refunds.
Parameters
amountnumberrequiredAmount to push to card
currency_codestringrequiredCurrency code (USD, IDR, SGD, AUD, INR, VND)
card_numberstringrequiredDestination Visa card number
recipient_namestringrequiredCardholder name
Request Body
{
"amount": 250000,
"currency_code": "IDR",
"card_number": "4111111111111111",
"recipient_name": "John Doe"
}Response
{
"message": "Visa Manual Push successful",
"data": {
"push_id": "push_1705123456801",
"amount": 250000,
"currency": "IDR",
"card_last4": "1111",
"recipient_name": "John Doe",
"status": "PUSH_PROCESSED",
"push_method": "MANUAL_FUNDS",
"processed_at": "2024-01-15T11:05:00Z"
}
}{
"error": "Amount, currency_code, card number, and recipient name required."
}{
"error": "Visa Push Failed",
"details": "Invalid card number or card does not support push transactions"
}📊 Transaction Management Operations
Get Transaction by Reference
Get Transaction by Reference ID (RRN)
Retrieve specific Visa transaction details using the transaction reference ID or RRN (Retrieval Reference Number). Used for transaction lookup and verification.
Parameters
reference_idstringrequiredTransaction reference ID or RRN
Response
{
"message": "Transaction retrieved by RRN",
"data": {
"id": 12345,
"reference_id": "visa_1705123456789",
"wallet_id": "wallet_456789",
"user_id": 123,
"type": "TOPUP",
"card_last4": "1111",
"amount": 2500000,
"currency": "IDR",
"status": "SUCCESS_RECEIVED",
"approval_code": "AUTH123456",
"transaction_identifier": "TXN789012345",
"platform_fee": 75000,
"net_amount": 2425000,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:31:00Z"
}
}{
"error": "Transaction not found"
}{
"error": "Error retrieving transaction",
"details": "Database connection error"
}Get Transaction History
Get Visa Transaction History
Retrieve Visa transaction history for a specific wallet. Returns paginated list of all Visa transactions with detailed information including fees and status.
Parameters
wallet_idstringrequiredWallet ID to get transaction history for (query parameter)
Response
{
"message": "Visa transaction history retrieved successfully",
"data": [
{
"id": 12345,
"type": "TOPUP",
"card_last4": "1111",
"amount": 2500000,
"currency": "IDR",
"status": "SUCCESS_RECEIVED",
"approval_code": "AUTH123456",
"transaction_identifier": "TXN789012345",
"reference_id": "visa_1705123456789",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": 12346,
"type": "REFUND",
"card_last4": "1111",
"amount": 500000,
"currency": "IDR",
"status": "REFUND_PROCESSED",
"approval_code": "REF789012",
"transaction_identifier": "TXN345678901",
"reference_id": "refund_1705123456800",
"created_at": "2024-01-15T11:00:00Z"
}
]
}{
"error": "Wallet ID is required."
}{
"error": "Failed to fetch Visa transaction history",
"details": "Database query error"
}Visa Callback Handler
Visa Webhook Callback Handler
Handle webhook callbacks from Visa Direct for transaction status updates. Automatically updates transaction status based on Visa notifications.
Parameters
transactionIdentifierstringVisa transaction identifier
statusstringUpdated transaction status
Request Body
{
"transactionIdentifier": "TXN789012345",
"status": "COMPLETED",
"amount": 2500000,
"currency": "IDR",
"timestamp": "2024-01-15T10:31:00Z"
}Response
{
"message": "Callback received and processed."
}{
"error": "Callback processing failed",
"details": "Database update error"
}🚀 Complete Visa Payment Workflows
Workflow 1: Standard Visa Payment Processing
// Complete Visa payment processing workflow with BRDZ currencies
async function processVisaPayment(cardData, amount, currency) {
console.log('Starting Visa payment processing...');
// Step 1: Get current fee rate
const feeInfo = await fetch('/api/vs-checkout/visa/fee');
const feeData = await feeInfo.json();
console.log(`Fee rate: ${feeData.fee_percentage}%`);
// Step 2: Validate card with BRDZ currency selection
const validation = await fetch('/api/vs-checkout/visa/validatecc', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${userToken}`
},
body: JSON.stringify({
card_number: cardData.number,
expiry_date: cardData.expiry,
cvv: cardData.cvv,
currency: currency // IDR, SGD, AUD, INR, VND, USD
})
});
if (!validation.ok) {
throw new Error('Card validation failed');
}
console.log('Card validated successfully');
// Step 3: Process checkout
const checkout = await fetch('/api/vs-checkout/visacc', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${userToken}`
},
body: JSON.stringify({
card_number: cardData.number,
expiry_date: cardData.expiry,
amount: amount,
currency_code: currency
})
});
const checkoutData = await checkout.json();
console.log(`Payment processed: ${checkoutData.data.reference_id}`);
return {
reference_id: checkoutData.data.reference_id,
amount: checkoutData.data.amount,
fee: checkoutData.data.platform_fee,
net_amount: checkoutData.data.net_amount
};
}
Workflow 2: Multi-Currency Processing Examples
// Indonesian Rupiah (IDR) Payment Example
const idrPayment = await processVisaPayment(
{ number: "4111111111111111", expiry: "1225", cvv: "123" },
2500000.00, // RP 2.5 million
"IDR"
);
// Singapore Dollar (SGD) Payment Example
const sgdPayment = await processVisaPayment(
{ number: "4111111111111111", expiry: "1225", cvv: "123" },
150.00, // S$150
"SGD"
);
// Australian Dollar (AUD) Payment Example
const audPayment = await processVisaPayment(
{ number: "4111111111111111", expiry: "1225", cvv: "123" },
200.00, // A$200
"AUD"
);
// Indian Rupee (INR) Payment Example
const inrPayment = await processVisaPayment(
{ number: "4111111111111111", expiry: "1225", cvv: "123" },
15000.00, // ₹15,000
"INR"
);
// Vietnamese Dong (VND) Payment Example
const vndPayment = await processVisaPayment(
{ number: "4111111111111111", expiry: "1225", cvv: "123" },
5000000.00, // ₫5 million
"VND"
);
🎯 When to Use Which API
Card Processing
- Legacy USD only:
POST /vs-checkout/visa/validate→POST /vs-checkout/visa - Multi-currency BRDZ:
POST /vs-checkout/visa/validatecc→POST /vs-checkout/visacc - Fee calculation:
GET /vs-checkout/visa/fee
Refund Operations
- Transaction-based refund:
POST /vs-checkout/visa/refund - Manual compensation:
POST /vs-checkout/visa/manual_refund
Transaction Management
- Lookup transaction:
GET /vs-checkout/visa/reference/:reference_id - View history:
GET /vs-checkout/visa/history - Webhook handling:
POST /vs-checkout/visa/callback
💡 Pro Tips for BRDZ Visa Integration
Multi-Currency Support
// BRDZ supported currencies
const BRDZ_CURRENCIES = {
USD: { symbol: '$', decimals: 2, country: 'United States' },
IDR: { symbol: 'RP', decimals: 2, country: 'Indonesia' },
SGD: { symbol: 'S$', decimals: 2, country: 'Singapore' },
AUD: { symbol: 'A$', decimals: 2, country: 'Australia' },
INR: { symbol: '₹', decimals: 2, country: 'India' },
VND: { symbol: '₫', decimals: 0, country: 'Vietnam' }
};
function formatCurrency(amount, currency) {
const currencyInfo = BRDZ_CURRENCIES[currency];
if (!currencyInfo) {
throw new Error(`Unsupported currency: ${currency}`);
}
return `${currencyInfo.symbol}${amount.toLocaleString('en-US', {
minimumFractionDigits: currencyInfo.decimals,
maximumFractionDigits: currencyInfo.decimals
})}`;
}
// Usage examples
console.log(formatCurrency(2500000, 'IDR')); // RP2,500,000.00
console.log(formatCurrency(150, 'SGD')); // S$150.00
console.log(formatCurrency(5000000, 'VND')); // ₫5,000,000
Fee Management with Currency Support
// BRDZ Fee Calculator with multi-currency support
class BRDZVisaFeeCalculator {
static async calculateFees(amount, currency) {
const feeResponse = await fetch('/api/vs-checkout/visa/fee');
const feeData = await feeResponse.json();
const feePercentage = feeData.fee_percentage / 100;
const feeAmount = parseFloat((amount * feePercentage).toFixed(2));
const netAmount = parseFloat((amount - feeAmount).toFixed(2));
return {
gross_amount: amount,
fee_amount: feeAmount,
net_amount: netAmount,
fee_percentage: feeData.fee_percentage,
currency: currency
};
}
static displayFeeBreakdown(fees) {
const currencyInfo = BRDZ_CURRENCIES[fees.currency];
const symbol = currencyInfo ? currencyInfo.symbol : fees.currency;
return {
summary: `${symbol}${fees.gross_amount} → ${symbol}${fees.fee_amount} fee → ${symbol}${fees.net_amount} net`,
breakdown: [
`Gross amount: ${symbol}${fees.gross_amount}`,
`Platform fee (${fees.fee_percentage}%): ${symbol}${fees.fee_amount}`,
`Net amount: ${symbol}${fees.net_amount}`
]
};
}
}
// Usage
const fees = await BRDZVisaFeeCalculator.calculateFees(2500000, 'IDR');
console.log(BRDZVisaFeeCalculator.displayFeeBreakdown(fees));
🔐 Authentication & Authorization
All Visa endpoints require authentication:
// Configure authentication for BRDZ Visa API
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${userJWTToken}`,
'x-api-key': `${apiKey}`
};
// User-level operations (card validation, checkout, refunds)
await fetch('/api/vs-checkout/visa/validatecc', { headers, method: 'POST', body: cardData });
await fetch('/api/vs-checkout/visacc', { headers, method: 'POST', body: checkoutData });
// Public endpoints (webhook callback, fee info)
await fetch('/api/vs-checkout/visa/fee'); // No auth required
await fetch('/api/vs-checkout/visa/callback', { method: 'POST', body: webhookData }); // No auth required
🌍 BRDZ Supported Features
Multi-Currency Support
- Legacy endpoints: USD only (
/visa,/visa/validate) - Modern endpoints: All BRDZ currencies (
/visacc,/visa/validatecc) - Supported currencies: USD, IDR, SGD, AUD, INR, VND
- Coverage: Indonesia, Singapore, Australia, India, Vietnam, United States
Transaction Types
- TOPUP: Funds pulled from card to wallet
- REFUND: Funds returned from wallet to card
- MANUAL_PUSH: Direct push to card without original transaction
Fee Structure
- Dynamic fees: Retrieved from database configuration
- Platform revenue: Automatically tracked and logged
- Net calculations: Fees deducted from gross amount
- Multi-currency fees: Applied consistently across all BRDZ currencies
Use the newer endpoints (/visa/validatecc and /visacc) for multi-currency support with BRDZ currencies: USD, IDR, SGD, AUD, INR, VND.
Never log or store complete card numbers. Always use card_last4 for identification and ensure PCI DSS compliance in production environments.
BRDZ Visa processing is available in 6 countries: Indonesia, Singapore, Australia, India, Vietnam, and United States with full currency support.