<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Cybersource refund getting Not Authorized /401 in cybersource APIs</title>
    <link>https://community.developer.cybersource.com/t5/cybersource-APIs/Cybersource-refund-getting-Not-Authorized-401/m-p/95497#M4293</link>
    <description>&lt;P&gt;I am integrating CyberSource Payment Gateway using JAVASCRIPT. The Payment part is working and going through, However I am stuck at refunds. Always getting not authorized error. The API keys are correct. I have checked multiple times.&lt;/P&gt;&lt;P&gt;Note: I am using CyberSource's Secure Acceptance Hosted Checkout for Payment and for Refund, REST API endpoint, Location - Middle East Region.&lt;/P&gt;&lt;P&gt;From successful Payment Response I have saved the following transaction reference to my DB to initiate a refund - auth_trans_ref_no &amp;amp; auth_reconciliation_reference_number. In the below given code I am using auth_trans_ref_no. Tried both though&lt;/P&gt;&lt;P&gt;This is how I process a refund Request&lt;/P&gt;&lt;P&gt;after Extracting Booking details from DB under ticket&lt;/P&gt;&lt;P&gt;const refundEndpoint = `&lt;A href="https://api.cybersource.com/pts/v2/payments/${ticket.cybersourceConfirmationId}/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/${ticket.cybersourceConfirmationId}/refunds&lt;/A&gt;`;&lt;/P&gt;&lt;P&gt;const refundPayload = {&lt;BR /&gt;clientReferenceInformation: {&lt;BR /&gt;code: ticket.transactionId,&lt;BR /&gt;},&lt;BR /&gt;orderInformation: {&lt;BR /&gt;amountDetails: {&lt;BR /&gt;totalAmount: Number(refundAmount).toFixed(2),&lt;BR /&gt;currency: "QAR",&lt;BR /&gt;},&lt;BR /&gt;},&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const payloadString = JSON.stringify(refundPayload);&lt;/P&gt;&lt;P&gt;const digest =&lt;BR /&gt;"SHA-256=" +&lt;BR /&gt;crypto&lt;BR /&gt;.createHash("sha256")&lt;BR /&gt;.update(payloadString)&lt;BR /&gt;.digest("base64");&lt;/P&gt;&lt;P&gt;const vCDate = new Date().toUTCString();&lt;/P&gt;&lt;P&gt;const host = "api.cybersource.com";&lt;BR /&gt;const requestTarget = `post /pts/v2/payments/${ticket.cybersourceConfirmationId}/refunds`;&lt;/P&gt;&lt;P&gt;const vCMerchantId = process.env.CYBERSOURCE_MERCHANT_ID;&lt;BR /&gt;const keyId = process.env.CYBERSOURCE_SHARED_API_KEY_ID;&lt;BR /&gt;const secretKey = process.env.CYBERSOURCE_SHARED_API_SECRET;&lt;/P&gt;&lt;P&gt;const signingString =&lt;BR /&gt;`host: ${host}\n` +&lt;BR /&gt;`date: ${vCDate}\n` +&lt;BR /&gt;`(request-target): ${requestTarget}\n` +&lt;BR /&gt;`digest: ${digest}\n` +&lt;BR /&gt;`v-c-merchant-id: ${vCMerchantId}`;&lt;/P&gt;&lt;P&gt;const computedSignature = crypto&lt;BR /&gt;.createHmac("sha256", secretKey)&lt;BR /&gt;.update(signingString)&lt;BR /&gt;.digest("base64");&lt;/P&gt;&lt;P&gt;const signatureHeader = `keyid="${keyId}", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="${computedSignature}"`;&lt;/P&gt;&lt;P&gt;const headers = {&lt;BR /&gt;host,&lt;BR /&gt;signature: signatureHeader,&lt;BR /&gt;digest,&lt;BR /&gt;"v-c-merchant-id": vCMerchantId,&lt;BR /&gt;date: vCDate,&lt;BR /&gt;"Content-Type": "application/json",&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt;const response = await axios.post(refundEndpoint, refundPayload, { headers });&lt;BR /&gt;//If true&lt;BR /&gt;} else {&lt;BR /&gt;//If False&lt;BR /&gt;} catch (error) {&lt;BR /&gt;//If Error&lt;BR /&gt;}&lt;BR /&gt;This is the Link to CyberSource Docs&lt;/P&gt;&lt;P&gt;Processor - Asia/Middle East and Africa Gateway API- Rest API&lt;/P&gt;&lt;P&gt;I have tried multiple formats to solve this.&lt;/P&gt;&lt;P&gt;Complete Response I am getting as requested in comments&lt;/P&gt;&lt;P&gt;AxiosError: Request failed with status code 401&lt;BR /&gt;at settle (/home/ubuntu/code/dohabus_backend/node_modules/axios/dist/node/axios.cjs:2031:12)&lt;BR /&gt;at IncomingMessage.handleStreamEnd (/home/ubuntu/code/dohabus_backend/node_modules/axios/dist/node/axios.cjs:3148:11)&lt;BR /&gt;at IncomingMessage.emit (node:events:529:35)&lt;BR /&gt;at endReadableNT (node:internal/streams/readable:1400:12)&lt;BR /&gt;at process.processTicksAndRejections (node:internal/process/task_queues:82:21)&lt;BR /&gt;at Axios.request (/home/ubuntu/code/dohabus_backend/node_modules/axios/dist/node/axios.cjs:4258:41)&lt;BR /&gt;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)&lt;BR /&gt;at async /home/ubuntu/code/dohabus_backend/src/controllers/refundController.js:211:24 {&lt;BR /&gt;code: 'ERR_BAD_REQUEST',&lt;BR /&gt;config: {&lt;BR /&gt;transitional: {&lt;BR /&gt;silentJSONParsing: true,&lt;BR /&gt;forcedJSONParsing: true,&lt;BR /&gt;clarifyTimeoutError: false&lt;BR /&gt;},&lt;BR /&gt;adapter: [ 'xhr', 'http', 'fetch' ],&lt;BR /&gt;transformRequest: [ [Function: transformRequest] ],&lt;BR /&gt;transformResponse: [ [Function: transformResponse] ],&lt;BR /&gt;timeout: 0,&lt;BR /&gt;xsrfCookieName: 'XSRF-TOKEN',&lt;BR /&gt;xsrfHeaderName: 'X-XSRF-TOKEN',&lt;BR /&gt;maxContentLength: -1,&lt;BR /&gt;maxBodyLength: -1,&lt;BR /&gt;env: { FormData: [Function [FormData]], Blob: [class Blob] },&lt;BR /&gt;validateStatus: [Function: validateStatus],&lt;BR /&gt;headers: Object [AxiosHeaders] {&lt;BR /&gt;Accept: 'application/json, text/plain, */*',&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;host: 'api.cybersource.com',&lt;BR /&gt;signature: 'keyid="********-****-****-****-************", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="z5jyXi7mp3RJyZ0j74tFZuSsJWrShjeq0EK31/aZRCg="',&lt;BR /&gt;digest: 'SHA-256=kp6YNoxNHKMW1Tzh73pqezAZ70v+QvTolYs5cNj5tGY=',&lt;BR /&gt;'v-c-merchant-id': '*******',&lt;BR /&gt;date: 'Mon, 24 Mar 2025 11:34:28 GMT',&lt;BR /&gt;'User-Agent': 'axios/1.8.3',&lt;BR /&gt;'Content-Length': '158',&lt;BR /&gt;'Accept-Encoding': 'gzip, compress, deflate, br'&lt;BR /&gt;},&lt;BR /&gt;method: 'post',&lt;BR /&gt;url: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;data: '{"clientReferenceInformation":{"code":"5e8798a4-cd10-49d8-815e-369792c96515"},"orderInformation":{"amountDetails":{"totalAmount":"1300.00","currency":"QAR"}}}',&lt;BR /&gt;allowAbsoluteUrls: true&lt;BR /&gt;},&lt;BR /&gt;request: &amp;lt;ref *1&amp;gt; ClientRequest {&lt;BR /&gt;_events: [Object: null prototype] {&lt;BR /&gt;abort: [Function (anonymous)],&lt;BR /&gt;aborted: [Function (anonymous)],&lt;BR /&gt;connect: [Function (anonymous)],&lt;BR /&gt;error: [Function (anonymous)],&lt;BR /&gt;socket: [Function (anonymous)],&lt;BR /&gt;timeout: [Function (anonymous)],&lt;BR /&gt;finish: [Function: requestOnFinish]&lt;BR /&gt;},&lt;BR /&gt;_eventsCount: 7,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;outputData: [],&lt;BR /&gt;outputSize: 0,&lt;BR /&gt;writable: true,&lt;BR /&gt;destroyed: false,&lt;BR /&gt;_last: true,&lt;BR /&gt;chunkedEncoding: false,&lt;BR /&gt;shouldKeepAlive: false,&lt;BR /&gt;maxRequestsOnConnectionReached: false,&lt;BR /&gt;_defaultKeepAlive: true,&lt;BR /&gt;useChunkedEncodingByDefault: true,&lt;BR /&gt;sendDate: false,&lt;BR /&gt;_removedConnection: false,&lt;BR /&gt;_removedContLen: false,&lt;BR /&gt;_removedTE: false,&lt;BR /&gt;strictContentLength: false,&lt;BR /&gt;_contentLength: '158',&lt;BR /&gt;_hasBody: true,&lt;BR /&gt;_trailer: '',&lt;BR /&gt;finished: true,&lt;BR /&gt;_headerSent: true,&lt;BR /&gt;_closed: false,&lt;BR /&gt;socket: TLSSocket {&lt;BR /&gt;_tlsOptions: [Object],&lt;BR /&gt;_secureEstablished: true,&lt;BR /&gt;_securePending: false,&lt;BR /&gt;_newSessionPending: false,&lt;BR /&gt;_controlReleased: true,&lt;BR /&gt;secureConnecting: false,&lt;BR /&gt;_SNICallback: null,&lt;BR /&gt;servername: 'api.cybersource.com',&lt;BR /&gt;alpnProtocol: false,&lt;BR /&gt;authorized: true,&lt;BR /&gt;authorizationError: null,&lt;BR /&gt;encrypted: true,&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 10,&lt;BR /&gt;connecting: false,&lt;BR /&gt;_hadError: false,&lt;BR /&gt;_parent: null,&lt;BR /&gt;_host: 'api.cybersource.com',&lt;BR /&gt;_closeAfterHandlingError: false,&lt;BR /&gt;_readableState: [ReadableState],&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;_writableState: [WritableState],&lt;BR /&gt;allowHalfOpen: false,&lt;BR /&gt;_sockname: null,&lt;BR /&gt;_pendingData: null,&lt;BR /&gt;_pendingEncoding: '',&lt;BR /&gt;server: undefined,&lt;BR /&gt;_server: null,&lt;BR /&gt;ssl: [TLSWrap],&lt;BR /&gt;_requestCert: true,&lt;BR /&gt;_rejectUnauthorized: true,&lt;BR /&gt;parser: null,&lt;BR /&gt;_httpMessage: [Circular *1],&lt;BR /&gt;[Symbol(alpncallback)]: null,&lt;BR /&gt;[Symbol(res)]: [TLSWrap],&lt;BR /&gt;[Symbol(verified)]: true,&lt;BR /&gt;[Symbol(pendingSession)]: null,&lt;BR /&gt;[Symbol(async_id_symbol)]: 881,&lt;BR /&gt;[Symbol(kHandle)]: [TLSWrap],&lt;BR /&gt;[Symbol(lastWriteQueueSize)]: 0,&lt;BR /&gt;[Symbol(timeout)]: null,&lt;BR /&gt;[Symbol(kBuffer)]: null,&lt;BR /&gt;[Symbol(kBufferCb)]: null,&lt;BR /&gt;[Symbol(kBufferGen)]: null,&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kSetNoDelay)]: false,&lt;BR /&gt;[Symbol(kSetKeepAlive)]: true,&lt;BR /&gt;[Symbol(kSetKeepAliveInitialDelay)]: 60,&lt;BR /&gt;[Symbol(kBytesRead)]: 0,&lt;BR /&gt;[Symbol(kBytesWritten)]: 0,&lt;BR /&gt;[Symbol(connect-options)]: [Object]&lt;BR /&gt;},&lt;BR /&gt;_header: 'POST /pts/v2/payments/7419781136366848104258/refunds HTTP/1.1\r\n' +&lt;BR /&gt;'Accept: application/json, text/plain, */*\r\n' +&lt;BR /&gt;'Content-Type: application/json\r\n' +&lt;BR /&gt;'host: api.cybersource.com\r\n' +&lt;BR /&gt;'signature: keyid="********-****-****-****-************", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="z5jyXi7mp3RJyZ0j74tFZuSsJWrShjeq0EK31/aZRCg="\r\n' +&lt;BR /&gt;'digest: SHA-256=kp6YNoxNHKMW1Tzh73pqezAZ70v+QvTolYs5cNj5tGY=\r\n' +&lt;BR /&gt;'v-c-merchant-id: *******\r\n' +&lt;BR /&gt;'date: Mon, 24 Mar 2025 11:34:28 GMT\r\n' +&lt;BR /&gt;'User-Agent: axios/1.8.3\r\n' +&lt;BR /&gt;'Content-Length: 158\r\n' +&lt;BR /&gt;'Accept-Encoding: gzip, compress, deflate, br\r\n' +&lt;BR /&gt;'Connection: close\r\n' +&lt;BR /&gt;'\r\n',&lt;BR /&gt;_keepAliveTimeout: 0,&lt;BR /&gt;_onPendingData: [Function: nop],&lt;BR /&gt;agent: Agent {&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 2,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;defaultPort: 443,&lt;BR /&gt;protocol: 'https:',&lt;BR /&gt;options: [Object: null prototype],&lt;BR /&gt;requests: [Object: null prototype] {},&lt;BR /&gt;sockets: [Object: null prototype],&lt;BR /&gt;freeSockets: [Object: null prototype] {},&lt;BR /&gt;keepAliveMsecs: 1000,&lt;BR /&gt;keepAlive: false,&lt;BR /&gt;maxSockets: Infinity,&lt;BR /&gt;maxFreeSockets: 256,&lt;BR /&gt;scheduling: 'lifo',&lt;BR /&gt;maxTotalSockets: Infinity,&lt;BR /&gt;totalSocketCount: 1,&lt;BR /&gt;maxCachedSessions: 100,&lt;BR /&gt;_sessionCache: [Object],&lt;BR /&gt;[Symbol(kCapture)]: false&lt;BR /&gt;},&lt;BR /&gt;socketPath: undefined,&lt;BR /&gt;method: 'POST',&lt;BR /&gt;maxHeaderSize: undefined,&lt;BR /&gt;insecureHTTPParser: undefined,&lt;BR /&gt;joinDuplicateHeaders: undefined,&lt;BR /&gt;path: '/pts/v2/payments/7419781136366848104258/refunds',&lt;BR /&gt;_ended: true,&lt;BR /&gt;res: IncomingMessage {&lt;BR /&gt;_readableState: [ReadableState],&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 4,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;socket: [TLSSocket],&lt;BR /&gt;httpVersionMajor: 1,&lt;BR /&gt;httpVersionMinor: 1,&lt;BR /&gt;httpVersion: '1.1',&lt;BR /&gt;complete: true,&lt;BR /&gt;rawHeaders: [Array],&lt;BR /&gt;rawTrailers: [],&lt;BR /&gt;joinDuplicateHeaders: undefined,&lt;BR /&gt;aborted: false,&lt;BR /&gt;upgrade: false,&lt;BR /&gt;url: '',&lt;BR /&gt;method: null,&lt;BR /&gt;statusCode: 401,&lt;BR /&gt;statusMessage: 'Unauthorized',&lt;BR /&gt;client: [TLSSocket],&lt;BR /&gt;_consuming: false,&lt;BR /&gt;_dumped: false,&lt;BR /&gt;req: [Circular *1],&lt;BR /&gt;responseUrl: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;redirects: [],&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kHeaders)]: [Object],&lt;BR /&gt;[Symbol(kHeadersCount)]: 16,&lt;BR /&gt;[Symbol(kTrailers)]: null,&lt;BR /&gt;[Symbol(kTrailersCount)]: 0&lt;BR /&gt;},&lt;BR /&gt;aborted: false,&lt;BR /&gt;timeoutCb: null,&lt;BR /&gt;upgradeOrConnect: false,&lt;BR /&gt;parser: null,&lt;BR /&gt;maxHeadersCount: null,&lt;BR /&gt;reusedSocket: false,&lt;BR /&gt;host: 'api.cybersource.com',&lt;BR /&gt;protocol: 'https:',&lt;BR /&gt;_redirectable: Writable {&lt;BR /&gt;_writableState: [WritableState],&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 3,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;_options: [Object],&lt;BR /&gt;_ended: true,&lt;BR /&gt;_ending: true,&lt;BR /&gt;_redirectCount: 0,&lt;BR /&gt;_redirects: [],&lt;BR /&gt;_requestBodyLength: 158,&lt;BR /&gt;_requestBodyBuffers: [],&lt;BR /&gt;_onNativeResponse: [Function (anonymous)],&lt;BR /&gt;_currentRequest: [Circular *1],&lt;BR /&gt;_currentUrl: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;[Symbol(kCapture)]: false&lt;BR /&gt;},&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kBytesWritten)]: 0,&lt;BR /&gt;[Symbol(kNeedDrain)]: false,&lt;BR /&gt;[Symbol(corked)]: 0,&lt;BR /&gt;[Symbol(kOutHeaders)]: [Object: null prototype] {&lt;BR /&gt;accept: [Array],&lt;BR /&gt;'content-type': [Array],&lt;BR /&gt;host: [Array],&lt;BR /&gt;signature: [Array],&lt;BR /&gt;digest: [Array],&lt;BR /&gt;'v-c-merchant-id': [Array],&lt;BR /&gt;date: [Array],&lt;BR /&gt;'user-agent': [Array],&lt;BR /&gt;'content-length': [Array],&lt;BR /&gt;'accept-encoding': [Array]&lt;BR /&gt;},&lt;BR /&gt;[Symbol(errored)]: null,&lt;BR /&gt;[Symbol(kHighWaterMark)]: 16384,&lt;BR /&gt;[Symbol(kRejectNonStandardBodyWrites)]: false,&lt;BR /&gt;[Symbol(kUniqueHeaders)]: null&lt;BR /&gt;},&lt;BR /&gt;response: {&lt;BR /&gt;status: 401,&lt;BR /&gt;statusText: 'Unauthorized',&lt;BR /&gt;headers: Object [AxiosHeaders] {&lt;BR /&gt;'strict-transport-security': 'max-age=31536000',&lt;BR /&gt;'v-c-correlation-id': 'c3af5537-1a92-4d3b-b93e-94a85a887aad',&lt;BR /&gt;'x-requestid': '7428160693236073104986',&lt;BR /&gt;'content-type': 'application/json',&lt;BR /&gt;'v-c-response-time': '1742816069',&lt;BR /&gt;'content-length': '45',&lt;BR /&gt;'x-opnet-transaction-trace': 'e199f8aa-0841-43d6-a231-3bba5ad438a6',&lt;BR /&gt;connection: 'close'&lt;BR /&gt;},&lt;BR /&gt;config: {&lt;BR /&gt;transitional: [Object],&lt;BR /&gt;adapter: [Array],&lt;BR /&gt;transformRequest: [Array],&lt;BR /&gt;transformResponse: [Array],&lt;BR /&gt;timeout: 0,&lt;BR /&gt;xsrfCookieName: 'XSRF-TOKEN',&lt;BR /&gt;xsrfHeaderName: 'X-XSRF-TOKEN',&lt;BR /&gt;maxContentLength: -1,&lt;BR /&gt;maxBodyLength: -1,&lt;BR /&gt;env: [Object],&lt;BR /&gt;validateStatus: [Function: validateStatus],&lt;BR /&gt;headers: [Object [AxiosHeaders]],&lt;BR /&gt;method: 'post',&lt;BR /&gt;url: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;data: '{"clientReferenceInformation":{"code":"5e8798a4-cd10-49d8-815e-369792c96515"},"orderInformation":{"amountDetails":{"totalAmount":"1300.00","currency":"QAR"}}}',&lt;BR /&gt;allowAbsoluteUrls: true&lt;BR /&gt;},&lt;BR /&gt;request: &amp;lt;ref *1&amp;gt; ClientRequest {&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 7,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;outputData: [],&lt;BR /&gt;outputSize: 0,&lt;BR /&gt;writable: true,&lt;BR /&gt;destroyed: false,&lt;BR /&gt;_last: true,&lt;BR /&gt;chunkedEncoding: false,&lt;BR /&gt;shouldKeepAlive: false,&lt;BR /&gt;maxRequestsOnConnectionReached: false,&lt;BR /&gt;_defaultKeepAlive: true,&lt;BR /&gt;useChunkedEncodingByDefault: true,&lt;BR /&gt;sendDate: false,&lt;BR /&gt;_removedConnection: false,&lt;BR /&gt;_removedContLen: false,&lt;BR /&gt;_removedTE: false,&lt;BR /&gt;strictContentLength: false,&lt;BR /&gt;_contentLength: '158',&lt;BR /&gt;_hasBody: true,&lt;BR /&gt;_trailer: '',&lt;BR /&gt;finished: true,&lt;BR /&gt;_headerSent: true,&lt;BR /&gt;_closed: false,&lt;BR /&gt;socket: [TLSSocket],&lt;BR /&gt;_header: 'POST /pts/v2/payments/7419781136366848104258/refunds HTTP/1.1\r\n' +&lt;BR /&gt;'Accept: application/json, text/plain, */*\r\n' +&lt;BR /&gt;'Content-Type: application/json\r\n' +&lt;BR /&gt;'host: api.cybersource.com\r\n' +&lt;BR /&gt;'signature: keyid="********-****-****-****-************", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="z5jyXi7mp3RJyZ0j74tFZuSsJWrShjeq0EK31/aZRCg="\r\n' +&lt;BR /&gt;'digest: SHA-256=kp6YNoxNHKMW1Tzh73pqezAZ70v+QvTolYs5cNj5tGY=\r\n' +&lt;BR /&gt;'v-c-merchant-id: *******\r\n' +&lt;BR /&gt;'date: Mon, 24 Mar 2025 11:34:28 GMT\r\n' +&lt;BR /&gt;'User-Agent: axios/1.8.3\r\n' +&lt;BR /&gt;'Content-Length: 158\r\n' +&lt;BR /&gt;'Accept-Encoding: gzip, compress, deflate, br\r\n' +&lt;BR /&gt;'Connection: close\r\n' +&lt;BR /&gt;'\r\n',&lt;BR /&gt;_keepAliveTimeout: 0,&lt;BR /&gt;_onPendingData: [Function: nop],&lt;BR /&gt;agent: [Agent],&lt;BR /&gt;socketPath: undefined,&lt;BR /&gt;method: 'POST',&lt;BR /&gt;maxHeaderSize: undefined,&lt;BR /&gt;insecureHTTPParser: undefined,&lt;BR /&gt;joinDuplicateHeaders: undefined,&lt;BR /&gt;path: '/pts/v2/payments/7419781136366848104258/refunds',&lt;BR /&gt;_ended: true,&lt;BR /&gt;res: [IncomingMessage],&lt;BR /&gt;aborted: false,&lt;BR /&gt;timeoutCb: null,&lt;BR /&gt;upgradeOrConnect: false,&lt;BR /&gt;parser: null,&lt;BR /&gt;maxHeadersCount: null,&lt;BR /&gt;reusedSocket: false,&lt;BR /&gt;host: 'api.cybersource.com',&lt;BR /&gt;protocol: 'https:',&lt;BR /&gt;_redirectable: [Writable],&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kBytesWritten)]: 0,&lt;BR /&gt;[Symbol(kNeedDrain)]: false,&lt;BR /&gt;[Symbol(corked)]: 0,&lt;BR /&gt;[Symbol(kOutHeaders)]: [Object: null prototype],&lt;BR /&gt;[Symbol(errored)]: null,&lt;BR /&gt;[Symbol(kHighWaterMark)]: 16384,&lt;BR /&gt;[Symbol(kRejectNonStandardBodyWrites)]: false,&lt;BR /&gt;[Symbol(kUniqueHeaders)]: null&lt;BR /&gt;},&lt;BR /&gt;data: { response: [Object] }&lt;BR /&gt;},&lt;BR /&gt;status: 401&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jul 2026 07:09:25 GMT</pubDate>
    <dc:creator>satisfiedshoes</dc:creator>
    <dc:date>2026-07-07T07:09:25Z</dc:date>
    <item>
      <title>Cybersource refund getting Not Authorized /401</title>
      <link>https://community.developer.cybersource.com/t5/cybersource-APIs/Cybersource-refund-getting-Not-Authorized-401/m-p/95497#M4293</link>
      <description>&lt;P&gt;I am integrating CyberSource Payment Gateway using JAVASCRIPT. The Payment part is working and going through, However I am stuck at refunds. Always getting not authorized error. The API keys are correct. I have checked multiple times.&lt;/P&gt;&lt;P&gt;Note: I am using CyberSource's Secure Acceptance Hosted Checkout for Payment and for Refund, REST API endpoint, Location - Middle East Region.&lt;/P&gt;&lt;P&gt;From successful Payment Response I have saved the following transaction reference to my DB to initiate a refund - auth_trans_ref_no &amp;amp; auth_reconciliation_reference_number. In the below given code I am using auth_trans_ref_no. Tried both though&lt;/P&gt;&lt;P&gt;This is how I process a refund Request&lt;/P&gt;&lt;P&gt;after Extracting Booking details from DB under ticket&lt;/P&gt;&lt;P&gt;const refundEndpoint = `&lt;A href="https://api.cybersource.com/pts/v2/payments/${ticket.cybersourceConfirmationId}/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/${ticket.cybersourceConfirmationId}/refunds&lt;/A&gt;`;&lt;/P&gt;&lt;P&gt;const refundPayload = {&lt;BR /&gt;clientReferenceInformation: {&lt;BR /&gt;code: ticket.transactionId,&lt;BR /&gt;},&lt;BR /&gt;orderInformation: {&lt;BR /&gt;amountDetails: {&lt;BR /&gt;totalAmount: Number(refundAmount).toFixed(2),&lt;BR /&gt;currency: "QAR",&lt;BR /&gt;},&lt;BR /&gt;},&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const payloadString = JSON.stringify(refundPayload);&lt;/P&gt;&lt;P&gt;const digest =&lt;BR /&gt;"SHA-256=" +&lt;BR /&gt;crypto&lt;BR /&gt;.createHash("sha256")&lt;BR /&gt;.update(payloadString)&lt;BR /&gt;.digest("base64");&lt;/P&gt;&lt;P&gt;const vCDate = new Date().toUTCString();&lt;/P&gt;&lt;P&gt;const host = "api.cybersource.com";&lt;BR /&gt;const requestTarget = `post /pts/v2/payments/${ticket.cybersourceConfirmationId}/refunds`;&lt;/P&gt;&lt;P&gt;const vCMerchantId = process.env.CYBERSOURCE_MERCHANT_ID;&lt;BR /&gt;const keyId = process.env.CYBERSOURCE_SHARED_API_KEY_ID;&lt;BR /&gt;const secretKey = process.env.CYBERSOURCE_SHARED_API_SECRET;&lt;/P&gt;&lt;P&gt;const signingString =&lt;BR /&gt;`host: ${host}\n` +&lt;BR /&gt;`date: ${vCDate}\n` +&lt;BR /&gt;`(request-target): ${requestTarget}\n` +&lt;BR /&gt;`digest: ${digest}\n` +&lt;BR /&gt;`v-c-merchant-id: ${vCMerchantId}`;&lt;/P&gt;&lt;P&gt;const computedSignature = crypto&lt;BR /&gt;.createHmac("sha256", secretKey)&lt;BR /&gt;.update(signingString)&lt;BR /&gt;.digest("base64");&lt;/P&gt;&lt;P&gt;const signatureHeader = `keyid="${keyId}", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="${computedSignature}"`;&lt;/P&gt;&lt;P&gt;const headers = {&lt;BR /&gt;host,&lt;BR /&gt;signature: signatureHeader,&lt;BR /&gt;digest,&lt;BR /&gt;"v-c-merchant-id": vCMerchantId,&lt;BR /&gt;date: vCDate,&lt;BR /&gt;"Content-Type": "application/json",&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt;const response = await axios.post(refundEndpoint, refundPayload, { headers });&lt;BR /&gt;//If true&lt;BR /&gt;} else {&lt;BR /&gt;//If False&lt;BR /&gt;} catch (error) {&lt;BR /&gt;//If Error&lt;BR /&gt;}&lt;BR /&gt;This is the Link to CyberSource Docs&lt;/P&gt;&lt;P&gt;Processor - Asia/Middle East and Africa Gateway API- Rest API&lt;/P&gt;&lt;P&gt;I have tried multiple formats to solve this.&lt;/P&gt;&lt;P&gt;Complete Response I am getting as requested in comments&lt;/P&gt;&lt;P&gt;AxiosError: Request failed with status code 401&lt;BR /&gt;at settle (/home/ubuntu/code/dohabus_backend/node_modules/axios/dist/node/axios.cjs:2031:12)&lt;BR /&gt;at IncomingMessage.handleStreamEnd (/home/ubuntu/code/dohabus_backend/node_modules/axios/dist/node/axios.cjs:3148:11)&lt;BR /&gt;at IncomingMessage.emit (node:events:529:35)&lt;BR /&gt;at endReadableNT (node:internal/streams/readable:1400:12)&lt;BR /&gt;at process.processTicksAndRejections (node:internal/process/task_queues:82:21)&lt;BR /&gt;at Axios.request (/home/ubuntu/code/dohabus_backend/node_modules/axios/dist/node/axios.cjs:4258:41)&lt;BR /&gt;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)&lt;BR /&gt;at async /home/ubuntu/code/dohabus_backend/src/controllers/refundController.js:211:24 {&lt;BR /&gt;code: 'ERR_BAD_REQUEST',&lt;BR /&gt;config: {&lt;BR /&gt;transitional: {&lt;BR /&gt;silentJSONParsing: true,&lt;BR /&gt;forcedJSONParsing: true,&lt;BR /&gt;clarifyTimeoutError: false&lt;BR /&gt;},&lt;BR /&gt;adapter: [ 'xhr', 'http', 'fetch' ],&lt;BR /&gt;transformRequest: [ [Function: transformRequest] ],&lt;BR /&gt;transformResponse: [ [Function: transformResponse] ],&lt;BR /&gt;timeout: 0,&lt;BR /&gt;xsrfCookieName: 'XSRF-TOKEN',&lt;BR /&gt;xsrfHeaderName: 'X-XSRF-TOKEN',&lt;BR /&gt;maxContentLength: -1,&lt;BR /&gt;maxBodyLength: -1,&lt;BR /&gt;env: { FormData: [Function [FormData]], Blob: [class Blob] },&lt;BR /&gt;validateStatus: [Function: validateStatus],&lt;BR /&gt;headers: Object [AxiosHeaders] {&lt;BR /&gt;Accept: 'application/json, text/plain, */*',&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;host: 'api.cybersource.com',&lt;BR /&gt;signature: 'keyid="********-****-****-****-************", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="z5jyXi7mp3RJyZ0j74tFZuSsJWrShjeq0EK31/aZRCg="',&lt;BR /&gt;digest: 'SHA-256=kp6YNoxNHKMW1Tzh73pqezAZ70v+QvTolYs5cNj5tGY=',&lt;BR /&gt;'v-c-merchant-id': '*******',&lt;BR /&gt;date: 'Mon, 24 Mar 2025 11:34:28 GMT',&lt;BR /&gt;'User-Agent': 'axios/1.8.3',&lt;BR /&gt;'Content-Length': '158',&lt;BR /&gt;'Accept-Encoding': 'gzip, compress, deflate, br'&lt;BR /&gt;},&lt;BR /&gt;method: 'post',&lt;BR /&gt;url: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;data: '{"clientReferenceInformation":{"code":"5e8798a4-cd10-49d8-815e-369792c96515"},"orderInformation":{"amountDetails":{"totalAmount":"1300.00","currency":"QAR"}}}',&lt;BR /&gt;allowAbsoluteUrls: true&lt;BR /&gt;},&lt;BR /&gt;request: &amp;lt;ref *1&amp;gt; ClientRequest {&lt;BR /&gt;_events: [Object: null prototype] {&lt;BR /&gt;abort: [Function (anonymous)],&lt;BR /&gt;aborted: [Function (anonymous)],&lt;BR /&gt;connect: [Function (anonymous)],&lt;BR /&gt;error: [Function (anonymous)],&lt;BR /&gt;socket: [Function (anonymous)],&lt;BR /&gt;timeout: [Function (anonymous)],&lt;BR /&gt;finish: [Function: requestOnFinish]&lt;BR /&gt;},&lt;BR /&gt;_eventsCount: 7,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;outputData: [],&lt;BR /&gt;outputSize: 0,&lt;BR /&gt;writable: true,&lt;BR /&gt;destroyed: false,&lt;BR /&gt;_last: true,&lt;BR /&gt;chunkedEncoding: false,&lt;BR /&gt;shouldKeepAlive: false,&lt;BR /&gt;maxRequestsOnConnectionReached: false,&lt;BR /&gt;_defaultKeepAlive: true,&lt;BR /&gt;useChunkedEncodingByDefault: true,&lt;BR /&gt;sendDate: false,&lt;BR /&gt;_removedConnection: false,&lt;BR /&gt;_removedContLen: false,&lt;BR /&gt;_removedTE: false,&lt;BR /&gt;strictContentLength: false,&lt;BR /&gt;_contentLength: '158',&lt;BR /&gt;_hasBody: true,&lt;BR /&gt;_trailer: '',&lt;BR /&gt;finished: true,&lt;BR /&gt;_headerSent: true,&lt;BR /&gt;_closed: false,&lt;BR /&gt;socket: TLSSocket {&lt;BR /&gt;_tlsOptions: [Object],&lt;BR /&gt;_secureEstablished: true,&lt;BR /&gt;_securePending: false,&lt;BR /&gt;_newSessionPending: false,&lt;BR /&gt;_controlReleased: true,&lt;BR /&gt;secureConnecting: false,&lt;BR /&gt;_SNICallback: null,&lt;BR /&gt;servername: 'api.cybersource.com',&lt;BR /&gt;alpnProtocol: false,&lt;BR /&gt;authorized: true,&lt;BR /&gt;authorizationError: null,&lt;BR /&gt;encrypted: true,&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 10,&lt;BR /&gt;connecting: false,&lt;BR /&gt;_hadError: false,&lt;BR /&gt;_parent: null,&lt;BR /&gt;_host: 'api.cybersource.com',&lt;BR /&gt;_closeAfterHandlingError: false,&lt;BR /&gt;_readableState: [ReadableState],&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;_writableState: [WritableState],&lt;BR /&gt;allowHalfOpen: false,&lt;BR /&gt;_sockname: null,&lt;BR /&gt;_pendingData: null,&lt;BR /&gt;_pendingEncoding: '',&lt;BR /&gt;server: undefined,&lt;BR /&gt;_server: null,&lt;BR /&gt;ssl: [TLSWrap],&lt;BR /&gt;_requestCert: true,&lt;BR /&gt;_rejectUnauthorized: true,&lt;BR /&gt;parser: null,&lt;BR /&gt;_httpMessage: [Circular *1],&lt;BR /&gt;[Symbol(alpncallback)]: null,&lt;BR /&gt;[Symbol(res)]: [TLSWrap],&lt;BR /&gt;[Symbol(verified)]: true,&lt;BR /&gt;[Symbol(pendingSession)]: null,&lt;BR /&gt;[Symbol(async_id_symbol)]: 881,&lt;BR /&gt;[Symbol(kHandle)]: [TLSWrap],&lt;BR /&gt;[Symbol(lastWriteQueueSize)]: 0,&lt;BR /&gt;[Symbol(timeout)]: null,&lt;BR /&gt;[Symbol(kBuffer)]: null,&lt;BR /&gt;[Symbol(kBufferCb)]: null,&lt;BR /&gt;[Symbol(kBufferGen)]: null,&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kSetNoDelay)]: false,&lt;BR /&gt;[Symbol(kSetKeepAlive)]: true,&lt;BR /&gt;[Symbol(kSetKeepAliveInitialDelay)]: 60,&lt;BR /&gt;[Symbol(kBytesRead)]: 0,&lt;BR /&gt;[Symbol(kBytesWritten)]: 0,&lt;BR /&gt;[Symbol(connect-options)]: [Object]&lt;BR /&gt;},&lt;BR /&gt;_header: 'POST /pts/v2/payments/7419781136366848104258/refunds HTTP/1.1\r\n' +&lt;BR /&gt;'Accept: application/json, text/plain, */*\r\n' +&lt;BR /&gt;'Content-Type: application/json\r\n' +&lt;BR /&gt;'host: api.cybersource.com\r\n' +&lt;BR /&gt;'signature: keyid="********-****-****-****-************", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="z5jyXi7mp3RJyZ0j74tFZuSsJWrShjeq0EK31/aZRCg="\r\n' +&lt;BR /&gt;'digest: SHA-256=kp6YNoxNHKMW1Tzh73pqezAZ70v+QvTolYs5cNj5tGY=\r\n' +&lt;BR /&gt;'v-c-merchant-id: *******\r\n' +&lt;BR /&gt;'date: Mon, 24 Mar 2025 11:34:28 GMT\r\n' +&lt;BR /&gt;'User-Agent: axios/1.8.3\r\n' +&lt;BR /&gt;'Content-Length: 158\r\n' +&lt;BR /&gt;'Accept-Encoding: gzip, compress, deflate, br\r\n' +&lt;BR /&gt;'Connection: close\r\n' +&lt;BR /&gt;'\r\n',&lt;BR /&gt;_keepAliveTimeout: 0,&lt;BR /&gt;_onPendingData: [Function: nop],&lt;BR /&gt;agent: Agent {&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 2,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;defaultPort: 443,&lt;BR /&gt;protocol: 'https:',&lt;BR /&gt;options: [Object: null prototype],&lt;BR /&gt;requests: [Object: null prototype] {},&lt;BR /&gt;sockets: [Object: null prototype],&lt;BR /&gt;freeSockets: [Object: null prototype] {},&lt;BR /&gt;keepAliveMsecs: 1000,&lt;BR /&gt;keepAlive: false,&lt;BR /&gt;maxSockets: Infinity,&lt;BR /&gt;maxFreeSockets: 256,&lt;BR /&gt;scheduling: 'lifo',&lt;BR /&gt;maxTotalSockets: Infinity,&lt;BR /&gt;totalSocketCount: 1,&lt;BR /&gt;maxCachedSessions: 100,&lt;BR /&gt;_sessionCache: [Object],&lt;BR /&gt;[Symbol(kCapture)]: false&lt;BR /&gt;},&lt;BR /&gt;socketPath: undefined,&lt;BR /&gt;method: 'POST',&lt;BR /&gt;maxHeaderSize: undefined,&lt;BR /&gt;insecureHTTPParser: undefined,&lt;BR /&gt;joinDuplicateHeaders: undefined,&lt;BR /&gt;path: '/pts/v2/payments/7419781136366848104258/refunds',&lt;BR /&gt;_ended: true,&lt;BR /&gt;res: IncomingMessage {&lt;BR /&gt;_readableState: [ReadableState],&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 4,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;socket: [TLSSocket],&lt;BR /&gt;httpVersionMajor: 1,&lt;BR /&gt;httpVersionMinor: 1,&lt;BR /&gt;httpVersion: '1.1',&lt;BR /&gt;complete: true,&lt;BR /&gt;rawHeaders: [Array],&lt;BR /&gt;rawTrailers: [],&lt;BR /&gt;joinDuplicateHeaders: undefined,&lt;BR /&gt;aborted: false,&lt;BR /&gt;upgrade: false,&lt;BR /&gt;url: '',&lt;BR /&gt;method: null,&lt;BR /&gt;statusCode: 401,&lt;BR /&gt;statusMessage: 'Unauthorized',&lt;BR /&gt;client: [TLSSocket],&lt;BR /&gt;_consuming: false,&lt;BR /&gt;_dumped: false,&lt;BR /&gt;req: [Circular *1],&lt;BR /&gt;responseUrl: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;redirects: [],&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kHeaders)]: [Object],&lt;BR /&gt;[Symbol(kHeadersCount)]: 16,&lt;BR /&gt;[Symbol(kTrailers)]: null,&lt;BR /&gt;[Symbol(kTrailersCount)]: 0&lt;BR /&gt;},&lt;BR /&gt;aborted: false,&lt;BR /&gt;timeoutCb: null,&lt;BR /&gt;upgradeOrConnect: false,&lt;BR /&gt;parser: null,&lt;BR /&gt;maxHeadersCount: null,&lt;BR /&gt;reusedSocket: false,&lt;BR /&gt;host: 'api.cybersource.com',&lt;BR /&gt;protocol: 'https:',&lt;BR /&gt;_redirectable: Writable {&lt;BR /&gt;_writableState: [WritableState],&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 3,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;_options: [Object],&lt;BR /&gt;_ended: true,&lt;BR /&gt;_ending: true,&lt;BR /&gt;_redirectCount: 0,&lt;BR /&gt;_redirects: [],&lt;BR /&gt;_requestBodyLength: 158,&lt;BR /&gt;_requestBodyBuffers: [],&lt;BR /&gt;_onNativeResponse: [Function (anonymous)],&lt;BR /&gt;_currentRequest: [Circular *1],&lt;BR /&gt;_currentUrl: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;[Symbol(kCapture)]: false&lt;BR /&gt;},&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kBytesWritten)]: 0,&lt;BR /&gt;[Symbol(kNeedDrain)]: false,&lt;BR /&gt;[Symbol(corked)]: 0,&lt;BR /&gt;[Symbol(kOutHeaders)]: [Object: null prototype] {&lt;BR /&gt;accept: [Array],&lt;BR /&gt;'content-type': [Array],&lt;BR /&gt;host: [Array],&lt;BR /&gt;signature: [Array],&lt;BR /&gt;digest: [Array],&lt;BR /&gt;'v-c-merchant-id': [Array],&lt;BR /&gt;date: [Array],&lt;BR /&gt;'user-agent': [Array],&lt;BR /&gt;'content-length': [Array],&lt;BR /&gt;'accept-encoding': [Array]&lt;BR /&gt;},&lt;BR /&gt;[Symbol(errored)]: null,&lt;BR /&gt;[Symbol(kHighWaterMark)]: 16384,&lt;BR /&gt;[Symbol(kRejectNonStandardBodyWrites)]: false,&lt;BR /&gt;[Symbol(kUniqueHeaders)]: null&lt;BR /&gt;},&lt;BR /&gt;response: {&lt;BR /&gt;status: 401,&lt;BR /&gt;statusText: 'Unauthorized',&lt;BR /&gt;headers: Object [AxiosHeaders] {&lt;BR /&gt;'strict-transport-security': 'max-age=31536000',&lt;BR /&gt;'v-c-correlation-id': 'c3af5537-1a92-4d3b-b93e-94a85a887aad',&lt;BR /&gt;'x-requestid': '7428160693236073104986',&lt;BR /&gt;'content-type': 'application/json',&lt;BR /&gt;'v-c-response-time': '1742816069',&lt;BR /&gt;'content-length': '45',&lt;BR /&gt;'x-opnet-transaction-trace': 'e199f8aa-0841-43d6-a231-3bba5ad438a6',&lt;BR /&gt;connection: 'close'&lt;BR /&gt;},&lt;BR /&gt;config: {&lt;BR /&gt;transitional: [Object],&lt;BR /&gt;adapter: [Array],&lt;BR /&gt;transformRequest: [Array],&lt;BR /&gt;transformResponse: [Array],&lt;BR /&gt;timeout: 0,&lt;BR /&gt;xsrfCookieName: 'XSRF-TOKEN',&lt;BR /&gt;xsrfHeaderName: 'X-XSRF-TOKEN',&lt;BR /&gt;maxContentLength: -1,&lt;BR /&gt;maxBodyLength: -1,&lt;BR /&gt;env: [Object],&lt;BR /&gt;validateStatus: [Function: validateStatus],&lt;BR /&gt;headers: [Object [AxiosHeaders]],&lt;BR /&gt;method: 'post',&lt;BR /&gt;url: '&lt;A href="https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds" target="_blank"&gt;https://api.cybersource.com/pts/v2/payments/7419781136366848104258/refunds&lt;/A&gt;',&lt;BR /&gt;data: '{"clientReferenceInformation":{"code":"5e8798a4-cd10-49d8-815e-369792c96515"},"orderInformation":{"amountDetails":{"totalAmount":"1300.00","currency":"QAR"}}}',&lt;BR /&gt;allowAbsoluteUrls: true&lt;BR /&gt;},&lt;BR /&gt;request: &amp;lt;ref *1&amp;gt; ClientRequest {&lt;BR /&gt;_events: [Object: null prototype],&lt;BR /&gt;_eventsCount: 7,&lt;BR /&gt;_maxListeners: undefined,&lt;BR /&gt;outputData: [],&lt;BR /&gt;outputSize: 0,&lt;BR /&gt;writable: true,&lt;BR /&gt;destroyed: false,&lt;BR /&gt;_last: true,&lt;BR /&gt;chunkedEncoding: false,&lt;BR /&gt;shouldKeepAlive: false,&lt;BR /&gt;maxRequestsOnConnectionReached: false,&lt;BR /&gt;_defaultKeepAlive: true,&lt;BR /&gt;useChunkedEncodingByDefault: true,&lt;BR /&gt;sendDate: false,&lt;BR /&gt;_removedConnection: false,&lt;BR /&gt;_removedContLen: false,&lt;BR /&gt;_removedTE: false,&lt;BR /&gt;strictContentLength: false,&lt;BR /&gt;_contentLength: '158',&lt;BR /&gt;_hasBody: true,&lt;BR /&gt;_trailer: '',&lt;BR /&gt;finished: true,&lt;BR /&gt;_headerSent: true,&lt;BR /&gt;_closed: false,&lt;BR /&gt;socket: [TLSSocket],&lt;BR /&gt;_header: 'POST /pts/v2/payments/7419781136366848104258/refunds HTTP/1.1\r\n' +&lt;BR /&gt;'Accept: application/json, text/plain, */*\r\n' +&lt;BR /&gt;'Content-Type: application/json\r\n' +&lt;BR /&gt;'host: api.cybersource.com\r\n' +&lt;BR /&gt;'signature: keyid="********-****-****-****-************", algorithm="HmacSHA256", headers="host date (request-target) digest v-c-merchant-id", signature="z5jyXi7mp3RJyZ0j74tFZuSsJWrShjeq0EK31/aZRCg="\r\n' +&lt;BR /&gt;'digest: SHA-256=kp6YNoxNHKMW1Tzh73pqezAZ70v+QvTolYs5cNj5tGY=\r\n' +&lt;BR /&gt;'v-c-merchant-id: *******\r\n' +&lt;BR /&gt;'date: Mon, 24 Mar 2025 11:34:28 GMT\r\n' +&lt;BR /&gt;'User-Agent: axios/1.8.3\r\n' +&lt;BR /&gt;'Content-Length: 158\r\n' +&lt;BR /&gt;'Accept-Encoding: gzip, compress, deflate, br\r\n' +&lt;BR /&gt;'Connection: close\r\n' +&lt;BR /&gt;'\r\n',&lt;BR /&gt;_keepAliveTimeout: 0,&lt;BR /&gt;_onPendingData: [Function: nop],&lt;BR /&gt;agent: [Agent],&lt;BR /&gt;socketPath: undefined,&lt;BR /&gt;method: 'POST',&lt;BR /&gt;maxHeaderSize: undefined,&lt;BR /&gt;insecureHTTPParser: undefined,&lt;BR /&gt;joinDuplicateHeaders: undefined,&lt;BR /&gt;path: '/pts/v2/payments/7419781136366848104258/refunds',&lt;BR /&gt;_ended: true,&lt;BR /&gt;res: [IncomingMessage],&lt;BR /&gt;aborted: false,&lt;BR /&gt;timeoutCb: null,&lt;BR /&gt;upgradeOrConnect: false,&lt;BR /&gt;parser: null,&lt;BR /&gt;maxHeadersCount: null,&lt;BR /&gt;reusedSocket: false,&lt;BR /&gt;host: 'api.cybersource.com',&lt;BR /&gt;protocol: 'https:',&lt;BR /&gt;_redirectable: [Writable],&lt;BR /&gt;[Symbol(kCapture)]: false,&lt;BR /&gt;[Symbol(kBytesWritten)]: 0,&lt;BR /&gt;[Symbol(kNeedDrain)]: false,&lt;BR /&gt;[Symbol(corked)]: 0,&lt;BR /&gt;[Symbol(kOutHeaders)]: [Object: null prototype],&lt;BR /&gt;[Symbol(errored)]: null,&lt;BR /&gt;[Symbol(kHighWaterMark)]: 16384,&lt;BR /&gt;[Symbol(kRejectNonStandardBodyWrites)]: false,&lt;BR /&gt;[Symbol(kUniqueHeaders)]: null&lt;BR /&gt;},&lt;BR /&gt;data: { response: [Object] }&lt;BR /&gt;},&lt;BR /&gt;status: 401&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2026 07:09:25 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/cybersource-APIs/Cybersource-refund-getting-Not-Authorized-401/m-p/95497#M4293</guid>
      <dc:creator>satisfiedshoes</dc:creator>
      <dc:date>2026-07-07T07:09:25Z</dc:date>
    </item>
  </channel>
</rss>

