php에서 결제연동 테스트를 진행하려고 합니다.


[caught Error: selector는 element. selector . (selector: #payment-method)]


.

<?php
$clientKey = "testck";
$customerKey = "testsk
";
?>
<head>
<title></title>
<script src="https://js.tosspayments.com/v1/payment-widget"></script>
</head>
<body>
<script>
const clientKey = '<?php echo $clientKey?>';
const customerKey = '<?php echo $customerKey?>';
var paymentWidget = PaymentWidget(clientKey, customerKey); //
paymentWidget = PaymentWidget(clientKey, PaymentWidget.ANONYMOUS); //

paymentWidget.renderPaymentMethods('#payment-method', 15000);

paymentWidget.requestPayment({
orderId: 'AD8aZDpbzXs4EQa-UkIX6',
orderName: '외 2',
successUrl: 'http://localhost:8080/success',
failUrl: 'http://localhost:8080/fail',
customerEmail: 'customer123@gmail.com',
customerName: ''
});
</script>

<input type="text" name="payment-method" id="payment-method" />

<button type="button" onClick="requestPayment();"></button>

</body>
</html>
Was this page helpful?