This section describes how a custom payment gateway can be created.
What does this section cover?
Create a custom payment gateway
In order to create a custom payment gateway, you need to:
- Define the custom payment gateway in payment gateways metadata file.
- Create a custom process class extending com.crm.process.paymentgateway.CRMProcessPaymentGatewayBean. Note that the process class name should start with the custom project directory name.
- Set up the payment gateway through the payment gateways page.
For this example we assume that <custom_project> = Custom
1. Payment Gateways Metadata File
The new custom payment gateway must be defined in paymentgateways.xml file which is located under <custom_project>/src/main/resources/metadata/ directory.
The payment gateway definition must consist of the following:
- the protocol, which is the protocol of the payment gateway
- the name, which is the name of the payment gateway
- the processejbname, which is the name of the custom process class of the payment gateway
- the paymentmethods, which are the supported payment methods of the payment gateway
Also, in this file, you can define the following:
- useforrecurringpayments, which is a boolean value indicating whether the payment gateway can be used for recurring payments
- createpayments, which is a boolean value indicating whether payments are allowed to be created through this payment gateway
- createpaymentcancellations, which is a boolean value indicating whether payment cancellations are allowed to be created through this payment gateway
- createrefunds, which is a boolean value indicating whether refunds are allowed to be created through this payment gateway
- generalparameters, which are the payment gateway's parameters
For each generalparameter you can define the following:
- generalparameterid, which is the id of the generalparameter
- generalparametername, which is the name of the generalparameter
- generalparametertype, which is the type of the generalparameter
- generalparameterclassname, which is the classname of the generalparameter, if the generalparameter is a dataobject
- generalparameterorder, which is the order of appearance of the generalparameter on the screen
- generalparametervisibilitymode, which is the mode for which the generalparameter will be visible (TEST or LIVE)
- generalparameterhidden, which is a boolean value indicating whether the generalparameter will appear masked with asterisks
- generalparametermandatory, which is a boolean value indicating whether the generalparameter is mandatory
2. Payment Gateway Process Class
The payment gateway process class should extend com.crm.process.paymentgateway.CRMProcessPaymentGatewayBean and implement its abstract methods for creating/updating/deleting a payment gateway account and card, creating a payment and payment cancellation, and checking whether a currency is supported by the payment gateway. Implement only the methods required by your business model.
You must use @Stateless(mappedName = "ejb/CRMProcessCustomGateway") to define the mapped name of the provisioning provider EJB. The mapped name should match the one defined in paymentgateways.xml metadata file.
3. Set up the plugin payment gateway through CRM.COM
The plugin payment gateway can be set up through CRM.COM from the Provisioning Providers data entry view page, which can be found under Settings & Admin > Billing Application > Subscription & Billing Settings > Set up Provisioning Providers.
Once the provider is defined in the provisioning providers metadata file, it can be added as a plugin through the Payment Gateway Providers data entry view page. By selecting "Set Up a Payment Gateway Provider", you can add the plugin payment gateway to the list of payment gateway providers. After adding it, you will be able to set it up, manage its payment gateway requests, import and export gateway requests and execute the processes defined in the related pages of the payment gateway provider's definition (in the paymentgateways.xml file).