결제위젯 Version 2 연동 시 결제금액 설정 관련 문의

, 젯 Version 2.

는 PHP.
( 서 Client: Javascript / Server: PHP .)

결제위젯 객체(widgets)의 setAmount().

amount
.

amount를 Javascript 변수로 선언해야 하는지 .

.

<!-- TODO more HTML 태그 -->
<script src="https://js.tosspayments.com/v2/standard"></script>
<script>
  main();
  
  async function main() {
      const button = document.getElementById('payment-button');
      const coupon = document.getElementById('coupon-box');
      const clientKey = '<?php echo $ck; ?>';
      const tossPayments = TossPayments(clientKey);
      const customerKey = <?php echo !empty($member['mb_id']) ? "'" . gernerate_uuid() . "'" : "TossPayments.ANONYMOUS"; ?>;
      // TODO 브랜드페이 사용을 위한 변수 선언
      const brandpay = {
          redirectUrl: window.location.origin + '/board/payments/tosspayments/experience/brandpay_oauth.php',
      };
      // FIXME amount 선언
      const amount = <?php echo $amount; ?>;
  
      /*
       * TODO more code...
       * 1. 결제위젯 인스턴스 생성
       * 2. 결제 금액 설정
       * 3. 기타 등등...
       */
  }
</script>
01_guide_JS_PHP.png
02_setAmount.png
03_test.png
. 는 UI.
연동하기 | 토스페이먼츠 개발자센터
Was this page helpful?