수고가 많으십니다.
카카오페이 입점을 위해 카카오페이 결제테스트를 진행 중입니다.
큐알코드->결제수단선택->결제완료까지 화면상으로는 진행이 됩니다만,
서버에는 하기와 같은 에러메시지가 나오며 서버가 내려갑니다.
부디 해결방법을 알려주시면 감사하겠습니다.
Server started, port 5050
결제용정보>>>>>>: {
cid: ‘TC…’,
partner_order_id: ‘L-2023220-…’,
partner_user_id: ‘ntabi’,
item_name: '[엔데이트립]오사카 출발 교토 5스팟 1일 버스투어 최소 4명 출확! ‘,
quantity: 1,
total_amount: 100,
vat_amount: 0,
tax_free_amount: 100,
approval_url: ‘http://ntabi.co.kr/success파일명’,
fail_url: ‘http://ntabi.co.kr/fail_파일명’,
cancel_url: ‘http://ntabi.co.kr/fail_파일명’
}
결제대기Response>>>>tid: T4… response: {
tid: ‘T4…’,
tms_result: false,
next_redirect_app_url: ‘https://online-pay.kakao.com/mockup/v1/e4a01b4e7caeb50f8ecf7b9f1efb7339f8c303632810a948797251df5b6194f5/aInfo’,
next_redirect_mobile_url: ‘https://online-pay.kakao.com/mockup/v1/e4a01b4e7caeb50f8ecf7b9f1efb7339f8c303632810a948797251df5b6194f5/mInfo’,
next_redirect_pc_url: ‘https://online-pay.kakao.com/mockup/v1/e4a01b4e7caeb50f8ecf7b9f1efb7339f8c303632810a948797251df5b6194f5/info’,
android_app_scheme: ‘kakaotalk://kakaopay/pg?url=https://online-pay.kakao.com/pay/mockup/e4a01b4e7caeb50f8ecf7b9f1efb7339f8c303632810a948797251df5b6194f5’,
ios_app_scheme: ‘kakaotalk://kakaopay/pg?url=https://online-pay.kakao.com/pay/mockup/e4a01b4e7caeb50f8ecf7b9f1efb7339f8c303632810a948797251df5b6194f5’,
created_at: ‘2023-03-06T04:10:07’
}
AxiosError: Request failed with status code 401
at settle (D:\trip\server\node_modules\axios\dist\node\axios.cjs:1900:12)
at IncomingMessage.handleStreamEnd (D:\trip\server\node_modules\axios\dist\node\axios.cjs:2944:11)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: ‘ERR_BAD_REQUEST’,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ ‘xhr’, ‘http’ ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: ‘XSRF-TOKEN’,
xsrfHeaderName: ‘X-XSRF-TOKEN’,
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: null },
validateStatus: [Function: validateStatus],
headers: AxiosHeaders {
Accept: ‘application/json, text/plain, /’,
‘Content-Type’: ‘application/json’,
‘User-Agent’: ‘axios/1.3.3’,
‘Content-Length’: ‘123’,
‘Accept-Encoding’: ‘gzip, compress, deflate, br’
},
method: ‘post’,
url: ‘https://kapi.kakao.com/v1/payment/order?cid=TC0ONETIME&tid=undefined’,
data: ‘{“headers”:{“Authorization”:“KakaoAK 99…”,“Content-Type”:“application/x-www-form-urlencoded”}}’
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: ‘’,
finished: true,
_headerSent: true,
_closed: false,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: ‘kapi.kakao.com’,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: ‘kapi.kakao.com’,
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: ‘’,
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *1],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 786,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object],
[Symbol(RequestTimeout)]: undefined
},
_header: ‘POST /v1/payment/order?cid=TC0ONETIME&tid=undefined HTTP/1.1\r\n’ +
‘Accept: application/json, text/plain, /\r\n’ +
‘Content-Type: application/json\r\n’ +
‘User-Agent: axios/1.3.3\r\n’ +
‘Content-Length: 123\r\n’ +
‘Accept-Encoding: gzip, compress, deflate, br\r\n’ +
‘Host: kapi.kakao.com\r\n’ +
‘Connection: close\r\n’ +
‘\r\n’,
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: ‘https:’,
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype],
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: ‘lifo’,
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: ‘POST’,
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: ‘/v1/payment/order?cid=TC0ONETIME&tid=undefined’,
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: ‘1.1’,
complete: true,
rawHeaders: [Array],
rawTrailers: [],
aborted: false,
upgrade: false,
url: ‘’,
method: null,
statusCode: 401,
statusMessage: ‘Unauthorized’,
client: [TLSSocket],
_consuming: false,
_dumped: false,
req: [Circular *1],
responseUrl: ‘https://kapi.kakao.com/v1/payment/order?cid=TC0ONETIME&tid=undefined’,
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 20,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0,
[Symbol(RequestTimeout)]: undefined
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: ‘kapi.kakao.com’,
protocol: ‘https:’,
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 123,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular 1],
_currentUrl: ‘https://kapi.kakao.com/v1/payment/order?cid=TC0ONETIME&tid=undefined’,
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
‘content-type’: [Array],
‘user-agent’: [Array],
‘content-length’: [Array],
‘accept-encoding’: [Array],
host: [Array]
}
},
response: {
status: 401,
statusText: ‘Unauthorized’,
headers: AxiosHeaders {
date: ‘Sun, 05 Mar 2023 19:11:08 GMT’,
server: ‘Apache’,
‘access-control-allow-origin’: '’,
‘access-control-allow-methods’: ‘GET, POST, PUT, DELETE, OPTIONS’,
‘access-control-allow-headers’: ‘Content-Type,X-Requested-With,Accept,Authorization,Origin,KA,Cache-Control,Pragma’,
‘x-request-id’: ‘d4add077-05c2-497d-abde-1bcac6207c31’,
‘www-authenticate’: ‘error=invalid_token’,
‘content-type’: ‘application/json;charset=UTF-8’,
‘content-length’: ‘59’,
connection: ‘close’
},
config: {
transitional: [Object],
adapter: [Array],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: ‘XSRF-TOKEN’,
xsrfHeaderName: ‘X-XSRF-TOKEN’,
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [AxiosHeaders],
method: ‘post’,
url: ‘https://kapi.kakao.com/v1/payment/order?cid=TC0ONETIME&tid=undefined’,
data: ‘{“headers”:{“Authorization”:“KakaoAK 99…”,“Content-Type”:“application/x-www-form-urlencoded”}}’
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: ‘’,
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: ‘POST /v1/payment/order?cid=TC0ONETIME&tid=undefined HTTP/1.1\r\n’ +
‘Accept: application/json, text/plain, /\r\n’ +
‘Content-Type: application/json\r\n’ +
‘User-Agent: axios/1.3.3\r\n’ +
‘Content-Length: 123\r\n’ +
‘Accept-Encoding: gzip, compress, deflate, br\r\n’ +
‘Host: kapi.kakao.com\r\n’ +
‘Connection: close\r\n’ +
‘\r\n’,
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: ‘POST’,
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: ‘/v1/payment/order?cid=TC0ONETIME&tid=undefined’,
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: ‘kapi.kakao.com’,
protocol: ‘https:’,
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
data: { msg: ‘need more information to authenticate’, code: -401 }
}
}
D:\trip\server\node_modules\express\lib\response.js:1123
: JSON.stringify(value);
^
TypeError: Converting circular structure to JSON
–> starting at object with constructor ‘ClientRequest’
| property ‘socket’ -> object with constructor ‘TLSSocket’
— property ‘_httpMessage’ closes the circle
at JSON.stringify ()
at stringify (D:\trip\server\node_modules\express\lib\response.js:1123:12)
at ServerResponse.json (D:\trip\server\node_modules\express\lib\response.js:260:14)
at ServerResponse.send (D:\trip\server\node_modules\express\lib\response.js:158:21)
at D:\trip\server\app.js:343:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)