Payment Integration

For Implementation of E-commerce Website, Payment is most crucial part of website. it is required that E-Commerce Website provide the customers with an easy, trusted & safe to payment options when customer place order. If the payment method is not safe & easy for understand , the customers will not pay on website and companies cannot grow business in eCommerce. Every Business want online payment should be easy in use , safe and secure. We provide you the key concepts and terminology of online card payments and the payment integration and related complexities.

Hybris Payment Module provides an easy to use and integrated payment method. Hybris brings together leading solutions to streamline deployment and enable merchants to optimize the eCommerce customer experience, increase sales and reduce operational costs.

Hybris payment integration is usually less complicated. The payment process is available directly out of the box in Hybris Commerce. Hybris allow to integration with external Payment Service Providers (PSPs) to handle electronic payments to multi-channel online payment methods.

Hybris is support three different methods to integrate the payments.

  • Hosted Order Page (HOP)

  • Silent Order post (SOP)

  • Direct Integration

Hosted Order Page

A hosted Order page is a payment page located outside the website that allows customers to pay for goods or services during the checkout process . This method redirects the customer upon purchase to a payment page of a third-party PSP to enter payment like card details. This option is considered the safest since PSP is always follow PCI (Payment card industry) standards . PCI standards for compliance are developed and managed by the PCI Security Standards Council. This externally hosted payment form can also be displayed in either a Lightbox modal dialog or an embedded iFrame.

Silent Order Post

SOP is offers filling out a checkout form directly on your site, but instead of sending sensitive data via API ,the system sends it directly to the payment gateway. when your customer submits the payment form, it posts the sensitive data directed to the credit card processors servers over HTTPS. Instead of dealing with API calls, the system can send the form directly to the payment gateway

Direct Integration

This method transfers the client when paying to the checkout page inside the site, and sends the data to the PSP by using the API. the merchant assumes the security of the sensitive data of the client, for which you need to be certified PCI standard .

Payment Extension

The payment extension is foundation for the payment framework in Hybris. It defines base interfaces and design for interrogation to an external payment provider. you can create PSP adapters to integrate external Payment systems into the Hybris. Hybris is designed to support only debit or credit cards. Its architectural model is simple. payment service sends a signal to the card service, which calls various commands from interface. Commands define for integration with external Payment Provider.

  • authorization

  • capture

  • partial capture

  • void

  • standalone refund

  • follow on the refund

SAP Hybris Payment Module Architecture

The base class for each of these commands is the Command class.

package de.hybris.platform.payment.commands;

public interface Command<R, O> {

O perform(R var1);

}

AuthorizationCommand

Authorization is the first step in the card payment process. The authorized means "locked money" on the card account until it is captured and authorization is reversed or has expired. AuthorizationCommand interface need to implement for lock money

public interface AuthorizationCommand extends Command<RequestAuthorizationData, ResponseAuthorizationData> {


}

CaptureCommand

After authorization complete, The normal way is to Capture payment. Actual payment is received to business when capture is complete. CaptureCommand interface need to implement for capture money

public interface CaptureCommand extends Command<RequestCaptureData, ResponseCaptureData> {

}

PartialCapture

public interface PartialCaptureCommand extends Command<PartialCaptureRequest, CaptureResult> {

}

voidCommand

public interface VoidCommand extends Command<VoidRequest, VoidResult> {

}

StandaloneRefundCommand

public interface StandaloneRefundCommand<T extends AbstractRequest> extends Command<T, RefundResult> {

RefundResult perform(T var1);

}

FollowOnRefundCommand

public interface FollowOnRefundCommand<T extends AbstractRequest> extends Command<T, RefundResult>

{

RefundResult perform(T request);

}

After Implementation Classes, Now we required spring configuration

Spring Configuration

We will define a command factory bean as per payment provider. Hybris is provide mock spring file configuration. We will follow same configuration and add our PSP implementation bean classes and PSP value. It is follow Command factory pattern.

We need to define similar configuration in our custom extension and payment provider value as used PSP name like CyberSouce ,Adyen etc and below bold configuration will be update actual Command class as per PSP.

Sample File : mock-payment-spring.xml

<!-- Payment mockup implementation -->

<bean name="mockupCommandFactory" class="de.hybris.platform.payment.commands.factory.impl.DefaultCommandFactoryImpl" >

<property name="paymentProvider" value="Mockup"/>

<property name="commands">

<map>

<entry>

<key><value type="java.lang.Class">de.hybris.platform.payment.commands.IsApplicableCommand</value></key>

<bean class="de.hybris.platform.payment.commands.impl.IsApplicableMockCommand" />

</entry>

<entry>

<key><value type="java.lang.Class">de.hybris.platform.payment.commands.AuthorizationCommand</value></key>

<bean class="de.hybris.platform.payment.commands.impl.AuthorizationMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.SubscriptionAuthorizationCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.SubscriptionAuthorizationMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.CaptureCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.CaptureMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.PartialCaptureCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.PartialCaptureMockCommand" />

</entry>

<entry>

<key><value type="java.lang.Class">de.hybris.platform.payment.commands.EnrollmentCheckCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.EnrollmentCheckMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.VoidCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.VoidMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.FollowOnRefundCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.FollowOnRefundMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.StandaloneRefundCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.StandaloneRefundMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.CreateSubscriptionCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.CreateSubscriptionMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.DeleteSubscriptionCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.DeleteSubscriptionMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.GetSubscriptionDataCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.GetSubscriptionDataMockCommand" />

</entry>

<entry>

<key>

<value type="java.lang.Class">de.hybris.platform.payment.commands.UpdateSubscriptionCommand</value>

</key>

<bean class="de.hybris.platform.payment.commands.impl.UpdateSubscriptionMockCommand" />

</entry>

</map>

</property>

/bean>


<bean name="mockupCommandFactoryRegistry" class="de.hybris.platform.payment.commands.impl.CommandFactoryRegistryMockImpl" />

The payment functionality is provided by the PaymentService interface, which contains methods responsible for several operations on orders.

public interface PaymentService

{

PaymentTransactionEntryModel authorize(final String merchantTransactionCode,

final BigDecimal amount, final Currency currency, final AddressModel deliveryAddress,

final AddressModel paymentAddress, final CardInfo card) throws AdapterException;

PaymentTransactionEntryModel capture(PaymentTransactionModel transaction) throws AdapterException;

PaymentTransactionEntryModel cancel(final PaymentTransactionEntryModel transaction) throws AdapterException;

-----

//same other method define

-----

}

Authentication with Credit Card by Saved Token

As per PCI regulations, Hybris recommend that only store a subscription ID or tokenized representation on the SAP Commerce DB and allow the PSP to store the full credit card information. The CreditCardPaymentInfo has a place to save the subscriptionID when sensitive credit card details, like card number and CVV number, are saved