안녕하세요. 자바로 토스 페이먼츠 연동 테스트 중 문의사항이 있어 연락드렸습니다.

API이 404.
릿 , .
? .

public PaymentService() {
this.webClient = WebClient.builder()
.baseUrl("https://api.tosspayments.com")
.defaultHeader("Content-Type", "application/json")
.build();
}

public Mono<PaymentConfirmationResponseV2> confirmPayment(PaymentConfirmationRequest paymentConfirmationRequest)
throws UnsupportedEncodingException {

String authorizations = encodeSecretKey();
String idempotencyKey = UUID.randomUUID().toString();

return webClient.post()
.uri("/v1/payments/confirm")
.header(HttpHeaders.AUTHORIZATION, authorizations)
.header("Idempotency-Key", idempotencyKey)
.body(Mono.just(paymentConfirmationRequest), PaymentConfirmationRequest.class)
.retrieve()
.bodyToMono(PaymentConfirmationResponseV2.class)
.doOnNext(response -> {
System.out.println(": " + response);
})
.doOnError(error -> {
System.out.println(": " + error.getMessage());
error.printStackTrace();
});
}

private String encodeSecretKey() throws UnsupportedEncodingException {
Base64.Encoder encoder = Base64.getEncoder();
return "Basic " + Base64.getEncoder().encodeToString((secretKey + ":").getBytes());
}



404 Not Found from POST https://api.tosspayments.com/v1/payments/confirm

. ?
Was this page helpful?