Creating a PaymentGateway Interface

The PaymentGateway interface contains several basic transaction methods that the PaymentGatewayAPI class implements to handle gateway requests. The methods allow PaymentGatewayAPI to create a credit card token, process a payment charge, void a payment, authorize a payment, and refund a payment.

Map<String, TransactionResult> generateToken(Map<String, TransactionParameter> mapOfTransactionParameterById,PaymentGatewayParameter paymentGatewayParameter);

Map<String, TransactionResult> chargeTransaction(Map<String, TransactionParameter> mapOfTransactionParameterById,PaymentGatewayParameter paymentGatewayParameter);

Map<String, TransactionResult> voidTransaction(Map<String, TransactionParameter> mapOfTransactionParameterById,PaymentGatewayParameter paymentGatewayParameter);

Map<String, TransactionResult> authorizeTransaction(Map<String, TransactionParameter> mapOfTransactionParameterById,PaymentGatewayParameter paymentGatewayParameter);

Map<String, TransactionResult> refundTransaction(Map<String, TransactionParameter> mapOfTransactionParameterById,PaymentGatewayParameter paymentGatewayParameter);

So, if you want your gateway package to process a chargeTransaction sent from Salesforce Billing, the package must implement chargeTransaction within a PaymentGatewayAPI class. Let’s see how this configuration looks in a sample CyberSource implementation.