토스페이먼츠 v2 결제 모듈 연동

This commit is contained in:
chym1217
2025-09-16 16:34:15 +09:00
parent 1eee11e433
commit 46ea2d03b5
44 changed files with 2614 additions and 20 deletions

View File

@ -62,6 +62,9 @@ ob_start();
$comm_free_mny = 0; // 면세금액
$tot_tax_mny = 0;
// 토스페이먼츠 escrowProducts 배열 생성
$escrow_products = array();
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 합계금액 계산
@ -114,6 +117,15 @@ ob_start();
$point = $sum['point'];
$sell_price = $sum['price'];
// 토스페이먼츠 escrowProducts 배열에 상품 정보 추가
$escrow_products[] = array(
'id' => $row['ct_id'],
'name' => $row['it_name'],
'code' => $row['it_id'],
'unitPrice' => (int) $row['ct_price'],
'quantity' => (int) $row['ct_qty']
);
$cp_button = '';
// 쿠폰
@ -577,7 +589,7 @@ if($is_kakaopay_use) {
// 계좌이체 사용
if ($default['de_iche_use']) {
$multi_settle++;
echo '<li><input type="radio" id="od_settle_iche" name="od_settle_case" value="계좌이체" '.$checked.'> <label for="od_settle_iche" class="lb_icon iche_icon">'.$escrow_title.'계좌이체</label></li>'.PHP_EOL;
echo '<li><input type="radio" id="od_settle_iche" name="od_settle_case" value="계좌이체" '.$checked.'> <label for="od_settle_iche" class="lb_icon iche_icon">'.$escrow_title. ($default['de_pg_service'] == 'toss' ? '퀵계좌이체' :'계좌이체') . '</label></li>'.PHP_EOL;
$checked = '';
}
@ -1412,6 +1424,55 @@ function pay_approval()
<?php if($default['de_tax_flag_use']) { ?>
f.LGD_TAXFREEAMOUNT.value = pf.comm_free_mny.value;
<?php } ?>
<?php } else if($default['de_pg_service'] == 'toss') { ?>
var pay_method = "";
switch(settle_method) {
case "계좌이체":
pay_method = "TRANSFER";
break;
case "가상계좌":
pay_method = "VIRTUAL_ACCOUNT";
break;
case "휴대폰":
pay_method = "MOBILE_PHONE";
break;
case "신용카드":
pay_method = "CARD";
break;
case "간편결제":
pay_method = "CARD";
break;
}
f.method.value = pay_method;
f.orderId.value = '<?=$od_id?>';
f.orderName.value = '<?=$goods?>';
f.customerName.value = pf.od_name.value;
f.customerEmail.value = pf.od_email.value;
f.customerMobilePhone.value = pf.od_hp.value.replace(/[^0-9]/g, '');
if (f.customerMobilePhone.value == '') {
f.customerMobilePhone.value = pf.od_tel.value.replace(/[^0-9]/g, '');
}
f.cardUseCardPoint.value = false;
f.cardUseAppCardOnly.value = false;
<?php if($default['de_escrow_use']) { ?>
f.cardUseEscrow.value = 'true';
f.escrowProducts.value = JSON.stringify(<?php echo json_encode($escrow_products, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>);
<?php } ?>
if(settle_method == "간편결제") {
f.cardflowMode.value = 'DIRECT';
}
f.amountCurrency.value = 'KRW';
f.amountValue.value = f.good_mny.value;
<?php if($default['de_tax_flag_use']) { ?>
f.taxFreeAmount.value = pf.comm_free_mny.value;
<?php } ?>
f.windowTarget.value = 'self';
<?php } else if($default['de_pg_service'] == 'inicis') { ?>
var paymethod = "";
var width = 330;