This extension is part of the Hybris Order Management Module and offers an interface for the integration of the eShop with Payment Service Providers (PSP). It works together with an adapter written to access the PSP.
- It only supports payments with credit and debit cards.
- The payment services are stateless. The only information which is saved in the database is the transaction and the payment steps.
- Each abstract order (cart or order) may have a Transaction which has at least a TransactionEntry.
- A transaction entry represents a step in the payment.
- Payment Services are used to request authorization, capture or cancellation of the payment with a card. It defines methods for each of the operations available for debit and credit cards. They return a TransactionEntryModel which must be added to the transaction of the abstract order.
- Payment Mode Services implemented the low-level calls which are required for each mode. There is a default implementation for CardPaymentService.
- Each PSP adapter must implement the payment command interfaces and a command factory.
- Each provider has a command factory which creates the commands supported by him. This factory is configured in the spring app context.
- The available feature depend on the implementation of the adapter for a PSP.
- The Cybersource adapter -deprecated on Hybris 5.3- has the following features:
- Supports credit and debit cards
- Payment authorization
- Payment with multiple cards: No documentation about this topic was found.
- Cancel a transaction by voiding it.
- Other third-party integrations may be found in Hybris Marketplace.
- The authorization of a credit card may be done using a saved token (subscriptionID). By using this token no sensitive credit card information is saved in the eShop and it is easier to comply with the Payment Card Industry (PCI) rules. It also shortens the checkout process because the customer doesn't have to enter the details of the credit card.
- After the first authorization, the method createSubscription of the payment service must be called to create a subscription.
- At the next purchases, the subscriptionID must be given to the authorize methods.
- It supports the Address Verification Service (AVS) and Code Verification Number (CVN) status.
- The cart holds an empty transaction
- The eShop request an authorization for the total sum of the cart
- The returned transaction entry is saved in the transaction object in the cart
- The cart is converted into an order.
- The eShop request a capture of the payment
- The returned transaction entry is saved in the transaction object in the order
The transaction entry may contain a RMA - Return Merchandise Authorization which could be used to generate the return request.
Technical details of the default implementaion of the Payment Service
The DefaultPaymentServiceImpl is responsible for:
- creating a TransactionEntry
- converting the received information into a request
- send the request to the CardPaymentService
Payment Mode Services
The only out-of-the-box implementation of this type of service is DefaultCardPaymentServiceImpl. This class is responsible for:
- Looking in the CommandFactoryRegistry for a command factory for the given card if the payment provider is empty. This is the case of an authorization request.
- Asking the command factory of the payment provider to create a command to handle the request.
- Sending the request to the command.
If you want to use another payment provider to process payments with credit and debit card, a new implementation of the command factory must be developed.
It usually calls a web service of the PSP or the ERP system of the company. For paying with credit and debit cards, the following commands are available:
- AuthorizationCommand: Reserves an amount of money in the credit card
- CaptureCommand: Confirms the order and transfers the money to the merchant. The payment cannot be cancelled any more.
- PartialCaptureCommand: Confirms a partial payment and transfers the money to the merchant.
- VoidCommand: Cancels an authorization of a credit request.
- FollowOnRefundCommand: Makes a refund associated with an order or a previous transaction.
- StandaloneRefundCommand: Makes a refund not associated with an order or previous transaction.
- IsApplicableCommand: Returns if the given card is supported.
All commands return a subclass of abstract result.
Explanation of the data model and the interaction between the classes https://wiki.hybris.com/display/release5/payment+Extension+-+Technical+Guide
How to integrate a PSP: https://wiki.hybris.com/display/release5/Payment+Integration+Overview
Payment with multiple cards
The section "Multiple Credit Card Payments" of the documentation is unclear and it doesn't explain how the payment with multiple cards works. You can read it at https://wiki.hybris.com/display/release5/Payment+Business+Layer+Framework
Other Payment Service Providers
In Hybris-Extend there are extensions which integrate other PSPs, for example, PayPal.
The extension cispayment is the default implementation of a Commerce Infrastructure Services (CIS) connection to a Payment Service Provider. Unfortunately I still don't have any experience using it.
Based on Hybris 5.3