Skip to content
ryandao edited this page Jul 13, 2012 · 1 revision

This is a guide for writing new payment connectors. For the sake of example, the gateway we are connecting to will be called “Payment Method”. You should use the name of the actual gateway in place of this, eg Google Checkout, Paypal, Authorize.net etc.

# Naming files and classes

ss/payment_paymentmethod/PaymentMethod.php:

* PaymentMethodGateway - required gateway class for performing the interaction with a gateway server.
* PaymentMethod - optional datamodel class, otherwise Payment will be used.
* PaymentMethodProcessor - optional controller class that handles incoming requests, and form field setup.

## Testing, mock, and production classes

* PaymentMethodGateway_Dev - connecting to the gateway-provided test servers.
* PaymentMethodGateway_Mock - mimics gateway calls and responses. Good for unit tests, or offline testing.
* PaymentMethodGateway_Production - optional live gateway class. Depending on your preference, you could instead PaymentMethod_Gateway.

### Configuration:

* For PaymentFactory: Each gateway must have a yaml config that registers the gateway. The config format is:
  PaymentFactory:
    PaymentMethod:
      title: #The payment method title shown to the user
      controller: #The processor class used by this gateway
      gateway_classes: #Optional: The custom gateway classes if the gateway doesn't follow naming convention
        live:
        dev: 
        test:
      model: #Optional: The custom model class if the gateway doesn't follow naming convention

Clone this wiki locally