WooOrderRefund constructor

WooOrderRefund({
  1. int? id,
  2. DateTime? dateCreated,
  3. DateTime? dateCreatedGmt,
  4. String? amount,
  5. String? reason,
  6. int? refundedBy,
  7. bool? refundedPayment,
  8. List<WooMetaData>? metaData,
  9. List<WooLineItem>? lineItems,
  10. List<WooTaxLine>? taxLines,
  11. List<WooShippingLine>? shippingLines,
  12. List<WooOrderFeeLine>? feeLines,
  13. bool? apiRefund,
  14. bool? apiRestock,
})

Creates a new WooOrderRefund instance

Required Parameters

  • amount - Total refund amount as a string
  • reason - Reason for the refund

Optional Parameters

  • id - Unique identifier for the refund (read-only)
  • dateCreated - Date when refund was created (read-only)
  • dateCreatedGmt - Date when refund was created in GMT (read-only)
  • refundedBy - User ID who created the refund (read-only)
  • refundedPayment - Whether payment was refunded via API (read-only)
  • metaData - Custom refund metadata
  • lineItems - Line items being refunded
  • taxLines - Tax lines for the refund (read-only)
  • shippingLines - Shipping lines for the refund
  • feeLines - Fee lines for the refund
  • apiRefund - Whether to use payment gateway API (write-only)
  • apiRestock - Whether to restock refunded items (write-only)

Example Usage

// Create a full refund
final refund = WooOrderRefund(
  amount: '99.99',
  reason: 'Customer requested full refund',
  apiRefund: true,
  apiRestock: true,
);

// Create a partial refund
final partialRefund = WooOrderRefund(
  amount: '25.00',
  reason: 'Partial refund for damaged item',
  lineItems: [
    WooLineItem(
      id: 1,
      quantity: 1,
      total: 25.00,
    ),
  ],
);

Implementation

WooOrderRefund({
  this.id,
  this.dateCreated,
  this.dateCreatedGmt,
  this.amount,
  this.reason,
  this.refundedBy,
  this.refundedPayment,
  this.metaData,
  this.lineItems,
  this.taxLines,
  this.shippingLines,
  this.feeLines,
  this.apiRefund,
  this.apiRestock,
});