CPay has been successfully integrated with your channel aggregator service, providing unified access to all payment channels through a single API key. This integration allows CPay to process payments through InstaPay, GCash, Maya, PesoNet, Korean Banks, and other channels using your unified API.
The following test credentials have been configured:
Merchant Name: CPAY
Merchant No.: 300000064613
SHA256 Key: uck6lo8sdjaarqf3sohdoovdvvn0kdnk
- File:
functions/src/integrations/channel-aggregator.ts - Features:
- SHA256 signature generation for security
- Unified API for all payment channels
- Transaction status checking
- Available channels listing
- Comprehensive error handling
- File:
functions/src/integrations/payment-gateways.ts - Changes:
- All individual gateways now use the channel aggregator
- Legacy gateway classes maintained for backward compatibility
- Unified gateway for new partner integrations
processChannelAggregatorTransfer- Direct channel aggregator transferscheckChannelAggregatorStatus- Check transaction statusgetChannelAggregatorChannels- Get available channels
Add the following environment variables to your Firebase Functions:
# Channel Aggregator Configuration
CHANNEL_AGGREGATOR_MERCHANT_NAME=CPAY
CHANNEL_AGGREGATOR_MERCHANT_NO=300000064613
CHANNEL_AGGREGATOR_SHA256_KEY=uck6lo8sdjaarqf3sohdoovdvvn0kdnk
CHANNEL_AGGREGATOR_ENDPOINT=https://api.channelaggregator.comThe system supports the following channels:
| Channel | Type | Description |
|---|---|---|
instapay |
Bank Transfer | InstaPay bank transfers |
gcash |
Mobile Wallet | GCash mobile payments |
maya |
Digital Bank | Maya digital banking |
pesonet |
Bank Transfer | PesoNet bank transfers |
korean-bank |
Bank Transfer | Korean bank transfers |
other |
Generic | Other payment channels |
// Frontend call
const result = await callDispatcher('processChannelAggregatorTransfer', {
amount: 1000,
currency: 'PHP',
referenceId: 'TXN123456',
description: 'Payment for services',
channel: 'instapay',
recipientInfo: {
accountNumber: '1234567890',
accountName: 'John Doe',
bankCode: 'BDO'
}
});const status = await callDispatcher('checkChannelAggregatorStatus', {
transactionId: 'TXN123456'
});const channels = await callDispatcher('getChannelAggregatorChannels', {});// These now use the channel aggregator internally
const instapayResult = await callDispatcher('processInstaPayTransfer', {
amount: 1000,
currency: 'PHP',
referenceId: 'TXN123456',
description: 'InstaPay transfer',
recipientInfo: {
accountNumber: '1234567890',
accountName: 'John Doe',
bankCode: 'BDO'
}
});- SHA256 HMAC signatures for all API calls
- Timestamp validation
- Request payload integrity verification
- Firebase Auth integration
- Role-based access control
- Rate limiting on all endpoints
- All transactions logged
- Webhook signature verification
- Comprehensive error tracking
- Real-time transaction status tracking
- Success/failure rate monitoring
- Performance metrics collection
- Graceful error responses
- Detailed error logging
- Automatic retry mechanisms
- Complete transaction history
- User action logging
- System event tracking
The system is ready to receive webhooks from your channel aggregator service:
/handleInstaPayWebhook- InstaPay callbacks/handleGCashWebhook- GCash callbacks/handleMayaWebhook- Maya callbacks/handleKoreanBankWebhook- Korean bank callbacks
- Signature verification for all webhooks
- Timestamp validation
- Duplicate request prevention
firebase functions:config:set channel_aggregator.merchant_name="CPAY"
firebase functions:config:set channel_aggregator.merchant_no="300000064613"
firebase functions:config:set channel_aggregator.sha256_key="uck6lo8sdjaarqf3sohdoovdvvn0kdnk"
firebase functions:config:set channel_aggregator.endpoint="https://api.channelaggregator.com"firebase deploy --only functions# Test channel aggregator transfer
curl -X POST https://your-region-your-project.cloudfunctions.net/cpayDispatcher \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_FIREBASE_TOKEN" \
-d '{
"action": "processChannelAggregatorTransfer",
"payload": {
"amount": 100,
"currency": "PHP",
"referenceId": "TEST123",
"description": "Test transfer",
"channel": "instapay",
"recipientInfo": {
"accountNumber": "1234567890",
"accountName": "Test User",
"bankCode": "BDO"
}
}
}'- Single API key for all channels
- Consistent interface across all payment methods
- Simplified maintenance and updates
- SHA256 signature verification
- Comprehensive audit logging
- Role-based access control
- Easy addition of new channels
- High-performance transaction processing
- Robust error handling
- Real-time transaction tracking
- Comprehensive logging
- Performance metrics
- Deploy to Production: Use the provided test credentials
- Test All Channels: Verify each payment channel works correctly
- Monitor Performance: Watch logs and metrics
- Configure Webhooks: Set up webhook endpoints for real-time updates
- Go Live: Switch to production credentials when ready
For any issues or questions regarding the channel aggregator integration:
- Check the Firebase Functions logs
- Review the audit trail for transaction details
- Verify environment variable configuration
- Test with the provided test credentials
π Channel Aggregator Integration Complete!
The CPay system is now fully integrated with your channel aggregator service and ready to process payments through all available channels using your unified API.