Project

General

Profile

Edit Copy Actions

Feature #11452

open

Feature #11355: Cancellation process for online orders

Create common function for stripe refund process to use in any where in the application

Added by Yalavarthi Thriveni 13 days ago. Updated 12 days ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Start date:
10/09/2026
Due date:
10/09/2026 (12 days late)
% Done:

100%

Estimated time:
2:00 h
Spent time:

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


Add

Subtasks


Add

Related issues

Actions #1

Updated by Pavan Kumar Murala 13 days ago

  • Due date set to 10/09/2026
  • Status changed from New to In Progress
Actions #2

Updated by Pavan Kumar Murala 12 days ago

Edit Copy Actions

Also available in: Atom PDF