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
| Provider | Key | Status | Methods |
|---|---|---|---|
| VNPAY QR MMS | VNPAY_QR_MMS | Production | Dynamic QR Code |
| VNPAY Phone POS | VNPAY_PHONE_POS | Production | Phone-based POS |
| VNPAY Smart POS | VNPAY_SMART_POS | Production | Smart Terminal |
| System | SYSTEM | Production | Cash, 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:
| Method | Key | Provider(s) | Description |
|---|---|---|---|
| QR Code | 100_QR_CODE | VNPAY_QR_MMS | Dynamic QR for bank apps |
| Card | 400_CARD | VNPAY_PHONE_POS, VNPAY_SMART_POS | NFC/Chip card payment |
| Cash | 000_CASH | SYSTEM | Physical cash |
| Bank Transfer | 200_BANK_TRANSFER | SYSTEM | Manual 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
| Capability | QR MMS | Phone POS | Smart POS | System |
|---|---|---|---|---|
| Real-time confirmation | Yes | Yes | Yes | Manual |
| Automatic IPN | Yes | Yes | Yes | No |
| Cancel payment | Yes | Yes | Yes | No |
| Query status | Yes | Yes | Yes | No |
| Refund support | Yes | Yes | Yes | Manual |
| Split payment | Yes | Yes | Yes | Yes |
| Offline mode | No | No | No | Yes |
Quick Links
| Documentation | Description |
|---|---|
| VNPAY QR MMS | QR code payment via banking apps |
| VNPAY Phone POS | Mobile phone as POS terminal |
| VNPAY Smart POS | Smart POS terminal integration |
| System Provider | Cash and manual bank transfer |