This Reference Application is a guide for using MasterCard Loyalty Connect API's.
Reference Application requires:
- Java 1.7+
- Maven/Gradle
1. Download the latest swagger file in YAML format from here
Go to the link here to read up on how to generate the client library with the openapi-generator.
We are using this command that generate the mastercard_loyalty_connect_client folder.
openapi-generator generate -g java --library okhttp-gson -i Loyalty_Connect.yaml -c mastercard-loyalty-connect-config.json -o mastercard_loyalty_connect_client
We have included the swagger file and mastercard-loyalty-connect-client folder that are embedded in the app
Go to the mastercard-loyalty-connect-client
and run mvn clean package
In the mastercard-loyalty-connect-client
, go to /target
and copy mastercard-loyalty-connect-client-<version number>.jar
to the lib folder
of this reference application.
- Go to https://developer.mastercard.com/
- Create a new project
- Add "MasterCard Loyalty Connect" to your project
- Download and save your keystore and client id
- Go to src/main/resources and add your keystore p12 file that obtained from step 5
- (IMPORTANT) Rename your keystore p12 certificate in
src/main/resources
tomastercard-loyalty-connect-sandbox.p12
. - Replace your values for
CONSUMER_KEY
,KEY_ALIAS
,KEYSTORE_PASSWORD
,X_MERCHANT_KEY
,PARTNER_CODE
in config/MlcConfig.java
- Update the pom.xml to ensure the target main class is correct:
<argument>com.mastercard.lts.rewards.MastercardLoyaltyConnectReference</argument>
- Go to
project root directory
and runmvn clean compile exec:exec -Dexec.executable=java -Dexec.classpathScope=compile
This reference app describes one end to end flow for using MasterCard Loyalty Connect API's it skips some endpoints :
- Enroll Member and obtain memberReferenceId and memberMerchantReferenceId
- Get Member using memberReferenceId
- Search member using userId
- Enroll Payment Card using memberReferenceId and obtain paymentCardReferenceId
- Get Payment Card using memberReferenceId and paymentCardReferenceId
- Enroll Loyalty_Connect using memberReferenceId and obtain loyaltyConnectReferenceId
- Get Loyalty Connect using memberReferenceId and loyaltyConnectReferenceId
- Enroll another Merchant Loyalty Program using memberReferenceId and obtain memberMerchantReferenceId
- Get Merchant LoyaltyProgram using memberReferenceId and memberMerchantReferenceId
- Get all Merchant Loyalty Program associated using memberReferenceId
- Update Merchant loyalty Program using memberReferenceId and memberMerchantReferenceId
- Get Member to fetch all details like it's associated Payment Card's, Merchant Loyalty Programs and Loyalty Connect
- Update Member details using memberReferenceId
- Get Member to verify updated member details using memberReferenceId
- Delete Loyalty Connect using memberReferenceId and loyaltyConnectReferenceId
- Delete Payment Card using memberReferenceId and paymentCardReferenceId
- Get Member to verify Loyalty Connect and Payment Card got deleted or not
- Finally, delete Member to delete member using memberReferenceId
- Enroll business partner stores
Expected response from MasterCard Loyalty Connect API:
{
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
memberReferenceId: DUDeHlh48NOH1067649
}
Expected response from MasterCard Loyalty Connect API:
{
addressLine1: AddressLine 3
addressLine2: Rosemary garden
addressLine3: AddressLine 3
cityName: Nottingham
countryCode: UK
emailAddress: [email protected]
firstName: James
lastName: Anderson
loyaltyConnectResponses: []
memberReferenceId: DUDeHlh48NOH1067649
merchantLoyaltyDetails: [ {
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}]
mobilePhoneNumber: +44 (0) 7970 225 256
paymentCards: []
postalCode: UK 2345
stateProvinceCode: NT
title: Mr
}
Expected response from MasterCard Loyalty Connect API:
{
addressLine1: AddressLine 3
addressLine2: Rosemary garden
addressLine3: AddressLine 3
cityName: Nottingham
countryCode: UK
emailAddress: [email protected]
firstName: James
lastName: Anderson
loyaltyConnectResponses: []
memberReferenceId: DUDeHlh48NOH1067649
merchantLoyaltyDetails: [ {
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}]
mobilePhoneNumber: +44 (0) 7970 225 256
paymentCards: []
postalCode: UK 2345
stateProvinceCode: NT
title: Mr
}
Expected response from MasterCard Loyalty Connect API:
{
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}
Expected response from MasterCard Loyalty Connect API:
{
bankCardNumber: XXXXXXXXXXXX0010
bankCardProduct: BLACK
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}
Expected response from MasterCard Loyalty Connect API:
{
loyaltyConnectReferenceId: 45efc565-8fcb-4f62-960e-769cdc46e453
}
Expected response from MasterCard Loyalty Connect API:
{
bankCardNumber: XXXXXXXXXXXX0010
loyaltyConnectReferenceId: 45efc565-8fcb-4f62-960e-769cdc46e453
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}
Expected response from MasterCard Loyalty Connect API:
{
loyaltyId: [email protected]
memberMerchantReferenceId: 272bb799-74da-47a7-a713-d91e6f5d709c
}
Expected response from MasterCard Loyalty Connect API:
{
loyaltyId: [email protected]
memberMerchantReferenceId: 272bb799-74da-47a7-a713-d91e6f5d709c
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}
Expected response from MasterCard Loyalty Connect API:
{
memberMerchantLoyaltyDetails:
[ {
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
},
{
loyaltyId: [email protected]
memberMerchantReferenceId: 272bb799-74da-47a7-a713-d91e6f5d709c
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}]
memberReferenceId: DUDeHlh48NOH1067649
}
Expected response from MasterCard Loyalty Connect API: 201
Merchant loyalty program is updated successfully
Get Member to fetch all details like it's associated Payment Card's, Merchant Loyalty Programs and Loyalty Connect
Expected response from MasterCard Loyalty Connect API:
{
addressLine1: AddressLine 3
addressLine2: null
addressLine3: null
cityName: Nottingham
countryCode: UK
emailAddress: [email protected]
firstName: James
lastName: Anderson
loyaltyConnectResponses: [ {
bankCardNumber: XXXXXXXXXXXX0010
loyaltyConnectReferenceId: 45efc565-8fcb-4f62-960e-769cdc46e453
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}]
memberReferenceId: DUDeHlh48NOH1067649
merchantLoyaltyDetails: [ {
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}, {
loyaltyId: [email protected]
memberMerchantReferenceId: 272bb799-74da-47a7-a713-d91e6f5d709c
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}]
mobilePhoneNumber: +44 (0) 7970 225 256
paymentCards: [class PaymentCardDetails {
bankCardNumber: XXXXXXXXXXXX0010
bankCardProduct: BLACK
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}]
postalCode: UK 2345
stateProvinceCode: NT
title: Mr
}
Expected response from MasterCard Loyalty Connect API: 204
Member is updated successfully
Expected response from MasterCard Loyalty Connect API:
{
addressLine1: 110 trump tower
addressLine2: Rosemary garden
addressLine3: AddressLine 3
cityName: Nottingham
countryCode: UK
emailAddress: [email protected]
firstName: James
lastName: Anderson
loyaltyConnectResponses: [ {
bankCardNumber: XXXXXXXXXXXX0010
loyaltyConnectReferenceId: 45efc565-8fcb-4f62-960e-769cdc46e453
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}]
memberReferenceId: DUDeHlh48NOH1067649
merchantLoyaltyDetails: [ {
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}, {
loyaltyId: [email protected]
memberMerchantReferenceId: 272bb799-74da-47a7-a713-d91e6f5d709c
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}]
mobilePhoneNumber: +44 (0) 7970 225 256
paymentCards: [class PaymentCardDetails {
bankCardNumber: XXXXXXXXXXXX0010
bankCardProduct: BLACK
paymentCardReferenceId: 1faed7bf-4b26-4230-b59c-54fd5eeb7985
}]
postalCode: SN 4560
stateProvinceCode: NT
title: Mr
}
Expected response from MasterCard Loyalty Connect API: 202
Loyalty Connect successfully deleted
Expected response from MasterCard Loyalty Connect API: 202
Payment card is successfully deleted
Expected response from MasterCard Loyalty Connect API:
{
addressLine1: 110 trump tower
addressLine2: Rosemary garden
addressLine3: AddressLine 3
cityName: Nottingham
countryCode: UK
emailAddress: [email protected]
firstName: James
lastName: Anderson
loyaltyConnectResponses: []
memberReferenceId: DUDeHlh48NOH1067649
merchantLoyaltyDetails: [{
loyaltyId: [email protected]
memberMerchantReferenceId: c49f2b32-efe0-4543-9e3c-669c09b12584
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}, {
loyaltyId: [email protected]
memberMerchantReferenceId: 272bb799-74da-47a7-a713-d91e6f5d709c
merchantCode: 989898
merchantName: Jmeter
pointBalance: null
}]
mobilePhoneNumber: +44 (0) 7970 225 256
paymentCards: []
postalCode: SN 4560
stateProvinceCode: NT
title: Mr
}
Expected response from MasterCard Loyalty Connect API: 202
Member is successfully deleted
Expected response from Business Partner Stores API:
{
"businessPartnerStoreId": "ahNlfnlyZWNlaXB0cy1wcm9kLXVrch0LEhBCdXNpbmVzc0xvY2F0aW9uGICAwNXo_uoKDA",
"storeReferenceId": "0b4f8b1e-04b0-455b-92a8-64588ca5e46a"
}
- Name: Mastercard
- Contact: [email protected]
Please email to [email protected] for additional support if required.
Apache 2 License