Tutorial: Developing a payment plug-in
Attention: This tutorial is currently under revision. The content might contain errors or inaccuracies. Subscribe to this page to be notified when an updated version is available.
This tutorial shows the steps involved in developing and deploying a new payment plug-in.
Learning objectives
A payment plug-in is required when WebSphere Commerce needs to integrate with a payment service provider to process electronic payments and refunds. This tutorial demonstrates how to write a payment plug-in to integrate with the Payment Service Provider Simulator, a sample application that mimics the services offered by a real payment service provider.
Time required
Expect this tutorial to take about 3 to 6 hours to complete.
Audience
This tutorial is intended for developers responsible for integrating WebSphere Commerce with payment service providers.
Prerequisites
Before beginning this tutorial ensure that you have fulfilled the following prerequisites:
- Installed WebSphere Commerce Developer
- Deployed the Payment Service Provider Simulator
Deploy the Payment Service Provider Simulator
The Payment Service Provider Simulator is a sample application used by this tutorial to mimic the processing of electronic payments and refunds by a real payment service provider. To deploy the Payment Service Provider Simulator in WebSphere Commerce Developer:
Lessons in this tutorial
- Step 1: Creating the payment plug-in EJB project
In this step, we will create the payment plug-in EJB project, which will contain the payment plug-in session bean and the payment plug-in deployment descriptor file.
- Step 2: Creating the payment plug-in session bean
In this step, we will create the payment plug-in session bean, which will contain the business logic of the payment plug-in.
- Step 3: Implementing the payment plug-in API methods
In this step, we will implement the payment plug-in API methods in the bean class of the payment plug-in session bean.
- Step 4: Creating the error message properties file
The payment plug-in API methods that is implemented in the step 3 contains references to a number of message keys. In this step, we will create the properties file that contains the corresponding error messages.
- Step 5: Creating the payment plug-in deployment descriptor file
In this step, we will create the payment plug-in deployment descriptor file which describes how the payment plug-in should be deployed. This is also where the payment plug-in configuration properties referenced by the payment plug-in API methods are specified.
- Step 6: Updating the payment system mapping file
In this step, we will define a new payment system named MyPaymentSystem in the payment system mapping file and map it to the payment plug-in.
- Step 7: Updating the payment method configuration files
In this step, we will update the CreditCardOnline payment method configuration to use the payment system defined in step 6 and update the credit card payment methods to use the CreditCardOnline payment method configuration.
- Step 8: Deploying and publishing the WebSphere Commerce EAR file
This step refers to deploying and publishing the WebSphere Commerce EAR file.
- Step 9: Specifying the merchant configuration properties
The payment plug-in API methods that are implemented in Step 3 contains references to a merchant configuration property named merchantId. In this step, we will set the value of this merchant configuration property for the ConsumerDirect store.
- Step 10: Updating the KEYS table
The generateTransactionId method that was added in step 3 uses the WebSphere Commerce Key Manager to generate the tracking numbers. In this step, we will specify how the tracking numbers are generated by updating the KEYS table.
- Step 11: Testing the payment plug-in
This section refers to testing the payment plug-in.
- Step 12: Packaging and deploying the payment plug-in from Rational Application Development to WebSphere Commerce Server
In this step, we will package the payment plug-in session bean as an EJB jar file and deploy the EJB jar file to WebSphere Commerce Server.