When exactly should we call the payment approval API?

In the KakaoPay Open-API, after I send the first POST request to the payment preparation API (https://open-api.kakaopay.com/online/v1/payment/ready), I receive the response with a number of redirect URLs. According to the docs, I should open one of these redirect URLs based on the environment, and that will load the appropriate KakaoPay payment screen.

Quoting the docs: “A payment waiting screen is displayed on the client, and users can select a payment method on the KakaoTalk payment screen. Because this process occurs on Kakao Pay’s service screen, no other requests are sent to the merchant.”

As far as I understand, if the payment succeeds, the end user will be redirected to the approval_url I have sent with the ready request; if authorization fails, the fail_url will be used, and cancel_url if the payment is cancelled by the end user.

Question: Where does the payment approval API (https://open-api.kakaopay.com/online/v1/payment/approve) come in this equation? i.e. exactly when/at which stage of the flow should I send a POST to the approval API? Once I open the redirect URL, I won’t get any further updates from Kakao Pay until the payment reaches a conclusion. And once the payment concludes, one of the three URLs I sent will be opened. So I don’t see any place where I can call the approval API and send the “pg_token” parameter, and receive the payment details.

I have already been through the sample Java application, but didn’t get an answer to my question because it shows how to call the approval API and the preparation API, not when to call them.

안녕하세요. 카카오페이입니다.

문의주신 approve api 는 결제창 마지막단계인 비밀번호 인증이 완료된 후 ready api 에서 넘겨준 approval_url로 리다이렉트되면서 pg_token값을 붙여서전환이 되게됩니다. (ex. https://kakaopay.com?pg_token=XXXXXXXX)

비밀번호 인증후 가맹점에서 넘겨준 approval_url로 전환되면서 pg_token값을 확인할수 있도록 조치 해주시기 바랍니다.

참고하실수 있게 카카오페이 데모페이지를 공유드립니다. (결제완료페이지 url 뒤에 pg_token 확인 가능)

https://payment-demo.kakaopay.com/online

감사합니다.