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.