KBank Integration
This guide explains how to integrate with KBank payment services using the Villa Payment API.
Overview
The Villa Payment API provides integration with KBank's payment services, allowing you to process payments through KBank's infrastructure. Our integration is built on top of KBank's official APIs, providing a simplified interface while maintaining compatibility with KBank's payment ecosystem.
KBank API Integration
Our integration supports the following KBank API features:
Payment Methods
- Credit/Debit Card (3D Secure)
- PromptPay QR
- Internet Banking (KBank)
- Mobile Banking (KBank)
Transaction Types
- One-time payments
- Recurring payments
- Refunds
- Payment status checks
Security Features
- 3D Secure authentication
- Tokenization
- IP whitelisting
- Webhook notifications
Integration Flow
-
User Registration
- Create a KBank user account
- Link user to your system
- Store user preferences
-
Order Creation
- Create payment order
- Specify payment method
- Set order details
-
Payment Processing
- Handle payment flow
- Process 3D Secure if required
- Receive payment confirmation
-
Post-Payment
- Handle callbacks
- Process refunds if needed
- Update order status
Environment Variables
The following KBank-specific variables are used in our integration:
| Variable | Description | Example |
|---|---|---|
| KBANK_MERCHANT_ID | KBank merchant identifier | 1234567890 |
| KBANK_TERMINAL_ID | KBank terminal identifier | TERM123456 |
| KBANK_API_KEY | KBank API key | kbank_api_key_xxx |
| KBANK_API_SECRET | KBank API secret | kbank_api_secret_xxx |
| KBANK_ENVIRONMENT | KBank environment (sandbox/production) | sandbox |
Best Practices
- Always use HTTPS for API requests
- Implement proper error handling
- Store sensitive data securely
- Implement webhook notifications
- Handle payment timeouts
- Implement idempotency for retries
Testing
For testing KBank integration:
- Use KBank's sandbox environment
- Test with KBank's test cards
- Verify all payment methods
- Test error scenarios
- Validate webhook handling
Support
For detailed information about KBank's APIs, refer to the KBank API Portal.
If you have any questions or need assistance with our integration, please contact our support team.