- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
refundPaymentWorkflow - Medusa Core Workflows Reference
This documentation provides a reference to the refundPaymentWorkflow
. It belongs to the @medusajs/medusa/core-flows
package.
This workflow refunds a payment. It's used by the Refund Payment Admin API Route.
You can use this workflow within your own customizations or custom workflows, allowing you to refund a payment in your custom flows.
Source CodeExamples#
src/api/workflow/route.ts1import type {2 MedusaRequest,3 MedusaResponse,4} from "@medusajs/framework/http"5import { refundPaymentWorkflow } from "@medusajs/medusa/core-flows"6 7export async function POST(8 req: MedusaRequest,9 res: MedusaResponse10) {11 const { result } = await refundPaymentWorkflow(req.scope)12 .run({13 input: {14 payment_id: "payment_123",15 }16 })17 18 res.send(result)19}
Steps#
Workflow Hook
Step conditioned by when
Input#
RefundPaymentWorkflowInput
RefundPaymentWorkflowInputThe data to refund a payment.
RefundPaymentWorkflowInput
RefundPaymentWorkflowInputpayment_id
stringThe ID of the payment to refund.
payment_id
stringcreated_by
stringOptionalThe ID of the user that refunded the payment.
created_by
stringOptionalThe amount to refund. If not provided, the full payment amount will be refunded.
Was this page helpful?