Hi,
Currently I want to integrate with Kakao pay. Because I have a Korean client who wants to develop an application that can integrate with Kakao Pay.
Can you tell me how to get Kakao Pay developer documentation? Are there any requirements or restrictions?
I’m not a Korean, I’m a foreigner.
Thanks & regards
I gave you php code as an example.
Check API Docs: https://developers.kakaopay.com/docs/payment/online/common
<?php
// KakaoPay API key
$KAKAO_API_KEY = 'YOUR_KAKAO_API_KEY';
$KAKAO_API_SECRET = 'YOUR_KAKAO_API_SECRET';
function initiate_kakao_pay($order_id, $total_amount) {
global $KAKAO_API_KEY, $KAKAO_API_SECRET;
$url = 'https://kapi.kakao.com/v1/payment/ready';
$headers = array(
'Authorization: KakaoAK ' . $KAKAO_API_KEY,
'Content-Type: application/x-www-form-urlencoded;charset=utf-8'
);
$data = array(
'cid' => 'TC0ONETIME',
'partner_order_id' => $order_id,
'partner_user_id' => 'userid_12345',
'item_name' => 'Test Item',
'quantity' => 1,
'total_amount' => $total_amount,
'tax_free_amount' => 0,
'approval_url' => 'https://your-website.com/kakao/approve',
'cancel_url' => 'https://your-website.com/kakao/cancel',
'fail_url' => 'https://your-website.com/kakao/fail'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
HTML ve JavaScript (frontend):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kakaopay testing</title>
</head>
<body>
<h1>Ürün Satın Al</h1>
<p>Toplam Tutar: 50.00 TL</p>
<button id="kakao-pay-button">
<img src="https://developers.kakao.com/assets/img/about/logos/kakaopaywithtext/white_large.png" alt="KakaoPay ile Öde">
</button>
<script>
document.getElementById('kakao-pay-button').addEventListener('click', () => {
initiate_kakao_pay('order-123', 50.00);
});
function initiate_kakao_pay(orderId, totalAmount) {
// PHP backend'deki initiate_kakao_pay() işlevini çağır
fetch('/kakao-pay', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ orderId, totalAmount })
})
.then(response => response.json())
.then(data => {
// KakaoPay ödeme sayfasını açmak için gereken adımları yap
console.log(data);
})
.catch(error => {
console.error('KakaoPay payment hatası:', error);
});
}
</script>
</body>
</html>
tambot
11월 14, 2024, 11:04오후
3
안녕하세요. @Duc_Nguyen5918
카카오페이 API 관련 문의 게시판이 카카오페이 디벨로퍼스 포럼으로 이전되었음을 안내드립니다.
카카오페이 API와 관련된 모든 문의나 논의 사항은 카카오페이 디벨로퍼스 포럼을 방문하셔서 문의해 주시기를 부탁드립니다.
Hello.
I would like to inform you that the inquiry board related to the Kakao Pay API has been transferred to the Kakao Pay Developers Forum.
For all inquiries or discussions related to the Kakao Pay API, please visit the Kakao Pay Developers Forum and contact us.
카카오페이 디벨로퍼스 포럼
1개의 좋아요