Home
Softono

Mastercard Mpgs Sdk

Open source Apache-2.0 Java
15
Stars
14
Forks
0
Issues
2
Watchers
8 years
Last Commit

 About Mastercard Mpgs Sdk

SDK for Mastercard Payment Gateway Service - make MPGS requests easy

Platforms

Web Self-hosted

Languages

Java

Links

Need Help Installing Mastercard Mpgs Sdk?

We provide expert installation service for this software. Our team will install, configure, and secure Mastercard Mpgs Sdk on your server. plans start at just $30.

Mastercard Mpgs Sdk

View on GitHub

mastercard-mpgs-sdk

make MPGS requests easy

Installation

Maven

<dependency>
    <groupId>com.github.marcoblos</groupId>
    <artifactId>mastercard-mpgs-sdk</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

Getting started

PAY METHOD

MastercardProperties properties = new MastercardProperties();
properties.setBaseUrl("https://eu-gateway.mastercard.com/api/rest/version/");
properties.setApiVersion("45");
properties.setMerchantId("TEST...");
properties.setApiKey("xxxxxxxxxxxxxxxxxx");

MastercardRestTemplate restTemplate = new MastercardRestTemplate(properties.getMerchantId(), properties.getApiKey());

// normally you get this informations from your user and your system (amount,
// credit card data, etc.) this isnecessary data to build the MPGS request
MastercardRequestDTO dto = MastercardRequestDTO.builder()
    .apiOperation(MastercardAPIOperationType.PAY)
    .amount(new BigDecimal("10000.00"))
    .cardNumber("cccccccccccccccc")
    ...
    .build();

MastercardRequestResponseDTO requestResponseDTO = MastercardObjectRequestFactory.build(dto);

MastercardResponse response = MastercardBaseRequest.execute(restTemplate, properties, requestResponseDTO, "myOrderId323214343");
// PS: the value "myOrderId323214343" is generated by you and you need tu used
// it to identify the orders in the Mastercard MPGS Panel

REFUND METHOD

...
...

MastercardRequestDTO dto = MastercardRequestDTO.builder()
    .apiOperation(MastercardAPIOperationType.REFUND)
    .amount(new BigDecimal("5000.00"))
    .currency("EUR")
    .build();

MastercardRequestResponseDTO requestResponseDTO = MastercardObjectRequestFactory.build(dto);

MastercardResponse response = MastercardBaseRequest.execute(restTemplate, properties, requestResponseDTO, "myOrderId323214343");
// PS: the value "myOrderId323214343" it is the same that you previously used in the pay method and that you wish to refund now

Development setup

mvn clean install

Meta

Marco Blos – [email protected]

Distributed under the Apache 2.0 license. See LICENSE for more information.

https://github.com/marcoblos/mastercard-mpgs-sdk

Contributing

  1. Fork it (https://github.com/marcoblos/mastercard-mpgs-sdk/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request