Feature #11452
openFeature #11355: Cancellation process for online orders
Create common function for stripe refund process to use in any where in the application
100%
Description
try {
const refundParams = {
amount: Math.round(refundAmount * 100),
reason: "requested_by_customer",
metadata: {
subscriptionContractId: subscriptionContract._id.toString(),
dbName,
source: "cancellation_settlement_refund",
},
};
if (paymentIntentId) {
refundParams.payment_intent = paymentIntentId;
} else if (chargeId) {
refundParams.charge = chargeId;
}
const stripeRefundObj = await stripe.refunds.create(refundParams);
stripeRefundId = stripeRefundObj.id;
refundReference = stripeRefundObj.id;
refundMethod = "credit_card";
console.log(`✅ [REFUND] Stripe refund ${stripeRefundId} created for contract ${subscriptionContract._id}`);
} catch (stripeErr) {
console.error("❌ [REFUND] Stripe refund failed:", stripeErr);
throw new CustomError(`Stripe Refund Failed: ${stripeErr.message}`, 400);
}
Using this api to integrate any flow make sure all parameters will be common to use any other flow
Same method will call e-commerce cancellation process , e-commerce return process, sale return to original payment process also
Files
Subtasks
Related issues
Updated by Pavan Kumar Murala 13 days ago
- Due date set to 10/09/2026
- Status changed from New to In Progress
Updated by Pavan Kumar Murala 12 days ago
- File Reusable_Stripe_Refund_Function_Developer_Guide.pdf Reusable_Stripe_Refund_Function_Developer_Guide.pdf added
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100