Tp개커
Toss payments 개발자 커뮤니티
거
Toss payments 개발자 커뮤니티
•
3y ago
•
45 replies
거니맘
안녕하세요. 자바로 토스 페이먼츠 연동 테스트 중 문의사항이 있어 연락드렸습니다.
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
에
러
가
돌
아
옵
니
다
.
혹
시
어
디
가
잘
못
되
었
을
까
요
?
Toss payments 개발자 커뮤니티
Join
Toss payments 개발자 커뮤니티입니다. 결제 연동하며 겪는 기술 문의부터, 결제 시장에 대한 다양한 정보까지 얻어가세요~
15,588
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Was this page helpful?
Yes
No
Similar Threads
Recent Announcements
Similar Threads
안녕하세요 테스트 키로 페이팔 연동 중 궁금한 사항이 있어 질문 드립니다
H
henie / ❓┃연동개발-문의
3y ago
안녕하세요, 토스페이먼츠 개발 중 문의사항이 있습니다.
(
(주)엔트리즈 / ❓┃연동개발-문의
14mo ago
안녕하세요 혹시 토스 페이먼츠, 연동 후, 잘 되다가 갑자기
오
오동현 / ❓┃연동개발-문의
2y ago
안녕하세요 가상계좌 연동 테스트 중 궁금한 부분 질문드립니다
라
라이언 / ❓┃연동개발-문의
3y ago