Skip to content

Payment Providers

MQ-Pay supports multiple payment providers through a unified API. Each provider handles specific payment methods and integrates with different payment gateways.

Available Providers

ProviderKeyStatusMethods
VNPAY QR MMSVNPAY_QR_MMSProductionDynamic QR Code
VNPAY Phone POSVNPAY_PHONE_POSProductionPhone-based POS
VNPAY Smart POSVNPAY_SMART_POSProductionSmart Terminal
SystemSYSTEMProductionCash, Bank Transfer

Provider Architecture

Provider Factory

The PaymentProviderFactory automatically instantiates and registers providers based on your configuration:

typescript
// Configuration determines which providers are available
const options: IMQPayOptions = {
  // Enable VNPay QR MMS
  vnpayQrMMS: {
    enable: true,
    isDefault: true,
    // ... credentials
  },

  // Enable VNPay Phone POS
  vnpayPhonePOS: {
    enable: true,
    // ... credentials
  },

  // System provider is always available
};

// Factory creates providers
const factory = new PaymentProviderFactory(options);
const providers = factory.getEnabledProviders();
// => [VNPayQrMMSProvider, VNPayPhonePOSProvider, SystemProvider]

Payment Methods

Each provider supports specific payment methods:

MethodKeyProvider(s)Description
QR Code100_QR_CODEVNPAY_QR_MMSDynamic QR for bank apps
Card400_CARDVNPAY_PHONE_POS, VNPAY_SMART_POSNFC/Chip card payment
Cash000_CASHSYSTEMPhysical cash
Bank Transfer200_BANK_TRANSFERSYSTEMManual transfer

Selecting a Provider

By Default Provider

typescript
// Uses the provider marked as isDefault: true
const response = await paymentService.checkout({
  source: { type: 'Order', id: orderId },
  payment: {
    method: '100_QR_CODE', // Method determines provider
    total: 100000,
  },
});

By Explicit Provider

typescript
// Explicitly specify the provider
const response = await paymentService.checkout({
  source: { type: 'Order', id: orderId },
  payment: {
    provider: 'VNPAY_PHONE_POS',
    method: '400_CARD',
    total: 100000,
  },
});

Provider Capabilities

CapabilityQR MMSPhone POSSmart POSSystem
Real-time confirmationYesYesYesManual
Automatic IPNYesYesYesNo
Cancel paymentYesYesYesNo
Query statusYesYesYesNo
Refund supportYesYesYesManual
Split paymentYesYesYesYes
Offline modeNoNoNoYes
DocumentationDescription
VNPAY QR MMSQR code payment via banking apps
VNPAY Phone POSMobile phone as POS terminal
VNPAY Smart POSSmart POS terminal integration
System ProviderCash and manual bank transfer

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.