Skip to Content
StagePayDocs v2

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

HeaderBody fallback fieldDescription
X-App-Idapp_idApp ID
X-Api-Keyapi_keyApp 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)

FieldRequiredDescription
tnoYesKCP transaction number (pgTid in the REST API transaction lookup)
amountRefund amount (KRW). If omitted, the payment is fully cancelled
remaining_amountFor partial refundsCancellable balance before the refund
reasonRefund reason (up to 100 characters)
tax_infoMerchants with mixed taxation only: { "tax_mny", "vat_mny", "free_mny" }
Example partial refund
{ "tno": "24123456789012", "amount": 5000, "remaining_amount": 12000, "reason": "고객 요청" }

Stripe (?pg=STRIPE)

FieldRequiredDescription
payment_intent_idOne of the twoStripe PaymentIntent ID (pi_...)
charge_idOne of the twoStripe Charge ID (ch_...)
amountRefund amount (minor unit, e.g. US cents). If omitted, the full amount
reasonrequested_by_customer (default), duplicate, fraudulent
metadataKey-value pairs to attach to the Stripe refund
Example full 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 (Stripe)
{
  "success": true,
  "refund_id": "re_3QabcDEF123",
  "amount": 999,
  "currency": "usd",
  "status": "succeeded",
  "payment_intent": "pi_3QabcDEF123"
}
Failure
{ "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

HTTPerror_codeCause
405METHOD_NOT_ALLOWEDNot a POST
400PG_REQUIRED?pg= is missing
400UNSUPPORTED_PGA PG other than KCP, STRIPE, KAKAOPAY or NAVERPAY (including USDT)
401APP_ID_REQUIREDApp ID is missing
401API_KEY_REQUIREDAPI key is missing
401API_KEY_INVALIDAPI key does not match the app
400TNO_REQUIREDKCP tno is missing
400PAYMENT_ID_REQUIREDStripe payment_intent_id / charge_id is missing
400PG error codeDeclined by the PG (amount exceeded, already cancelled, etc.)
500AUTH_ERROR / INTERNAL_ERRORInternal 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_refunded or refunded, and the payment.refunded callback 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.

On this page