I want to make cashfree payment gatway dynamic for that I want to change get method of cashfree to post method, as by get method I am unable to make dynamic filed of user and product .
I want to get current user and product and add it in payment method intead of static data.
Cashfree.XClientId = process.env.CASH_API_ID;
Cashfree.XClientSecret = process.env.CASH_SECRET;
Cashfree.XEnvironment = Cashfree.Environment.SANDBOX;
function generateOrderId() {
const uniqueId = crypto.randomBytes(16).toString("hex");
const hash = crypto.createHash("sha256");
hash.update(uniqueId);
const orderId = hash.digest("hex");
return orderId.substr(0, 12);
}
export const paymentinitiate = async (req, res) => {
try {
console.log();
var request = {
order_amount: 1,
order_currency: "INR",
order_id: await generateOrderId(),
customer_details: {
customer_id: "walterwNrcMi",
customer_phone: "9999999999",
},
order_meta: {
return_url:
"https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}",
},
};
this is the code in server I am using for making payment. I want to make it dynamically.
I am unable to find its solution ???
I am using the same code as provided by cashfree payment gatway. in tha static data is showing but I want to change it dynamically but method is get ,, in get method cart cant be sent.