Skip to content
스토어 연동
마지막 업데이트

STOVE 결제창 연동 가이드

Chrome ‘document.domain’ setter 비활성화로 인해 하위 도메인 간 cross-origin 정책에 따라 상호간 제어가 제한됩니다.
결제 팝업 호출 후 잔액 갱신 / 결제 완료 등 팝업 상태에 따른 처리를 하는 경우,
팝업에서 부모창을 호출하는 postMessage를 받을 수 있습니다.

기존 빌링 팝업 사용 페이지에서 해야 할 작업

  1. 창에서 document.domain = “onstove.com”; 선언 제거
  2. 용도에 따라 postMessage addEventListener 구현

Chrome 비활성화 일정 지연으로 document.domain과 postMessage를 병행합니다. (2022년09월)

  • 20220914 postMessage 전송 배포
  • 추후 document.domain 관련항목 제거

관련 링크

document.domain setter deprecated

Window.postMessage

postMessage 종류

충전창 결제 완료 시점과 충전창 close 시 각각 postMessage를 보내드립니다.
postMessage를 수신하는 EventListner를 추가하신 후, 용도에 따라 잔액의 부분 갱신이나 페이지 전체 reload 등 호출한 창에서 필요한 action을 구현하시기 바랍니다.

결제 완료 시점 postMessage

json
결제 완료 시점
{
    "source": "bill",
    "action": "request_balance_refresh"
}

결제 완료 후 확인 버튼 클릭 시점 postMessage

json
redirect url이 없는 경우
{
    "source": "bill",
    "action": "request_reload"
}

redirect url이 있는 경우
{
    "source": "bill",
    "action": "request_redirect",
    "message": redirect_url
}

postMessage 수신

originURL

event.origin- Live : https://pay.onstove.com - SandBox : https://pay.gate8.com

EventListener 추가

event.origin이 빌링 origin 인지 확인 후 action에 따라 분기하시는 것을 권장합니다.

json
window.addEventListener("message", receiveMessage, false);

function receiveMessage(event)
{
  if (event.origin !== "https://pay.onstove.com")
    return;

  // ...
}

문의사항


문의사항이 있다면 디스코드 또는나 store.support@smilegate.com로 문의해 주세요.