내 웹 앱에 카카오페이 서비스를 구현하고 싶습니다. 반복 결제를 원합니다. 문서를 찾은 후 제공된 API 중 몇 가지에 대한 설명이 필요합니다. 첫 번째 API는 컬이 있는 결제 준비 API입니다. 다음과 같이
curl --location ‘https://open-api.kakaopay.com/online/v1/payment/ready’
–header ‘Authorization: SECRET_KEY ${SECRET_KEY}’
–header ‘Content-Type: application/json’
–data ‘{
“cid”: “TCSEQUENCE”,
“partner_order_id”: “subscription_order_id_1”,
“partner_user_id”: “subscription_user_id_1”,
“item_name”: “음악정기결제”,
“quantity”: “1”,
“total_amount”: “9900”,
“vat_amount”: “900”,
“tax_free_amount”: “0”,
“approval_url”: “https://bizplan.work:8089”,
“fail_url”: “https://bizplan.work:8089”,
“cancel_url”: “https://bizplan.work:8089”
}’
여기에서 가장 먼저 필요한 것은 이러한 Partner_order_id 및 Partner_user_id를 어디에서 설정할 수 있는지, 그리고 반복 결제를 설정하기 위해 앱에서 이 항목을 어디에서 설정할 수 있는지, 테스트 목적으로 어떻게 진행하고 결과를 얻을 수 있는지 확인하는 것입니다. 결제 흐름이 제대로 작동하고 있어요.
결제 준비 API를 누른 후 받은 응답은 다음과 같습니다.
{
"tid": "T73c2473058063933610",
"tms_result": false,
"created_at": "2024-11-19T14:38:59",
"next_redirect_pc_url": "https://online-payment.kakaopay.com/mockup/bridge/pc/pg/subscription/sequential-payment-issue/cf6e6b91574c9c343b847a52a2fe132694c14f9f4100418e13e4aa48b510d58a",
"next_redirect_mobile_url": "https://online-payment.kakaopay.com/mockup/bridge/mobile-web/pg/subscription/sequential-payment-issue/cf6e6b91574c9c343b847a52a2fe132694c14f9f4100418e13e4aa48b510d58a",
"next_redirect_app_url": "https://online-payment.kakaopay.com/mockup/bridge/mobile-app/pg/subscription/sequential-payment-issue/cf6e6b91574c9c343b847a52a2fe132694c14f9f4100418e13e4aa48b510d58a",
"android_app_scheme": "kakaotalk://kakaopay/pg?url=https://online-pay.kakao.com/pay/mockup/cf6e6b91574c9c343b847a52a2fe132694c14f9f4100418e13e4aa48b510d58a",
"ios_app_scheme": "kakaotalk://kakaopay/pg?url=https://online-pay.kakao.com/pay/mockup/cf6e6b91574c9c343b847a52a2fe132694c14f9f4100418e13e4aa48b510d58a"
}
그 후 문서에 따르면 내가 공격해야 할 다음 API는 다음과 같습니다.
curl --location ‘https://open-api.kakaopay.com/online/v1/payment/approve’
–header ‘Authorization: SECRET_KEY ${SECRET_KEY}’
–header ‘Content-Type: application/json’
–data ‘{
“cid”: “TCSEQUENCE”,
“tid”: “T73b1f377f575eb05a3b”,
“partner_order_id”: “subscription_order_id_1”,
“partner_user_id”: “subscription_user_id_1”,
“pg_token”: “xxxxxxxxxxxxxxxxxxxx”
}’
이 pg_token에 대한 설명이 필요합니다. 그 후 반복 결제를 위해 이를 설정하고 애플리케이션에 연결하는 방법은 무엇입니까?