Software Development Kit
Take a look at the things you can do with our APIs
Software Development Kit

We offer a software development kit that makes it easier for you to integrate with MasterCard's APIs. At this time, SDK support is available for Payments, Locations, and Offers.  These SDKs facilitate all resources supported by our APIs.  The SDK takes care of most of the complicated details of OAuth authentication, eases implementation, and manages the mapping and conversion from XML data into objects.

At this time, we offer a Java SDK.  We are working to provide support for other languages.  Your feedback on languages and functionality you need the most is helpful and important to us, and we encourage you to mention this in our forums.

Java

The Java SDK allows Java developers to integrate with OpenAPI. All REST calls are wrapped into simple methods. For example, to make a purchase, this is all that is needed:

PaymentClient client = new PaymentClient(getPrivateKey(), "my-client-id", false);
PurchaseRequest purchaseRequest = new PurchaseRequest();

final Amount amount = new Amount();
amount.setCurrency("GBP");
amount.setValue(new BigInteger("441250"));
purchaseRequest.setAmount(amount);

MerchantIdentity merchantIdentity = new MerchantIdentity();
merchantIdentity.setClientId("my-merchant-id");
merchantIdentity.setPassword("my-merchant-password");

purchaseRequest.setMerchantIdentity(merchantIdentity);
purchaseRequest.setClientReference(getClientReference());

Card card = new Card();
card.setAccountNumber("6XXXXXXXXXXXXXXX");
card.setExpiryMonth("01");
card.setExpiryYear("11");
card.setSecurityCode("111");

purchaseRequest.setFundingCard(card);

Purchase purchase = client.createPurchase(purchaseRequest);



You are required to provide a private key when constructing clients.  How you manage and protect your private key is up to you.  If your private key is stored in a pem file, you may utilize the sample code for "getPrivateKey()" found on the Java OAuth Sample Code page.

To communicate via SSL the SDK uses a trustlib as required by Java.  This trustlib is found in the root of the jar as mcapi-trustlib.jks.  This trustlib is configured by a properties file, also in the root of the jar as truststore.properties.  This trustlib uses contains the public SSL certificates for https://api.mastercard.com and https://sandbox.api.mastercard.com.  These certificates expire on 9/15/2014 and will be replaced sometime before that, at which time the SDK will stop functioning.  You can create your own truststore with the new certificate and replace the existing one, and change the properties file as needed.

Need an account?

Get started by registering an account on MasterCard Developer Zone.

Register

Need help getting started?

After registering, the next thing you need to do is register an Application using the "Add An App" button on your dashboard.

Go To My Dashboard

Get an SDK

Download a software development kit to make integration with MasterCard easy.

Get an SDK


© 1994-2014. MasterCard. All rights reserved.