> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create refund

> Refund a Stripe charge, PaymentIntent, or customer balance.

Use `stripe.createRefund` to refund a Stripe charge, PaymentIntent, or customer balance.

## Example

```ts automations/stripe-create-refund.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { stripe } from "automate.ax/stripe"

export default automation("Create refund", () => {
  onDashboardRun({ title: "Create refund" })

  stripe.createRefund({
    paymentIntent: "pi_123",
    amount: 2500,
    reason: "requested_by_customer",
  })
})
```

## Inputs

Provide exactly one refund source: a `charge`, a `paymentIntent`, or the customer-balance fields `origin: "customer_balance"`, `customer`, and `currency`. Omit `amount` for the remaining refundable amount. `idempotencyKey` is optional.

Stripe Refund IDs can use different prefixes depending on the refund source and payment method. Common examples include `re_` for card refunds, `rcb_` for customer-balance refunds, and `pyr_` for selected local payment methods.

Inputs use camel case and accept compatible signals. Automate.ax converts provider fields to Stripe's wire format. Metadata keys remain unchanged.

## Output

Returns the created Stripe Refund. Output fields use camel case.
