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.
In v2, instead of assembling the checkout URL yourself, the merchant server can create the payment first via the REST API. You can link the tid returned in the response to your order in advance, and user information is not exposed in the checkout URL.
POST https://api.stagepay.io/api/v1/payments
Authorization: Bearer sk_1f2e3d4c5b6a79880123456789abcdef:<secret>
Content-Type: application/json
X-Request-Id: 9b2f0c1e-6c1a-4d3e-9f20-3b1f0a8e7d11- Authentication: REST API key (requires the
write:transactionsscope). See Authentication. - The app is determined by the app linked to the API key. You cannot create payments for other apps.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
productId | string | Yes | Product ID |
currency | string | Yes | Payment currency (KRW, USD, USDT …) |
userId | string | Yes | Merchant user identifier |
pg | string | PG code. If omitted, the customer chooses on the payment method selection screen | |
method | string | PG payment method code (e.g. card, TRC20) | |
email | string | Receipt email | |
serverId / playerId | string | Game server and player IDs | |
userdata / etc | string | Free-form merchant data (passed through to the callback as is) | |
uniqueId | string | Merchant order number | |
returnUrl | string | "Back to merchant" address on the result screen. Only origins or app schemes registered under the app's Return addresses after payment (returnOrigins); otherwise 400 INVALID_RETURN_URL → JS SDK | |
language | string | Checkout language | |
price | string | Price override. Allowed only for apps with allowCustomPrice=true; because the request itself is authenticated with an API key, no separate priceSig is required for this API. We recommend using request signing |
{
"productId": "gem_100",
"currency": "KRW",
"userId": "user_42",
"pg": "KCP",
"method": "card",
"serverId": "s1",
"playerId": "hero42",
"userdata": "{\"orderNo\":\"A-1001\"}",
"uniqueId": "A-1001",
"language": "ko"
}Response
{
"tid": "KCP-20260101090000123456-a1b2c3-9f8e7d6c",
"checkoutUrl": "https://pay.stagepay.io/checkout?tid=KCP-20260101090000123456-a1b2c3-9f8e7d6c&token=...",
"expiresAt": "2026-01-01T09:30:00+09:00"
}| Field | Description |
|---|---|
tid | The created transaction ID. At this point, the transaction is in the pending state |
checkoutUrl | The checkout URL to open for the customer. It contains a one-time token, so use it as is |
expiresAt | Payment validity period. After this time, checkoutUrl expires and the transaction becomes expired |
Open checkoutUrl in an in-app WebView or a browser. You receive the payment result via callback, as before.
Code examples
curl -X POST https://api.stagepay.io/api/v1/payments \
-H "Authorization: Bearer $STAGEPAY_KEY_ID:$STAGEPAY_KEY_SECRET" \
-H "Content-Type: application/json" \
-d '{"productId":"gem_100","currency":"KRW","userId":"user_42","pg":"KCP","method":"card"}'Errors
| HTTP | Cause |
|---|---|
| 400 | Missing required field, unknown product or currency, purchase restriction violated, price not allowed |
| 401 | API key missing, malformed, or expired |
| 403 | Insufficient scope (write:transactions), IP not allowed |
| 429 | Rate limit exceeded |
For the error response format, see Pagination and errors.
Specification not yet final
The final definition of request and response fields is the Endpoint reference (OpenAPI). If this page differs, follow the reference.
Opening the Checkout
URL parameters for the /request / /inapp checkout, price override signatures, and error responses.
JavaScript 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.