View as Markdown
WooCommerce icon

WooCommerce ACTION

Create Refund

Create a new refund for an order. See the docs
  • Action
  • Writes data
  • Destructive
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's WooCommerce account once, then configure and run Create Refund from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "woocommerce-create-refund",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    woocommerce: { authProvisionId: "apn_xxxxxxx" },
    orderId: 10,
    amount: "Amount",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Create Refund inputs
Property Type Description
orderId Order ID integer
ID of the Order
Required Dynamic
amount Amount string
The total refund amount. If not specified, the amount will be calculated based on the line items
Optional
reason Reason string
Reason for the refund
Optional
apiRefund API Refund boolean
When true, the payment gateway API is used to generate the refund. When false, the refund is manual
Optional
lineItems Line Items string[]

Array of line items to refund. Each item must be a JSON string with the following structure:

Properties:

  • id (integer, required): The ID of the line item in the order
  • refund_total (number, required): The amount to refund for this line item, excluding taxes
  • refund_tax (array, optional): Array of tax refund objects, each containing:
    • id (integer): The ID of the tax rate
    • refund_total (number): The amount of tax to refund

Example:

{
  "id": 111,
  "refund_total": 10,
  "refund_tax": [
    {
      "id": 222,
      "refund_total": 20
    }
  ]
}
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
woocommerce-create-refund
Version
0.0.1
App
WooCommerce
Authentication
API key
Read-only
No
Destructive
Yes
Open world
Yes