Update index.ts
This commit is contained in:
parent
07bb778244
commit
1b5eb33859
@ -534,32 +534,34 @@ export const createCashfreeLink = onRequest({
|
||||
|
||||
const linkId = uuidv4();
|
||||
try {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'x-client-id': `${clientId}`,
|
||||
'x-client-secret': `${clientSecret}`,
|
||||
'x-api-version': '2025-01-01',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: `{
|
||||
"link_id": "${linkId}",
|
||||
"link_amount": ${amount},
|
||||
"link_currency": "INR",
|
||||
"link_purpose": "${productInfo}",
|
||||
"customer_details": {
|
||||
"customer_phone": "${customerPhone}",
|
||||
"customer_email": "${customerEmail}",
|
||||
"customer_name": "${customerName}"},
|
||||
"link_partial_payments": false,
|
||||
"link_notify": {
|
||||
"send_sms": true,
|
||||
"send_email": true
|
||||
}
|
||||
}`
|
||||
const requestHeqaders = {
|
||||
'x-client-id': clientId,
|
||||
'x-client-secret': clientSecret,
|
||||
'x-api-version': '2025-01-01',
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
console.log(`Options ${JSON.stringify(options)}`);
|
||||
const cashfreeResponse = await axios.post(apiUrl!, options);
|
||||
console.log(`Header: ${JSON.stringify(requestHeqaders)}`);
|
||||
const requestBody = {
|
||||
"link_id": linkId,
|
||||
"link_amount": amount,
|
||||
"link_currency": "INR",
|
||||
"link_purpose": productInfo,
|
||||
"customer_details": {
|
||||
"customer_phone": customerPhone,
|
||||
"customer_email": customerEmail,
|
||||
"customer_name": customerName,
|
||||
},
|
||||
"link_partial_payments": false,
|
||||
"link_notify": {
|
||||
"send_sms": true,
|
||||
"send_email": true
|
||||
}
|
||||
};
|
||||
console.log(`Body: ${JSON.stringify(requestBody)}`);
|
||||
const cashfreeResponse = await axios.post(apiUrl!, requestBody, {
|
||||
headers: requestHeqaders
|
||||
});
|
||||
|
||||
try {
|
||||
await admin.firestore().collection('payment_links').doc(orderId).set({
|
||||
requestUserId: uid,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user