Introduction Payment Gateway
There are many ways in which users can use to conveniently order Spares and Consumables and Commerce is one of them. As companies today have many choices how they are ordering (e.g. via Commerce / Self-Service, Call Center, EDI, Email, etc.), they also expect flexibility when choosing their preferred payment methods. With credit card payments, ACH / BAN transfers, and other options such as PayPal, Apple Pay, and so forth, they are being offered a variety of different methods and can choose their preferred one.
Additional Information about 'Cybersource: Secure Acceptance'
Additional information about the payment gateway provider and the product can be found here.
Enabling Payment Gateway for Commerce
In order to use this feature, under 'Administration' -> 'SettingBoolean' -> 'Enable Payment Gateway Integration' flag must be set to True:
In the SAP Cloud Platform Cockpit, a new destination needs to be configured in Subaccount level:
The following parameters are required:
Parameter | Meaning / Description |
---|---|
Name | Name of the destination. To be used in the Commerce Administration Setup. |
Type | HTTP |
Description | optional. Can be blank. |
URL |
For test/demo purposes use the following URL: https://ubctest.cybersource.com/ebc2/ |
Proxy Type | Internet |
Authentication | NoAuthentication |
The following additional properties are required:
Property | Meaning / Description |
---|---|
active | true / false. Determines whether the application is active or not. |
cybersource.accessKey | Need to be generated. See further below. |
cybersource.algorithm | HmacSHA256 |
cybersource.profileId | Need to be generated. See further below. |
cybersource.secretKey | Need to be generated. See further below. |
cybersource.url | https://testsecureacceptance.cybersource.com/pay |
isPaymentGateway | true / false. |
Configuration / Setup of Payment Gateway
Note: access information will be provided by CS or PM.
In the Cybersource administration area, navigate to Secure Acceptance where a new profile can be created:
Under Payment Settings select respective settings:
Under Security create a new Key and note down the Secret Key (note, the popup will close within 30 seconds):
After that, note down the Access Key and the Profile ID:
These three keys / IDs need to be entered into the Payment Gateway information inside SAP Cloud Platform Cockpit (here: Enabling Payment Gateway for Commerce).
The last step is the Customer Response callbacks which can be maintained here:
As an optional step, branding can be applied here:
The branding will be applied accordingly, e.g.:
Passing Parameters from Commerce to Payment Gateway
When the user is re-directed from the Review Order screen to the payment gateway, parameters such as user / contact name, billing and shipping addresses, total amount, etc. can be passed. For this, a Groovy script 'Payment Gateway Submission Params' is made available. Sample code is available here:
import com.imc.iss.groovy.order.Order;
import com.imc.iss.groovy.GroovyCtxUtil;
import com.imc.vocabulary.Schema;
import com.imc.datamodel.BusinessObject;
def params = [:];
GroovyCtxUtil util = (GroovyCtxUtil) groovyCtxUtil;
BusinessObject orderBO = BusinessObject.create(order.getOrderURI());
BusinessObject contactBO = userInfo.getPersonBO();
// user data
params["bill_to_forename"] = util.getDataAttrStr(contactBO, Schema.personFirstName);
params["bill_to_surname"] = util.getDataAttrStr(contactBO, Schema.personLastName);
params["bill_to_email"] = util.getDataAttrStr(contactBO, Schema.personEmail);
params["ship_to_forename"] = util.getDataAttrStr(contactBO, Schema.personFirstName);
params["ship_to_surname"] = util.getDataAttrStr(contactBO, Schema.personLastName);
// billing address
BusinessObject billingAddressBO = util.getRelAttr(orderBO, Schema.orderBillTo);
if(billingAddressBO != null)
{
util.loadBO(billingAddressBO);
params["bill_to_address_line1"] = util.getDataAttrStr(billingAddressBO, Schema.addressStreet) + ' ' + util.getDataAttrStr(billingAddressBO, Schema.addressUnitNo);
params["bill_to_address_city"] = util.getDataAttrStr(billingAddressBO, Schema.addressCity);
BusinessObject billCountryBO = util.getRelAttr(billingAddressBO, Schema.hasCountry);
params["bill_to_address_country"] = util.getDataAttrStr(billCountryBO, Schema.objectExternalId);
}
// shipping address
BusinessObject shippingAddressBO = util.getRelAttr(orderBO, Schema.orderShipTo);
if(shippingAddressBO != null)
{
util.loadBO(shippingAddressBO);
params["ship_to_address_line1"] = util.getDataAttrStr(shippingAddressBO, Schema.addressStreet) + ' ' + util.getDataAttrStr(shippingAddressBO, Schema.addressUnitNo);
params["ship_to_address_city"] = util.getDataAttrStr(shippingAddressBO, Schema.addressCity);
BusinessObject shipCountryBO = util.getRelAttr(shippingAddressBO, Schema.hasCountry);
params["ship_to_address_country"] = util.getDataAttrStr(shipCountryBO, Schema.objectExternalId);
}
// TESTING
params["card_type"] = '002';
params["card_number"] = '5555555555554444';
params["card_expiry_date"] = '01-2030';
params["card_cvn"] = '123';
return params;
End-User Experience: Direct Payments
On the checkout and re-order screens, users can decide how the payments should be made (via Purchase Order or via Direct Payment) as configured in the Commerce Administration here.
On the review screen, there will be a button Make Payment which will redirect the user to the respective payment screen shown in the previous section. The payment functionality is available in the checkout process, the review process, and the re-order process (see here for additional information: Process Overview: Checkout Process and here Process Overview: Order History).
During the Checkout, the following credit card details can be used for testing purposes:
Card Type | Master Card |
Credit Card Number | 5555 5555 5555 4444 |
CVN | Any 3 digits |
Expiration Date | Any future date |