I have problems generating a signature - FIXED!

I am a newbie trying to get going with Rapyd. I cannot generate a signature that works and I have tried the samples and code in gitHub in NodeJS, Java and Dart and have had no luck. For example, the NodeJs version is attached:
private getRapydSignature(
request: any,
method: string,
urlPath: string
): string {
console.log(🍯🍯 getRapydSignature: ${method} ${request});

timestamp = (Math.floor(new Date().getTime() / 1000) - 10).toString();
salt = CryptoJS.lib.WordArray.random(12);

console.log("🍯🍯 ..... signature timestamp: " + timestamp);
console.log("🍯🍯 ..... signature salt: " + salt);

var body = "";
if (
  JSON.stringify(request) !== "{}" &&
  request !== "" &&
  typeof request !== "object"
) {
  body = JSON.stringify(JSON.parse(request));
}
console.log("🍯🍯 ..... signature body: " + body);

signature =
  method.toLowerCase() +
  urlPath +
  salt +
  timestamp +
  accessKey +
  secretKey +
  body;

console.log(
  "🍯🍯 ..... signature concatenation: πŸ”΅ πŸ”΅ " + signature + " πŸ”΅ πŸ”΅"
);
var rapydSignature = CryptoJS.enc.Hex.stringify(
  CryptoJS.HmacSHA256(signature, secretKey)
);
rapydSignature = CryptoJS.enc.Base64.stringify(
  CryptoJS.enc.Utf8.parse(rapydSignature)
);
console.log(
  "🍯🍯 rapyd_signature calculated: 🍎 🍎 🍎 " + rapydSignature + " 🍎"
);
return rapydSignature;

}

Hey @malengatiger, welcome to the community! Glad you were able to get the signature sorted out. Care to share what you did to get it working? It might help others who are having challenges.

All the best,
@uxdrew

Hey @Drew, I am in the process of creating a repo that I want to share after things settle down a bit. The code is written inside a NodeJS app with NestJS and I hope to package it such that it can be used easily by anyone building Rapyd into a NodeJS app.

I was more than a little disappointed that all the payment methods in South Africa don’t seem to support Subscriptions. Is there anyway I can achieve the same purpose anyhow else?