Refund API
How to fully or partially refund KCP and Stripe payments with POST /refund, including authentication headers, request fields, and error codes.
Cancel (refund) a PG payment from the merchant server. The PGs that can currently be refunded via the API are KCP, STRIPE, KAKAOPAY and NAVERPAY (refund KakaoPay and Naver Pay payments by tid). Other PGs (TOSS, MYCARD, etc.) are handled by an operator in the console, and USDT uses manual refunds.
POST https://pay.stagepay.io/refund?pg=KCP
Content-Type: application/json
X-App-Id: 6650f0c2a1b2c3d4e5f60718
X-Api-Key: <app API key>Call this from your server only
X-Api-Key is the app API key (find it in the console under App settings). If you include it in a client app or browser, anyone can request refunds.
Authentication
| Header | Body fallback field | Description |
|---|---|---|
X-App-Id | app_id | App ID |
X-Api-Key | api_key | App API key. Must match the app ID |
We recommend using the headers. The body fields are for v1 compatibility.
You can also call it with a REST API key (Authorization: Bearer <keyId>:<secret>). The key must have the refunds:write scope; otherwise 403 INSUFFICIENT_SCOPE is returned. Read-only keys (read:*) cannot issue refunds.
Request body
KCP (?pg=KCP)
| Field | Required | Description |
|---|---|---|
tno | Yes | KCP transaction number (pgTid in the REST API transaction lookup) |
amount | Refund amount (KRW). If omitted, the payment is fully cancelled | |
remaining_amount | For partial refunds | Cancellable balance before the refund |
reason | Refund reason (up to 100 characters) | |
tax_info | Merchants with mixed taxation only: { "tax_mny", "vat_mny", "free_mny" } |
{ "tno": "24123456789012", "amount": 5000, "remaining_amount": 12000, "reason": "고객 요청" }Stripe (?pg=STRIPE)
| Field | Required | Description |
|---|---|---|
payment_intent_id | One of the two | Stripe PaymentIntent ID (pi_...) |
charge_id | One of the two | Stripe Charge ID (ch_...) |
amount | Refund amount (minor unit, e.g. US cents). If omitted, the full amount | |
reason | requested_by_customer (default), duplicate, fraudulent | |
metadata | Key-value pairs to attach to the Stripe refund |
{ "payment_intent_id": "pi_3QabcDEF123", "reason": "requested_by_customer" }Response
On success, returns HTTP 200 with "success": true; on failure, returns 400 (PG declined) or 500 with "success": false.
{
"success": true,
"refund_id": "re_3QabcDEF123",
"amount": 999,
"currency": "usd",
"status": "succeeded",
"payment_intent": "pi_3QabcDEF123"
}{ "success": false, "error_code": "TNO_REQUIRED", "error_message": "tno (KCP transaction number) is required" }KCP responses include KCP's original fields (res_cd, res_msg, mod_mny, canc_time, etc.). A res_cd of 0000 means success.
Error codes
| HTTP | error_code | Cause |
|---|---|---|
| 405 | METHOD_NOT_ALLOWED | Not a POST |
| 400 | PG_REQUIRED | ?pg= is missing |
| 400 | UNSUPPORTED_PG | A PG other than KCP, STRIPE, KAKAOPAY or NAVERPAY (including USDT) |
| 401 | APP_ID_REQUIRED | App ID is missing |
| 401 | API_KEY_REQUIRED | API key is missing |
| 401 | API_KEY_INVALID | API key does not match the app |
| 400 | TNO_REQUIRED | KCP tno is missing |
| 400 | PAYMENT_ID_REQUIRED | Stripe payment_intent_id / charge_id is missing |
| 400 | PG error code | Declined by the PG (amount exceeded, already cancelled, etc.) |
| 500 | AUTH_ERROR / INTERNAL_ERROR | Internal error — contact us with the time and the tno/payment_intent_id |
After the refund
- When the refund is applied, the transaction status changes to
partial_refundedorrefunded, and thepayment.refundedcallback is sent. - A refund of an already-settled transaction is deducted in the next settlement batch as a refund adjustment line → Settlement calculation.
- If you send the same request twice, the PG usually rejects the second one, but partial refunds may be processed twice. Make sure your side sends each refund request only once.
GamePot App Specifics
Checkout parameters, GamePot regional callback endpoints, and payload format differences for apps whose webhookType is GAMEPOT.
REST API Authentication
The StagePay REST API v1 base URL, issuing API keys and the Bearer authentication format, scopes, the IP allowlist, and rate limits.