Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cid코드가 등록되지 않았다고 나옵니다. #26

Open
seoulsaram opened this issue Sep 14, 2020 · 0 comments
Open

cid코드가 등록되지 않았다고 나옵니다. #26

seoulsaram opened this issue Sep 14, 2020 · 0 comments

Comments

@seoulsaram
Copy link

seoulsaram commented Sep 14, 2020

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<% request.setCharacterEncoding("UTF-8"); %>

<% response.setContentType("text/html; charset=UTF-8"); %>

<title>Insert title here</title>

<%

String member_id = request.getParameter("member_id");

int cost = Integer.parseInt(request.getParameter("cost"));

String product = request.getParameter("product");

%>

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js" ></script> <script type="text/javascript" src="https://cdn.iamport.kr/js/iamport.payment-1.1.5.js"></script>

<script type="text/javascript">

`$(function(){

    var IMP = window.IMP; // 생략가능

    IMP.init('TC0ONETIME'); // 'iamport' 대신 부여받은 "가맹점 식별코드"를 사용 

    var msg;

    
    IMP.request_pay({

        pg : 'kakaopay',

        pay_method : 'card',

        merchant_uid : 'merchant_' + new Date().getTime(),

        name : '<%=product%>',

        amount : 100,

        buyer_name : '<%=member_id%>',

        
    }, function(rsp) {

        if ( rsp.success ) {
  
            jQuery.ajax({

                url: "/payments/complete", 

                type: 'POST',

                dataType: 'json',

                data: {

                    imp_uid : rsp.imp_uid
                  
                }

            }).done(function(data) {

                
                if ( everythings_fine ) {

                    msg = '결제가 완료되었습니다.';

                    msg += '\n고유ID : ' + rsp.imp_uid;

                    msg += '\n상점 거래ID : ' + rsp.merchant_uid;

                    msg += '\결제 금액 : ' + rsp.paid_amount;

                    msg += '카드 승인번호 : ' + rsp.apply_num;

                    
                    alert("결제 성공");

                    location.href='kakao.do?command=premiumProduct';

                    
                } else {


                }

            });

            
           
        } else {

            msg = '결제에 실패하였습니다.';

            msg += '에러내용 : ' + rsp.error_msg;

         
            alert(msg);

        }

    });

    
});`
</script>

코드는 이와 같이 작성을 했는데 실행했을 때 PG사에 등록되지 않은 가맹점 코드라는 식의 오류가 뜹니다.

ㅠㅠ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant