주문·배송

취소 요청 승인

승인하면 실제 결제 취소가 진행돼요. supervisor 권한이 필요해요.

고객 또는 시스템이 요청한 결제 취소 요청을 관리자가 승인하는 API예요. 승인이 완료되면 실제 결제 취소 처리가 진행돼요.

API 엔드포인트

PUThttps://api.bootapi.com/v1/order/cancel/:id/approveBasic Auth

기본 scope는 supervisor:order_cancel_request_history_approve예요. Bootpay-Role 헤더를 보내지 않으면 역할을 supervisor로 보고, 보내면 그 역할의 scope를 검사해요. 회원 JWT는 필요 없어요. 주문 처리 API 원문을 확인해요.

요청 파라미터

파라미터 타입 필수 설명
:id (경로) String 필수 취소 요청 ID (order_cancellation_request_history_id). URL 경로에 넣어요
message String 선택 관리자 승인 메시지 (본문). 내부 관리용이에요
SDK 마다 파라미터 이름이 달라요

HTTP 로는 취소 요청 ID 가 경로​​에 들어가고 본문에는 message 만 보내요. 아래 예제에서 언어별로 order_cancellation_request_id · order_cancel_request_history_id 처럼 이름이 다른 것은 각 SDK 가 그 값을 경로로 옮겨 주기 때문이에요. 직접 HTTP 를 호출한다면 경로에 넣으세요.

코드 예제

const { BootpayCommerce } = require('@bootpay/backend-js');

const commerce = new BootpayCommerce({
    client_key: '{client_key}',
    secret_key: '{secret_key}'
});

const response = await commerce.orderCancel.approve({
    order_cancel_request_history_id: '687a1b2c3d4e5f6789012345',
    message: '취소 요청이 승인되었습니다.'
});
console.log(response);javascript

응답

성공 응답

주문 취소 응답과 같은 모양이에요 — 취소가 반영된 주문 필드에 order_cancellation_request_history 가 붙어 와요. 승인 메시지와 시각은 action_message·action_at 이에요.

{
  "order_number": "25071182085082524116",
  "status": "cancellation_completed",
  "receipt_status": "receipt_cancelled",
  "cancelled_price": 29900,
  "order_cancellation_request_history": {
    "order_cancellation_request_history_id": "687a1b2c3d4e5f6789012345",
    "order_cancellation_request_id": "687a1b2c3d4e5f6789012345",
    "cancel_price": 29900,
    "status": "cancel_approved",
    "action_at": "2025-07-11T03:30:00Z",
    "action_message": "취소 요청이 승인되었습니다.",
    "created_at": "2025-07-11T02:52:09Z"
  }
}json

부분 취소면 주문 status 는 payment_completed 로 남고 cancelled_price 만 늘어나요.

취소 요청 상태 (status)

키 값 설명
cancel_calculated 0 취소 예상 금액만 계산된 상태
cancel_requested 1 취소 요청이 접수되어 승인 대기 중
cancel_approved 2 관리자가 취소 요청을 승인함
cancel_rejected -10 관리자가 취소 요청을 거절함
cancel_withdrawn -11 사용자가 취소 요청을 철회함

전체 값은 커머스 Enum에 있어요.

에러 코드

공통 에러

인증·권한 관련 에러는 에러 코드표를 참고해요.

코드 메시지 대처 방법
ORDER_CANCEL_NOT_REQUESTED 취소 요청 상태가 아니에요. 경로의 :id 가 맞는지, 요청이 아직 cancel_requested 인지 확인해요 (요청이 없을 때도 이 코드예요)
ORDER_STATUS_NOT_CANCELABLE 취소가 불가능한 주문 상태예요. 주문 상태를 확인해요
ORDER_CANCEL_PRICE_OVER 취소 가능한 금액보다 취소 요청 금액이 더 커요. 남은 취소 가능 금액을 확인해요

승인이 완료되면 PG사를 통해 실제 결제 취소가 진행돼요. 환불은 영업일 기준 3~5일 이내 처리돼요.