Integrations

Integrations

Open in ChatGPT
Ask ChatGPT about this page
Open in Claude
Ask Claude about this page

Payment Gateway Management

The Payment Gateway doctype serves as the central registry for all payment gateway configurations, maintaining flexible links to gateway-specific settings.

Payment Gateway Doctype

Field Type Purpose
gateway Data Unique gateway identifier (e.g., "Stripe", "Razorpay")
gateway_settings Link (DocType) Link to gateway settings doctype (e.g., "Stripe Settings")
gateway_controller Dynamic Link Link to specific gateway settings record

Technical Implementation:

  • Auto-naming based on gateway field for unique identification
  • Dynamic link pattern allows multiple instances of same gateway type
  • Supports both single-instance and multi-instance gateway configurations
  • Gateway creation automated through create_payment_gateway() utility

Gateway Controller Pattern

All gateway settings doctypes follow a standardized controller interface:

class GatewaySettings(Document):
    supported_currencies = ("USD", "EUR", "GBP", ...)
    
    def validate_transaction_currency(self, currency):
        """Validate if gateway supports the transaction currency."""
        
    def get_payment_url(self, **kwargs):
        """Generate payment URL for checkout redirection."""
        
    def create_request(self, data):
        """Process payment request and return response."""

Required Methods:

  • validate_transaction_currency(currency): Currency validation
  • get_payment_url(**kwargs): Checkout URL generation
  • create_request(data): Payment processing (optional for redirect-based flows)
Last updated 2 months ago
Was this helpful?
Thanks!