Skip to Content
StagePayDocs v2

In-App / WebView Integration

How to open the checkout in a mobile game or app WebView and receive the payment result message sent by /return in React Native, iOS, Android, and the web (popup/iframe).

When the payment is finished, the customer is taken to the StagePay result page, /return. As soon as this page loads, it sends the payment result over multiple channels at once, so your app only needs to implement the channel that suits it.

The result message is for UI handling only

Use the /return message only for UI handling, such as closing the checkout and showing a "Confirming payment" screen. Always grant items based on the signed callback received by your server. Client messages can be forged.

Result message format

{
  "type": "STAGEPAY_RESULT",
  "action": "payment_complete",
  "status": "success",
  "title": "결제 성공",
  "message": "결제가 성공적으로 완료되었습니다.",
  "transactionId": "KCP-20260101090000123456-a1b2c3-9f8e7d6c",
  "details": "Transaction ID: KCP-20260101090000123456-a1b2c3-9f8e7d6c",
  "timestamp": "2026-01-01T09:00:12+09:00"
}
FieldValue
typeAlways STAGEPAY_RESULT (the close button message is STAGEPAY_CLOSE for popups and iframes)
actionpayment_complete (on page load) or close (close button)
statussuccess · pending · failed. pending means the PG returned before final approval (e.g. some card or bank account payments); the final result is reflected via the callback
transactionIdStagePay tid
title / messageDisplay text in the browser language (ko/en/ja/zh)

Delivery channels

EnvironmentChannel
React Native WebViewwindow.ReactNativeWebView.postMessage(JSON.stringify(result))
iOS WKWebViewwindow.webkit.messageHandlers.GamePotStagePay.postMessage(result)
Android WebViewwindow.GamePotStagePay.onPaymentResult(JSON.stringify(result))
Popup (window.open)window.opener.postMessage(result, '*')
iframewindow.parent.postMessage(result, '*')

When the close button is pressed, React Native receives an action: "close" message, iOS receives { action: 'close' }, and Android receives a GamePotStagePay.close() call.

Platform examples

import { WebView } from 'react-native-webview';

export function CheckoutScreen({ checkoutUrl, onDone }: { checkoutUrl: string; onDone: (s: string) => void }) {
  return (
    <WebView
      source={{ uri: checkoutUrl }}
      onMessage={(event) => {
        let data: { type?: string; action?: string; status?: string; transactionId?: string };
        try {
          data = JSON.parse(event.nativeEvent.data);
        } catch {
          return;
        }
        if (data.type !== 'STAGEPAY_RESULT') return;
        // Only update the UI; decide whether to grant by querying the server (callback) status
        onDone(data.status ?? 'failed');
      }}
    />
  );
}
  1. The client sends a purchase request to the merchant server → the server calls the payment creation API or builds a checkout URL.
  2. The client opens checkoutUrl in a WebView.
  3. On receiving STAGEPAY_RESULT, close the WebView and show "Confirming payment".
  4. The merchant server grants the item after receiving the callback. The client queries the merchant server for the order status (polling or push) and displays the result.
  5. If status is pending, wait until the callback arrives (USDT, virtual accounts, and similar methods can take from several minutes to several hours).

WebView configuration tips

  • JavaScript and DOM Storage must be enabled.
  • Some payment methods (card issuer apps, easy pay apps) open apps via external schemes such as intent:// or kakaotalk://. In your WebView's URL loading handler, pass non-http(s) schemes to the OS so it launches the external app.
  • If third-party cookies are blocked, some PG authentication can fail. On Android, set CookieManager.setAcceptThirdPartyCookies(webView, true).

On this page