ReturnOrderEvent

Package 

com.salesforce.marketingcloud.sfmcsdk.components.events

Overview 

An E-commerce event to manage details of returning an order.

Declaration 

1class ReturnOrderEvent : OrderEvent

Platform 

  • Target: androidJvm
  • SDK Version: SFMC SDK v3.1.0
  • API Documentation Version: 11.0.0

Inheritance Hierarchy 

1Event
2  └── EngagementEvent
3        └── OrderEvent (sealed class)
4              └── ReturnOrderEvent

Class Information 

ReturnOrderEvent is a concrete implementation of the sealed class OrderEvent. It inherits all properties and methods from its parent classes without adding additional members.

Related Order Event Types 

The OrderEvent sealed class has the following inheritors:

  • PurchaseOrderEvent
  • PreorderEvent
  • CancelOrderEvent
  • ShipOrderEvent
  • DeliverOrderEvent
  • ReturnOrderEvent
  • ExchangeOrderEvent

Inherited Properties 

From OrderEvent 

order 

1val order: Order

The order data containing details about the order being returned.

From EngagementEvent 

category 

1open override var category: Event.Category

The Event category name. Category contains list of allowed values.

priority 

1open override val priority: Priority

The priority level of the event.

Inherited Methods 

From EngagementEvent 

attributes() 

1open override fun attributes(): Map<String, Any>

Returns the Event attributes for this event.

Returns: A map containing event attributes.

name() 

1open override fun name(): String

Returns the name for the event. This value must match the Event Name used when creating the event in the Marketing Cloud UI for any action to result from tracking this event.

Returns: The event name as a String.

Order Data Class 

The order property uses the Order data class, which has the following structure:

Declaration 

1data class Order @JvmOverloads constructor(
2    val id: String,
3    val lineItems: List<LineItem> = listOf(),
4    val totalValue: Double? = null,
5    val currency: String? = null,
6    val attributes: Map<String, Any> = mapOf()
7)

Constructor Parameters 

ParameterTypeDefaultDescription
idStringrequiredA unique identifier representing the order.
lineItemsList<LineItem>listOf()A list of Line Item Data values.
totalValueDouble?nullThe total value of the order.
currencyString?nullThe currency of the total value for the order.
attributesMap<String, Any>mapOf()A map of user-supplied values.

Properties 

id 

1val id: String

A unique identifier representing the order.

lineItems 

1val lineItems: List<LineItem>

An list of Line Item Data values.

totalValue 

1val totalValue: Double?

The total value of the order.

currency 

1val currency: String?

The currency of the total value for the order.

attributes 

1val attributes: Map<String, Any>

A map of user-supplied values.

Usage Example 

1// Create an order with return details
2val returnOrder = Order(
3    id = "ORDER-12345",
4    lineItems = listOf(
5        LineItem(
6            catalogObjectType = "product",
7            catalogObjectId = "PROD-789",
8            quantity = 1,
9            price = 49.99
10        )
11    ),
12    totalValue = 49.99,
13    currency = "USD",
14    attributes = mapOf(
15        "returnReason" to "Defective",
16        "refundMethod" to "Original payment method"
17    )
18)
19
20// Create a ReturnOrderEvent
21val returnEvent = ReturnOrderEvent()
22// Note: The actual constructor/initialization method would be
23// implementation-specific based on the parent OrderEvent class

Notes 

  • ReturnOrderEvent is used specifically for tracking when customers return orders.
  • This event should be tracked when an order return is processed in your e-commerce system.
  • The event name configured in this event must match the Event Name defined in the Marketing Cloud UI to trigger any associated actions or automations.
  • The @JvmOverloads annotation on the Order constructor provides multiple constructor variants for Java interoperability.

See Also 

  • OrderEvent - The parent sealed class
  • EngagementEvent - The grandparent sealed class
  • Event - The root event interface
  • LineItem - Used to represent individual items in the order
  • Order - The data class containing order information