MasterPass Environment Setup
Prerequisites
- Please familiarize yourself with the MasterPass - Merchant Checkout Documentation. https://developer.mastercard.com/portal/display/api/MasterPass+-+Merchant+Checkout+-+Documentation You will need to follow the steps on their site to obtain developer sandbox API and production keys.
Once you have established an account with MasterPass, begin by including the MasterPass Module dependency to your main pom.xml.
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-masterpass</artifactId>
<version>add version here</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Make sure to include the dependency in your core
pom.xml as well:
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-masterpass</artifactId>
<type>jar</type>
</dependency>
You should now begin to setup your environment to work with Broadleaf Commerce MasterPass support.
The first step is to make Broadleaf Commerce aware of your MasterPass account credentials.
This is accomplished through environment configuration (see [[Runtime Environment Configuration]]).
Broadleaf allows you to create your own property files per environment (e.g. common.properties, local.properties, development.properties, integrationdev.properties, integrationqa.properties, staging.properties, and production.properties)
You will need to enter the following key/value pairs in the appropriate locations and replace the "?" with your MasterPass api account details:
You can also store these configs in the Database by utilizing the blSystemPropertiesService
. See the java docs for more details.
Properties File Config
# Masterpass Configuration
wallet.masterpass.sandBox=? (true/false)
wallet.masterpass.checkoutIdentifier=? (provided during merchant enrollment)
wallet.masterpass.acceptedCards=? (e.g. master,amex,discover,visa)
wallet.masterpass.shippingLocationProfile=? (e.g. US)
wallet.masterpass.shippingSuppression=? (true/false)
wallet.masterpass.callbackDomain=https://localhost:8443
wallet.masterpass.callbackPath=/masterpass/callback
Note - This module comes pre-configured with a Spring MVC controller with URL endpoints to handle the masterpass callback:
Enable these with your component scan if you would like to use these in your implementation.
/masterpass/callback
Note - If you followed the MasterPass guide, you should have created a PEM encoded Certificate Request File. This file needs
to reside on your file system and the path needs to be configured by thewallet.masterpass.keyStorePath
property. For example,
if you placed your .p12 file insite/src/main/resources/MCOpenAPI.p12
, the keyStorePath would beMCOpenAPI.p12
Note - MasterPass is intended to work with any Payment Gateway. In order for ths module to communicate appropriately
with another Broadleaf Payment Module, you will need to tell MasterPass which gateway you are using. You can set
gateway.config.global.gatewayType
property to the PaymentGatewayType.getType() of the appropriate module.
MasterPass also requires you to send back theApprovalCode: 6-digit approval code returned by payment API
.
This is usually the Authorization Code sent back from the Gateway. Each Broadleaf implemented gateway will set this
Authorization Code as an entry in the additional fields Map on the PaymentTransaction.
Thegateway.config.global.approvalCode
parameter will tell MasterPass the key parameter for this Map to pull back the Authorization Code
for the configured gateway.Note - MasterPass will send back the Credit Card expiration Date in a particular format. This format may or may not be
compatible with the payment gateway configured. You can override the default format of "MM/YY" by setting the property
gateway.config.global.expDateFormat
Note - MasterPass is intended to be a Digital Wallet that can accommodate several types of international cards and billing addresses.
In order to fully support the billing/shipping address conversion you can load the ISO 3166-1 provided in our reference Heat Clinic
implementation. Add this line to your development.properties file:/sql/load_i18n_countries.sql,\
Sample Broadleaf Payment Module Configurations
If you are using one of Broadleaf's Payment Modules, you can set these properties for MasterPass:
Authorize.net
- gateway.config.global.gatewayType=Authorize_Net
- gateway.config.global.approvalCode=x_auth_code
Braintree
- gateway.config.global.gatewayType=Braintree
- gateway.config.global.approvalCode=processorAuthorizationCode
Cybersource Payments
- gateway.config.global.gatewayType=Cybersource_Payment
- gateway.config.global.approvalCode=authorizationCode
PayPal PayFlow Pro
- gateway.config.global.gatewayType=PayPal_PayFlow_Pro
- gateway.config.global.approvalCode=AUTHCODE