Skip to Content
StagePayDocs v2

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:transactions scope). See Authentication.
  • The app is determined by the app linked to the API key. You cannot create payments for other apps.

Request body

FieldTypeRequiredDescription
productIdstringYesProduct ID
currencystringYesPayment currency (KRW, USD, USDT …)
userIdstringYesMerchant user identifier
pgstringPG code. If omitted, the customer chooses on the payment method selection screen
methodstringPG payment method code (e.g. card, TRC20)
emailstringReceipt email
serverId / playerIdstringGame server and player IDs
userdata / etcstringFree-form merchant data (passed through to the callback as is)
uniqueIdstringMerchant order number
returnUrlstring"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
languagestringCheckout language
pricestringPrice 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
Example request
{
  "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

201 Created
{
  "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"
}
FieldDescription
tidThe created transaction ID. At this point, the transaction is in the pending state
checkoutUrlThe checkout URL to open for the customer. It contains a one-time token, so use it as is
expiresAtPayment 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

HTTPCause
400Missing required field, unknown product or currency, purchase restriction violated, price not allowed
401API key missing, malformed, or expired
403Insufficient scope (write:transactions), IP not allowed
429Rate 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.

On this page