Skip to main content

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

  1. User Registration

    • Create a KBank user account
    • Link user to your system
    • Store user preferences
  2. Order Creation

    • Create payment order
    • Specify payment method
    • Set order details
  3. Payment Processing

    • Handle payment flow
    • Process 3D Secure if required
    • Receive payment confirmation
  4. Post-Payment

    • Handle callbacks
    • Process refunds if needed
    • Update order status

Environment Variables

The following KBank-specific variables are used in our integration:

VariableDescriptionExample
KBANK_MERCHANT_IDKBank merchant identifier1234567890
KBANK_TERMINAL_IDKBank terminal identifierTERM123456
KBANK_API_KEYKBank API keykbank_api_key_xxx
KBANK_API_SECRETKBank API secretkbank_api_secret_xxx
KBANK_ENVIRONMENTKBank environment (sandbox/production)sandbox

Best Practices

  1. Always use HTTPS for API requests
  2. Implement proper error handling
  3. Store sensitive data securely
  4. Implement webhook notifications
  5. Handle payment timeouts
  6. Implement idempotency for retries

Testing

For testing KBank integration:

  1. Use KBank's sandbox environment
  2. Test with KBank's test cards
  3. Verify all payment methods
  4. Test error scenarios
  5. 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.