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).
| Endpoint | Description |
|---|---|
GET /request | Starts the payment immediately with the specified PG (pg) and payment method (method). |
GET /inapp | Shows a payment method selection screen, then starts the payment. If you pass pg and method, or payment, the selection screen is skipped. |
| Environment | Base address |
|---|---|
| beta | https://beta-pay.stagepay.io |
| real | https://pay.stagepay.io |
Example requests
https://pay.stagepay.io/request?appId=6650f0c2a1b2c3d4e5f60718&pg=KCP&method=card&productId=gem_100¤cy=KRW&userId=user_42&language=kohttps://pay.stagepay.io/inapp?appId=6650f0c2a1b2c3d4e5f60718&productId=gem_100¤cy=KRW&userId=user_42&language=koParameters
All values must be URL-encoded (we recommend URLSearchParams, http_build_query, or urllib.parse.urlencode).
Required
| Parameter | Type | Description | Example |
|---|---|---|---|
appId | string | App ID | 6650f0c2a1b2c3d4e5f60718 |
pg | string | PG code. Required for /request | KCP, STRIPE, USDT |
productId | string | Product ID registered in the console | gem_100 |
currency | string | Payment currency (ISO 4217 or USDT). The product must have a price in this currency | KRW |
userId | string | The merchant's user identifier. Passed through to the callback as is | user_42 |
Optional
| Parameter | Type | Description | Example |
|---|---|---|---|
method | string | The PG's payment method code. If omitted, the PG's default checkout is used | card, TRC20 |
language (lang) | string | Checkout language | ko, en, ja, zh-CN, zh-TW, th, id, es, ms |
email | string | Email address for the receipt (used only if the format is valid) | user@example.com |
serverId | string | Game server ID | s1 |
playerId | string | Game character/player ID | hero42 |
userdata | string | Free-form merchant data. Passed through to the callback as is (JSON string recommended, 2 KB or less recommended) | {"orderNo":"A-1001"} |
etc | string | Free-form merchant data (auxiliary) | promo=summer |
uniqueId | string | Merchant-side unique order value. Used to link the merchant's order number to the transaction | A-1001 |
returnUrl | string | "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 appended | https://shop.example.com/orders/A-1001 |
directPay | string | Opens an easy pay method directly (KCP, TOSS). TOSS requires API individual integration keys — see Open easy pay directly | TOSSPAY, NAVERPAY, KAKAOPAY |
sessionToken | string | StagePay member session token (only for apps that use it) | |
region / projectId | string | For GamePot-integrated apps only (GamePot region and project) | |
price, priceTs, priceSig | string | Price override — see Price override below |
For /inapp only:
| Parameter | Description |
|---|---|
payment | Payment method ID or code. If provided, the selection screen is skipped |
token | GamePot 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:
- The app setting
allowCustomPrice = true(request it from an operator via the console) - A valid signature
priceSigcreated by the merchant server is sent along with it, andpriceTsis within ±900 seconds of the current time
price:{appId}:{productId}:{CURRENCY}:{price}:{userId}:{priceTs}priceSig = hex(HMAC-SHA256(webhookSecret, canonical))— the key is the app's fullwebhookSecretstring (whsec_...).{CURRENCY}must be uppercase, and{price}must be exactly the same as the string actually sent in the URL (5000and5000.00are different values).priceTsis in Unix seconds.
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.
| HTTP | Message | Cause |
|---|---|---|
| 400 | PG code is required | pg is missing |
| 400 | Currency is required | currency is missing |
| 400 | Product ID is required | productId is missing |
| 400 | Purchase restriction message | The product's purchase conditions were violated (one-time only, limited period, etc.) |
| 400 | Unsupported payment method | A PG the app cannot use |
| 404 | Payment company not found | Unknown PG code |
| 404 | Payment method not found | A payment method code that does not exist for that PG |
| 404 | Product information not found | The product does not exist or has no price in that currency |
| 500 | Error processing payment | Internal error such as a failed PG request — contact us with the requestId |
After the payment
- When the customer completes the payment, the PG notifies StagePay of the result, and StagePay confirms the transaction as
successafter PG server verification. - A signed
payment.succeededcallback is sent to the merchant callback URL → Webhooks/callbacks. - The customer's browser (or WebView) navigates to the
/returnresult page, and the result is delivered to the app → In-app/WebView integration.
Quickstart (5-Minute Integration)
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.
Server-to-Server Payment Creation
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.