2

https://developer.mastercard.com/page/java-sdk-guide#project-setup

我指的是这个文档,但不明白如何调用 API 和配置 SDK。

更新 2:

用于支付网关的依赖项

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

开始使用简单主类中的以下代码。

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");

参考:github链接

一切正常,但 API 响应全部为空。所以我们可以确定有什么地方出错了,而且我们得到了成功响应并且没有错误日志。

4

0 回答 0