# StagePay Developer Docs > StagePay is a live global payment gateway for games and apps. Merchants open the StagePay checkout (`https://pay.stagepay.io/request.php`) or create a payment server-to-server (`POST /api/v1/payments`), and receive an HMAC-SHA256 signed callback when the payment succeeds. Key facts: - Payment gateways (PG codes): KCP, TOSS, KAKAOPAY and NAVERPAY (direct KakaoPay / Naver Pay integrations without a PG, KRW only), STRIPE, MYCARD, ENJOYPAY, WEBPAY, EBANX, ONEONE, and USDT (stablecoin). - USDT networks: TRC20 (Tron), ERC20 (Ethereum), BEP20 (BNB Smart Chain), POLYGON (Polygon PoS). StagePay never holds private keys; customers send USDT to the merchant's receiving address and StagePay confirms the transfer on-chain using a unique amount per order. - Merchant callback signature: header `X-StagePay-Signature: v1=`, header `X-StagePay-Timestamp` (unix seconds, reject if older than 300 s), idempotency key `X-StagePay-Delivery`. - Callback retries: 1m, 5m, 15m, 1h, 3h, 6h, 12h, 24h (up to 8 retries, 10 s timeout, any 2xx is success). - REST API v1 authentication: `Authorization: Bearer :`, 600 requests per minute per key, optional IP allowlist and request signing. - Amounts are integers in minor units (`amountMinor`): KRW/JPY/IDR/VND/TWD use 0 decimals, USD/EUR/SGD/MYR/THB/PHP use 2, USDT uses 6. - Transaction states: pending → success | failed | cancelled | expired; success → partial_refunded | refunded. - Settlement v2: per app and currency, fee in basis points + fixed fee + VAT on fee, DAILY/WEEKLY/MONTHLY cycles with T+N hold, minimum payout with carry-forward, dual verification and SHA-256 checksum. - Environments: beta (`https://beta-pay.stagepay.io`) for testing, real (`https://pay.stagepay.io`) for live payments. Languages: [한국어](https://docs.stagepay.io/ko/llms.txt), [English](https://docs.stagepay.io/en/llms.txt), [日本語](https://docs.stagepay.io/ja/llms.txt), [简体中文](https://docs.stagepay.io/zh-CN/llms.txt), [繁體中文](https://docs.stagepay.io/zh-TW/llms.txt). Full text: https://docs.stagepay.io/llms-full.txt (English + Korean), or `//llms-full.txt` per language. Every page is also available as Markdown by appending `.md` to its URL. ## English # StagePay Docs - [StagePay Developer Docs](https://docs.stagepay.io/en): Integration guide for StagePay, the global payment gateway for games and apps. Covers opening the checkout, verifying signed callbacks, USDT payments, refunds, the REST API, and settlement. - **Getting started** - [Introduction](https://docs.stagepay.io/en/getting-started/introduction): What StagePay is, the problems it solves, its components, and what it supports. - [Core Concepts](https://docs.stagepay.io/en/getting-started/concepts): The concepts you need to integrate StagePay, including apps (merchants), the tid transaction ID, the transaction state machine, minor-unit amounts, and beta/real environments. - [Quickstart (5-Minute Integration)](https://docs.stagepay.io/en/getting-started/quickstart): Follow five steps for a minimal integration — issue an API key and webhook secret, open the checkout, verify the callback signature, and test in the beta environment. - **Payment integration** - [Opening the Checkout](https://docs.stagepay.io/en/payments/checkout): URL parameters for the /request / /inapp checkout, price override signatures, and error responses. - [Server-to-Server Payment Creation](https://docs.stagepay.io/en/payments/create-payment): The v2 integration approach where your server creates the payment first with POST /api/v1/payments, receives a checkoutUrl, and opens it for the customer. - [JavaScript SDK](https://docs.stagepay.io/en/payments/js-sdk): Launch any PG, payment method or easy pay (Kakao Pay, Naver Pay, Toss Pay) from a merchant web page with one script tag and one call — on PC, mobile web and in-app WebViews. - [Return to merchant (returnUrl)](https://docs.stagepay.io/en/payments/return-url): Send customers back to your page or app after payment — register addresses in the console, pass returnUrl, and handle the return page. - [In-App / WebView Integration](https://docs.stagepay.io/en/payments/in-app-webview): 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). - [Payment Methods and Country Support](https://docs.stagepay.io/en/payments/methods): The PGs, regions, payment methods, and currencies available in StagePay v2, and how to look up the payment methods actually available to your app. - [Testing](https://docs.stagepay.io/en/payments/testing): How to verify your integration using the beta environment, PG-specific test payment methods, the test whitelist, callback resends, and the USDT mock chain. - **Crypto payments (USDT · BTC · ETH …)** - [How USDT Payments Work](https://docs.stagepay.io/en/usdt/overview): The StagePay USDT payment architecture, which identifies orders by receiving address and unique amount without private keys, and confirms payments after on-chain confirmations. - [Supported Crypto Assets (pg=CRYPTO)](https://docs.stagepay.io/en/usdt/assets): BTC, LTC, ETH, BNB, POL, TRX, SOL, XRP and USDC alongside USDT — method codes, decimals, confirmations, price quotes, XRP destination tags and limits. - [USDT Merchant Setup](https://docs.stagepay.io/en/usdt/setup): How to configure networks, receiving addresses, confirmations, validity period, and underpayment tolerance to enable USDT payments. - [USDT Customer Experience](https://docs.stagepay.io/en/usdt/customer-experience): The USDT payment screen customers see, precautions when sending funds, and example status displays and customer messaging. - [USDT Exception Handling](https://docs.stagepay.io/en/usdt/exceptions): What StagePay and the merchant do in cases of underpayment, overpayment, deposits after expiry, transfers on the wrong network, and unmatched deposits. - [USDT Settlement and Refund Policy](https://docs.stagepay.io/en/usdt/settlement-refund): How USDT payments are settled (fee settlement), exchange rate snapshots, why on-chain refunds are manual, and the refund procedure. - **Webhooks / callbacks** - [Webhook/Callback Events and Payloads](https://docs.stagepay.io/en/webhooks/overview): The event types, HTTP headers, and complete body fields of the payment completion and refund callbacks StagePay sends to the merchant server. - [Callback Signature Verification](https://docs.stagepay.io/en/webhooks/signature): The X-StagePay-Signature HMAC-SHA256 signature specification, verification examples in Node.js, PHP, Python, Go, and Java, and fixed test vectors. - [Retries and Idempotency](https://docs.stagepay.io/en/webhooks/retries): How callback failures are determined, the retry schedule (1 minute to 24 hours, up to 8 times), manual resends, and preventing duplicate grants with X-StagePay-Delivery. - [GamePot App Specifics](https://docs.stagepay.io/en/webhooks/gamepot): Checkout parameters, GamePot regional callback endpoints, and payload format differences for apps whose webhookType is GAMEPOT. - **Refunds** - [Refund API](https://docs.stagepay.io/en/refunds/refund-api): How to fully or partially refund KCP and Stripe payments with POST /refund, including authentication headers, request fields, and error codes. - **REST API v1** - [REST API Authentication](https://docs.stagepay.io/en/api/overview): The StagePay REST API v1 base URL, issuing API keys and the Bearer authentication format, scopes, the IP allowlist, and rate limits. - [Pagination and Errors](https://docs.stagepay.io/en/api/conventions): The REST API v1 response formats, pagination parameters, conventions for amounts and dates, and the common error response format. - [Request Signing (Optional)](https://docs.stagepay.io/en/api/request-signing): The optional X-StagePay-Signature request signing specification for preventing REST API body tampering and replay attacks, with Node.js, PHP, and Python examples. - [Endpoint Reference](https://docs.stagepay.io/en/api/reference): The StagePay REST API v1 endpoint list — paths, scopes, parameters, and response fields for payment creation, transactions, products, apps, and settlement queries. - **Settlement** - [Settlement Policy](https://docs.stagepay.io/en/settlement/policy): Settlement policy fields per app × currency (fee rate, fixed fee, VAT, fee refunds on refunds, cycle, hold days, minimum payout, timezone, start date) and the versioning and snapshot rules. - [Settlement Calculation](https://docs.stagepay.io/en/settlement/calculation): Worked numeric examples of which transactions are settled, percentage and fixed fees, VAT, in-period refund deductions, fee refunds, refund adjustment lines, carry-forward, and rounding rules. - [Batch Status, Verification, and Approval](https://docs.stagepay.io/en/settlement/verification): The settlement batch state machine (DRAFT→VERIFIED→APPROVED→PAID, CARRIED_FORWARD, CANCELLED), three-way reconciliation, checksums, four-eyes approval, payout processing, and cancellation rules. - [Settlement Query API](https://docs.stagepay.io/en/settlement/query): How to query settlement batches and lines as JSON or CSV (Accept text/csv) with GET /api/v1/settlements, /{batchNo}, and /{batchNo}/lines, and the response fields. - **Console guide** - [Merchant Console](https://docs.stagepay.io/en/console/merchant): How to manage app settings, webhook secrets, products, API keys, transaction and callback history, logs, and settlement in the merchant console. - [Admin Console](https://docs.stagepay.io/en/console/admin): Operating procedures in the admin console for StagePay operators — managing merchants, apps, and PGs, resending callbacks, USDT review, and running settlement policies and batches. - **Operations** - [Logging and Tracing](https://docs.stagepay.io/en/operations/logging): How to trace a payment from the request through PG communication, state transitions, merchant callbacks, and settlement using requestId, plus the log types StagePay keeps and its masking rules. - [Security Guide](https://docs.stagepay.io/en/operations/security): Security rules for merchant integrations — managing secrets, verifying callbacks, verifying amounts, least privilege for API keys, and the WebView and client trust boundary. - [Operational Alerts (NAVER WORKS)](https://docs.stagepay.io/en/operations/alerts): How to receive payment problems and server errors in a NAVER WORKS bot message room. Covers Developer Console setup, environment variables, the conditions that trigger alerts, severity and grouping rules, and how to test. - [Go-Live Checklist](https://docs.stagepay.io/en/operations/go-live): A checklist of callback URLs, PG credentials, checkout addresses, security, and settlement items to verify when moving to production after beta testing. - **Help** - [Troubleshooting](https://docs.stagepay.io/en/help/troubleshooting): Causes and fixes for common problems, including missing callbacks, signature mismatches, checkout errors, unconfirmed USDT payments, REST API 401/403 errors, and settlement amount discrepancies. - [Changes from v1 to v2](https://docs.stagepay.io/en/help/changelog): What changed in StagePay v2 — callback signatures, transaction states, amount fields, removed PGs, USDT, settlement v2, and the REST API — and how to migrate. ## 한국어 # StagePay 문서 - [StagePay 개발자 문서](https://docs.stagepay.io/ko): 게임·앱을 위한 글로벌 결제 게이트웨이 StagePay의 연동 가이드. 결제창 호출부터 서명된 콜백 검증, USDT 결제, 환불, REST API, 정산까지 다룹니다. - **시작하기** - [StagePay 소개](https://docs.stagepay.io/ko/getting-started/introduction): StagePay가 무엇이고 어떤 문제를 해결하는지, 구성 요소와 지원 범위를 설명합니다. - [핵심 개념](https://docs.stagepay.io/ko/getting-started/concepts): 앱(가맹점), 거래번호 tid, 거래 상태 머신, minor unit 금액, beta/real 환경 등 StagePay 연동에 필요한 개념을 정리합니다. - [빠른 시작 (5분 연동)](https://docs.stagepay.io/ko/getting-started/quickstart): API 키·웹훅 시크릿 발급, 결제창 호출, 콜백 서명 검증, beta 환경 테스트까지 최소 연동을 5단계로 따라 합니다. - **결제 연동** - [결제창 호출](https://docs.stagepay.io/ko/payments/checkout): /request / /inapp 결제창 URL 파라미터, 가격 오버라이드 서명, 오류 응답을 설명합니다. - [서버-서버 결제 생성](https://docs.stagepay.io/ko/payments/create-payment): POST /api/v1/payments로 서버에서 결제를 먼저 생성하고 checkoutUrl을 받아 고객에게 여는 v2 연동 방식입니다. - [JavaScript SDK](https://docs.stagepay.io/ko/payments/js-sdk): 가맹점 웹 페이지에서 스크립트 한 줄과 함수 호출 한 번으로 모든 PG·결제수단·간편결제(카카오페이·네이버페이·토스페이)를 PC·모바일 웹·인앱 WebView에서 여는 방법입니다. - [가맹점 복귀 주소 (returnUrl)](https://docs.stagepay.io/ko/payments/return-url): 결제를 마친 고객을 가맹점 페이지나 앱으로 돌려보내는 방법 — 콘솔 등록, returnUrl 전달, 돌아온 페이지 처리까지. - [인앱 / WebView 연동](https://docs.stagepay.io/ko/payments/in-app-webview): 모바일 게임·앱의 WebView에서 결제창을 열고, /return가 보내는 결제 결과 메시지를 React Native, iOS, Android, 웹(팝업·iframe)에서 받는 방법입니다. - [결제수단·국가별 지원표](https://docs.stagepay.io/ko/payments/methods): StagePay v2에서 사용할 수 있는 PG, 지역, 결제수단, 통화와 앱별 실제 사용 가능 결제수단을 조회하는 방법입니다. - [테스트 방법](https://docs.stagepay.io/ko/payments/testing): beta 환경, PG별 테스트 결제수단, 테스트 화이트리스트, 콜백 재전송, USDT mock 체인으로 연동을 검증하는 방법입니다. - **암호화폐 결제 (USDT·BTC·ETH 등)** - [USDT 결제 동작 원리](https://docs.stagepay.io/ko/usdt/overview): 개인키 없이 수취 주소와 고유 금액으로 주문을 식별하고, 체인 컨펌 후 결제를 확정하는 StagePay USDT 결제 구조를 설명합니다. - [지원 암호화폐 (pg=CRYPTO)](https://docs.stagepay.io/ko/usdt/assets): USDT 외에 BTC·LTC·ETH·BNB·POL·TRX·SOL·XRP·USDC 결제 — method 코드, 자릿수, 컨펌 수, 시세 환산, XRP 데스티네이션 태그, 제약 사항. - [USDT 가맹점 설정](https://docs.stagepay.io/ko/usdt/setup): USDT 결제를 켜기 위한 네트워크, 수취 주소, 컨펌 수, 유효시간, 허용 부족액 설정 방법입니다. - [USDT 고객 경험](https://docs.stagepay.io/ko/usdt/customer-experience): 고객이 보는 USDT 결제 화면, 송금 시 주의사항, 상태 표시와 안내 문구 예시입니다. - [USDT 예외 처리](https://docs.stagepay.io/ko/usdt/exceptions): 부족 입금, 초과 입금, 만료 후 입금, 다른 네트워크 송금, 미매칭 입금이 발생했을 때 StagePay와 가맹점이 하는 일입니다. - [USDT 정산·환불 정책](https://docs.stagepay.io/ko/usdt/settlement-refund): USDT 결제의 정산 방식(수수료 정산), 환율 스냅샷, 체인 환불이 수동인 이유와 처리 절차입니다. - **웹훅 / 콜백** - [웹훅/콜백 이벤트와 페이로드](https://docs.stagepay.io/ko/webhooks/overview): StagePay가 가맹점 서버로 보내는 결제 완료·환불 콜백의 이벤트 종류, HTTP 헤더, 본문 필드 전체를 설명합니다. - [콜백 서명 검증](https://docs.stagepay.io/ko/webhooks/signature): X-StagePay-Signature HMAC-SHA256 서명 규격과 Node.js, PHP, Python, Go, Java 검증 예제, 고정 테스트 벡터를 제공합니다. - [재시도와 멱등 처리](https://docs.stagepay.io/ko/webhooks/retries): 콜백 실패 판정, 재시도 간격(1분~24시간, 최대 8회), 수동 재전송, X-StagePay-Delivery를 이용한 중복 지급 방지 방법입니다. - [GamePot 앱 특이사항](https://docs.stagepay.io/ko/webhooks/gamepot): webhookType이 GAMEPOT인 앱의 결제창 파라미터, GamePot 리전별 콜백 엔드포인트, 페이로드 형식 차이를 설명합니다. - **환불** - [환불 API](https://docs.stagepay.io/ko/refunds/refund-api): POST /refund로 KCP·Stripe 결제를 전액 또는 부분 환불하는 방법, 인증 헤더, 요청 필드, 오류 코드를 설명합니다. - **REST API v1** - [REST API 인증](https://docs.stagepay.io/ko/api/overview): StagePay REST API v1의 기본 주소, API 키 발급과 Bearer 인증 형식, 스코프, IP 허용 목록, 레이트리밋을 설명합니다. - [페이지네이션과 에러](https://docs.stagepay.io/ko/api/conventions): REST API v1의 응답 형식, 페이지네이션 파라미터, 금액·날짜 표기 규칙, 공통 에러 응답 형식을 설명합니다. - [요청 서명 (선택)](https://docs.stagepay.io/ko/api/request-signing): REST API 요청 본문 변조와 재생 공격을 막기 위한 선택적 X-StagePay-Signature 요청 서명 규격과 Node.js·PHP·Python 예제입니다. - [엔드포인트 레퍼런스](https://docs.stagepay.io/ko/api/reference): StagePay REST API v1 엔드포인트 목록 — 결제 생성, 거래, 상품, 앱, 정산 조회의 경로, 스코프, 파라미터, 응답 필드입니다. - **정산** - [정산 정책](https://docs.stagepay.io/ko/settlement/policy): 앱×통화별 정산 정책 항목(수수료율, 고정 수수료, VAT, 환불 수수료 환급, 주기, 지급 보류일, 최소 지급액, 시간대, 시작일)과 버전·스냅샷 규칙입니다. - [정산 계산식](https://docs.stagepay.io/ko/settlement/calculation): 정산 대상 거래, 비율·고정 수수료, VAT, 기간 내 환불 차감, 수수료 환급, 환불 조정 라인, 이월, 반올림 규칙을 실제 숫자 예제로 설명합니다. - [배치 상태와 검증·승인](https://docs.stagepay.io/ko/settlement/verification): 정산 배치의 상태 머신(DRAFT→VERIFIED→APPROVED→PAID, CARRIED_FORWARD, CANCELLED), 3중 대조 검증, 체크섬, 4-eyes 승인, 지급 처리, 취소 규칙입니다. - [정산 조회 API](https://docs.stagepay.io/ko/settlement/query): GET /api/v1/settlements, /{batchNo}, /{batchNo}/lines로 정산 배치와 라인을 JSON 또는 CSV(Accept text/csv)로 조회하는 방법과 응답 필드입니다. - **콘솔 가이드** - [가맹점 콘솔](https://docs.stagepay.io/ko/console/merchant): 가맹점 콘솔에서 앱 설정, 웹훅 시크릿, 상품, API 키, 거래·콜백 이력, 로그, 정산을 관리하는 방법입니다. - [어드민 콘솔](https://docs.stagepay.io/ko/console/admin): StagePay 운영자용 어드민 콘솔의 가맹점·앱·PG 관리, 콜백 재전송, USDT 검토, 정산 정책·배치 운영 절차입니다. - **운영** - [로그와 추적](https://docs.stagepay.io/ko/operations/logging): requestId로 결제 요청부터 PG 통신, 상태 전이, 가맹점 콜백, 정산까지 추적하는 방법과 StagePay가 남기는 로그 종류, 마스킹 규칙입니다. - [보안 가이드](https://docs.stagepay.io/ko/operations/security): 가맹점 연동에서 지켜야 할 보안 수칙 — 비밀값 관리, 콜백 검증, 금액 검증, API 키 최소 권한, WebView와 클라이언트 신뢰 경계입니다. - [운영 알림 (네이버웍스)](https://docs.stagepay.io/ko/operations/alerts): 결제 문제와 서버 오류를 네이버웍스 Bot 메시지방으로 받는 방법입니다. Developer Console 설정, 환경 변수, 알림이 나가는 조건, 심각도와 묶음 규칙, 테스트 방법을 설명합니다. - [라이브 전환 체크리스트](https://docs.stagepay.io/ko/operations/go-live): beta 테스트를 마친 뒤 운영 환경으로 전환할 때 확인할 콜백 URL, PG 자격증명, 결제창 주소, 보안, 정산 항목 체크리스트입니다. - **도움말** - [문제 해결](https://docs.stagepay.io/ko/help/troubleshooting): 콜백 미수신, 서명 불일치, 결제창 오류, USDT 미확인, REST API 401/403, 정산 금액 차이 등 자주 겪는 문제의 원인과 해결 방법입니다. - [v1 → v2 변경사항](https://docs.stagepay.io/ko/help/changelog): StagePay v2에서 바뀐 콜백 서명, 거래 상태, 금액 필드, 제거된 PG, USDT, 정산 v2, REST API 변경점과 마이그레이션 방법입니다.