How to Process Stripe Refunds from WooCommerce Returns

Automatically process Stripe refunds when WooCommerce orders are returned.

What This Integration Does

When a WooCommerce order is refunded in the store admin, the money doesn't actually leave Stripe until someone hits the refund button there too. That manual second step is where mistakes happen: wrong amounts, missed currencies, charges refunded against the wrong original transaction. This workflow turns the two-step process into a single trigger.

The workflow listens for a refund event from WooCommerce, looks up the original Stripe charge for the order, issues a refund in Stripe for the correct amount, and then notifies the customer and your support team. State is kept on both ends so a duplicate webhook can't double-refund.

Prerequisites

  • A WooCommerce connection with a webhook configured for the order.refunded topic.
  • A Stripe connection with permission to read charges and create refunds.
  • A Slack connection for team notifications.
  • A Send Email step (SMTP or Resend) for customer confirmations.

Step 1: Webhook Trigger

Add a Trigger node set to Webhook and register the URL with WooCommerce for the order.refunded event. The payload includes the order ID, refund amount, and reason. Spojit validates the signature so spoofed events are rejected.

Step 2: Fetch the Full Order

Add a Connector node pointing at woocommerce using get-order with the order ID from the trigger. You need the order's payment metadata to find the matching Stripe charge.

Step 3: Find the Stripe Charge

WooCommerce stores the Stripe payment intent or charge ID in order meta. Pull it out with a Transform node. If only a payment intent ID is available, add a Connector node pointing at stripe using list-payment-intents filtered by metadata, then list-charges to get the actual charge. Capture the charge ID as chargeId.

Step 4: Validate the Refund

Add a Condition node. Block the workflow if:

  • The order's refund total exceeds the original charge amount.
  • A refund for this charge already exists (idempotency).
  • The charge is in a non-refundable state.

Use stripe list-charges filtered by customer or payment_intent to check for an existing refund before continuing.

Step 5: Create the Stripe Refund

Add a Connector node pointing at stripe. The platform's Stripe connector exposes refund creation via the raw-api-request tool. Call POST /v1/refunds with:

{
  "charge": "{{ chargeId }}",
  "amount": {{ refundAmountCents }},
  "reason": "requested_by_customer",
  "metadata": {
    "woocommerce_order_id": "{{ order.id }}",
    "woocommerce_refund_id": "{{ trigger.refund.id }}"
  }
}

The metadata makes it trivial to reconcile and to prove which WooCommerce event drove which Stripe refund.

Step 6: Confirm and Notify

Add a Send Email step that emails the customer with the refund amount, the last 4 of the card, and an expected timeline. Then send a slack send-message to your support channel summarizing the refund: order ID, customer, amount, agent who initiated the WooCommerce refund. On failure at any step, route to Slack with the error and surface the WooCommerce refund record for manual handling.

Tips

  • Refund amounts are in cents in Stripe but in the order's currency unit in WooCommerce. Convert with math round after multiplying by 100; never trust floats.
  • Partial refunds need extra care. Send the line-item or amount delta, not the full order total.
  • Store the Stripe refund ID back on the WooCommerce order as meta. Future audits and customer queries get faster.

Common Pitfalls

  • Multiple webhooks for the same refund event. Stripe and WooCommerce both retry on non-2xx responses. Idempotency check in Step 4 is non-negotiable.
  • Foreign currency. The original charge's currency must match the refund. If WooCommerce displays a localized amount, refund using the charge's stored currency, not the display currency.
  • Manual Stripe refunds. If support sometimes refunds directly in Stripe, route those events back into WooCommerce or you'll see the orders fall out of sync.

Testing

Use Stripe test mode and a sandbox WooCommerce store. Place a test order, complete payment, then refund it from the WooCommerce admin. Watch the run trace and confirm the Stripe refund appears with matching metadata. Repeat with a partial refund before going live.

Learn More

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.