Skip to Content
StagePayDocs v2

Opening the Checkout

URL parameters for the /request / /inapp checkout, price override signatures, and error responses.

The checkout is opened using URL parameters only. We recommend building the checkout URL on the merchant server and passing it to the client (to prevent tampering with user identifiers, to sign prices, and so on).

EndpointDescription
GET /requestStarts the payment immediately with the specified PG (pg) and payment method (method).
GET /inappShows a payment method selection screen, then starts the payment. If you pass pg and method, or payment, the selection screen is skipped.
EnvironmentBase address
betahttps://beta-pay.stagepay.io
realhttps://pay.stagepay.io

Example requests

Start a KCP card payment immediately
https://pay.stagepay.io/request?appId=6650f0c2a1b2c3d4e5f60718&pg=KCP&method=card&productId=gem_100&currency=KRW&userId=user_42&language=ko
Payment method selection screen
https://pay.stagepay.io/inapp?appId=6650f0c2a1b2c3d4e5f60718&productId=gem_100&currency=KRW&userId=user_42&language=ko

Parameters

All values must be URL-encoded (we recommend URLSearchParams, http_build_query, or urllib.parse.urlencode).

Required

ParameterTypeDescriptionExample
appIdstringApp ID6650f0c2a1b2c3d4e5f60718
pgstringPG code. Required for /requestKCP, STRIPE, USDT
productIdstringProduct ID registered in the consolegem_100
currencystringPayment currency (ISO 4217 or USDT). The product must have a price in this currencyKRW
userIdstringThe merchant's user identifier. Passed through to the callback as isuser_42

Optional

ParameterTypeDescriptionExample
methodstringThe PG's payment method code. If omitted, the PG's default checkout is usedcard, TRC20
language (lang)stringCheckout languageko, en, ja, zh-CN, zh-TW, th, id, es, ms
emailstringEmail address for the receipt (used only if the format is valid)user@example.com
serverIdstringGame server IDs1
playerIdstringGame character/player IDhero42
userdatastringFree-form merchant data. Passed through to the callback as is (JSON string recommended, 2 KB or less recommended){"orderNo":"A-1001"}
etcstringFree-form merchant data (auxiliary)promo=summer
uniqueIdstringMerchant-side unique order value. Used to link the merchant's order number to the transactionA-1001
returnUrlstring"Back to merchant" address on the result screen. Only origins (https://…) or app schemes (mygame://) registered under the app's Return addresses after payment are accepted. stagepay_tid and stagepay_status are appendedhttps://shop.example.com/orders/A-1001
directPaystringOpens an easy pay method directly (KCP, TOSS). TOSS requires API individual integration keys — see Open easy pay directlyTOSSPAY, NAVERPAY, KAKAOPAY
sessionTokenstringStagePay member session token (only for apps that use it)
region / projectIdstringFor GamePot-integrated apps only (GamePot region and project)
price, priceTs, priceSigstringPrice override — see Price override below

For /inapp only:

ParameterDescription
paymentPayment method ID or code. If provided, the selection screen is skipped
tokenGamePot JWT (used instead of userId in GamePot apps)

Do not send the amount

The payment amount is determined from the product price registered on the server, based on productId and currency. Amounts sent by the client are not trusted.

Price override

If you really need a dynamic price (e.g. a cart total), you can override the product price with price. In v2, it is applied only when both of the following conditions are met:

  1. The app setting allowCustomPrice = true (request it from an operator via the console)
  2. A valid signature priceSig created by the merchant server is sent along with it, and priceTs is within ±900 seconds of the current time
String to sign (canonical)
price:{appId}:{productId}:{CURRENCY}:{price}:{userId}:{priceTs}
  • priceSig = hex(HMAC-SHA256(webhookSecret, canonical)) — the key is the app's full webhookSecret string (whsec_...).
  • {CURRENCY} must be uppercase, and {price} must be exactly the same as the string actually sent in the URL (5000 and 5000.00 are different values).
  • priceTs is in Unix seconds.
Signing the price (Node.js)
import crypto from 'node:crypto';

export function signPrice(p: { appId: string; productId: string; currency: string; price: string; userId: string }) {
  const priceTs = Math.floor(Date.now() / 1000).toString();
  const canonical = ['price', p.appId, p.productId, p.currency.toUpperCase(), p.price, p.userId, priceTs].join(':');
  const priceSig = crypto.createHmac('sha256', process.env.STAGEPAY_WEBHOOK_SECRET!).update(canonical).digest('hex');
  return { price: p.price, priceTs, priceSig };
}

If the signature is missing or invalid, price is ignored and the product price is used (or, if the product price is 0, the request is rejected).

Responses and errors

The checkout returns HTML. If the request is invalid, an error page is returned along with an HTTP status code, and the rejection reason is recorded as a request_rejected log that you can view under Logs in the console.

HTTPMessageCause
400PG code is requiredpg is missing
400Currency is requiredcurrency is missing
400Product ID is requiredproductId is missing
400Purchase restriction messageThe product's purchase conditions were violated (one-time only, limited period, etc.)
400Unsupported payment methodA PG the app cannot use
404Payment company not foundUnknown PG code
404Payment method not foundA payment method code that does not exist for that PG
404Product information not foundThe product does not exist or has no price in that currency
500Error processing paymentInternal error such as a failed PG request — contact us with the requestId

After the payment

  1. When the customer completes the payment, the PG notifies StagePay of the result, and StagePay confirms the transaction as success after PG server verification.
  2. A signed payment.succeeded callback is sent to the merchant callback URL → Webhooks/callbacks.
  3. The customer's browser (or WebView) navigates to the /return result page, and the result is delivered to the app → In-app/WebView integration.

On this page