Skip to content

Instantly share code, notes, and snippets.

View dimav-cf's full-sized avatar

Dima Vinogradov dimav-cf

View GitHub Profile
@dimav-cf
dimav-cf / postman-pre-request-script.js
Created May 15, 2026 13:11
Chargeflow postman pre-request script
const secretKey = pm.collectionVariables.get("apiSecretKey");
const method = pm.request.method.toUpperCase();
const fullUrl = pm.variables.replaceIn(pm.request.url.toString());
const url = new URL(fullUrl);
const path = url.pathname;
const body = pm.request.body?.raw || "";
const dataToSign = `${method}\n${path}\n${body}`;
const signature = CryptoJS.HmacSHA256(dataToSign, secretKey)