The client calls and says:
"I ordered 5 paintings, I want to return 3."
- Ask for the order number (order_id) or the email address used for the purchase.
- In the DB, find the order using
order_idoremail. - Identify the returned products.
- Go to the order_items table → see which paintings were purchased.
- Manually mark the returned ones in the admin panel.
- Add up the prices of the paintings marked as returned.
- This total is the amount to be refunded.
- Run the PHP script with:
payment_intent_idsaved in the DBamountto refund
- Stripe sends the corresponding amount back to the client’s card.
- In order_items, set
refunded = 1for the returned paintings. - Update the order status to partial_refund.
// 1. Client request
// 2. Identify order
$order = findOrderByEmailOrId($emailOrId);
$orderItems = getOrderItems($order['id']);
$selectedItems = [45, 67]; // Admin selecteaza
$refundAmount = calculateRefundAmount($selectedItems);
$result = $refund->partialRefund($order['id'], $refundAmount, $selectedItems);