Introducing Order Returns
Published by Miranda Danielson on May 16, 2022
We’re excited to present a new set of features to enable all aspects of the Order Returns process.
Key Highlights
An
OrderReturn
must be affiliated with an existingOrder
, andItemsToReturn
must be affiliated with existingLineItems
An
OrderReturn
is not required to have anyItemsToReturn
, andItemsToReturn
are not required to have aQuantity
specifiedThis allows flexibility for providing refunds not associated with the return of a physical item
Examples include refunding an expedited shipping charge due to processing delays or providing a partial discount on an item that arrived damaged
A user with the
Shopper
role can create anOrderReturn
for any order from them (Order.FromUserID
)Anonymous users are prohibited from creating or modifying
OrderReturns
A user with the
OrderAdmin
role can create anOrderReturn
for anyOrder
visible to themFor Marketplace Owners this is all orders in the marketplace
For other Sellers (Suppliers) this is orders placed to them (
Order.ToCompanyID
)For Buyer users this is orders placed from their company (
Order.FromCompanyID
)
Order.Status
must beOpen
orCompleted
to create an associatedOrderReturn
If
Order.Status
isOpen
, only the quantity of a given item that has already shipped will be eligible to return
Date based return policies can be enforced in your UI, and/or by using the new
SellerApprovalRules
resource
New Resource: OrderReturn
1"OrderReturn": {2 "ID": "",3 "OrderID": "",4 "PaymentIDs": [],5 "Status": "",6 "RefundAmount": 0,7 "ItemsToReturn": [],8 "DateCreated": "2022-01-04T00:00:00.00+00:00",9 "DateSubmitted": "2022-01-04T00:00:00.00+00:00",10 "DateApproved": "2022-01-04T00:00:00.00+00:00",11 "DateDeclined": "2022-01-04T00:00:00.00+00:00",12 "DateCanceled": "2022-01-04T00:00:00.00+00:00",13 "DateCompleted": "2022-01-04T00:00:00.00+00:00",14 "LastUpdated": "2022-01-04T00:00:00.00+00:00",15 "xp": {}16}1718"ItemToReturn": {19 "LineItemID": "",20 "Quantity": 0,21 "RefundAmount": 0,22 "Comments": ""23}
Endpoints:
GET v1/orderreturns
Use the optional
approvable
filter to listOrderReturns
awaiting the user's approval
GET v1/orderreturns/{returnID}
POST v1/orderreturns
PUT v1/orderreturns/{returnid}
PATCH v1/orderreturns/{returnid}
DELETE v1/orderreturns/{returnid}
DELETE v1/orderreturns/{returnid}/items/{lineitemid}
Creating or Updating Items can be done via POST/PUT/PATCH for OrderReturns
POST v1/orderreturns/{returnid}/submit
POST v1/orderreturns/{returnid}/approve
POST v1/orderreturns/{returnid}/decline
POST v1/orderreturns/{returnid}/cancel
POST v1/orderreturns/{returnid}/complete
GET v1/orderreturns/{returnID}/approvals
GET v1/orderreturns/{returnID}/eliglbleapprovers
Notes
OrderID
is required, as isLineItemID
onItemsToReturn
OrderReturn.RefundAmount
is the sum of allRefundAmounts
onItemsToReturn
. If there are noItemsToReturn
,Order.RefundAmount
is writable by users with theOrderAdmin
role
New Resource: SellerApprovalRule
1"SellerApprovalRule": {2 "ID": "",3 "Name": "",4 "Type": "OrderReturn",5 "Description": "",6 "OwnerID": "",7 "ApprovingGroupID": "",8 "RuleExpression": "",9}
Endpoints:
GET v1/approvalrules
GET v1/approvalrules/{ruleID}
POST v1/approvalrules
PUt v1/approvalrules/{ruleID}
PATCH v1/approvalrules/{ruleID}
DELETE v1/approvalrules/{ruleID}
Notes:
This resource is not available to buyer users, regardless of assigned roles
OwnerID
is the ID of the organization who owns the rule. Only the Marketplace Owner can write a value other than their own organization ID. The value is used to look up theApprovingGroupID
and determine who is eligible to administer the ruleTo enable date based
RuleExpressions
the rules engine now supports a new custom functionnow()
which accepts an integer as a parameterFor example, if you wanted any
OrderReturn
associated with anOrder
that was completed prior to 30 days ago to route for approval, you would set up anSellerApprovalRule
with aRuleExpression
ofOrder.DateCompleted < now(-30)
Additionally, a developer can choose to enforce logic in the UI to prevent an
OrderReturn
from being initiated on Orders completed more than a specific time ago
OrderReturn
is the only supported Type currently - we plan to expand this functionality to Order Approvals in the future
New IntegrationEvent Type: OrderReturn
OrderCloud does not provide an opinion on RefundAmount
at the OrderReturn
or ItemToReturn
levels due to the fact there are an infinite number of ways a seller might wish to calculate a refund, which would likely include complicated external events such as adjusting tax collection records. Since we are unable to provide an informed opinion, we provide sellers with the opportunity to set up a custom IntegrationEvent
to handle OrderReturn
calculations.
Payload provided by OrderCloud to the CustomImplementationUrl
1"OrderReturnPayload": {2 "OrderReturn": {},3 "OrderWorksheet": {}4}
Response expected by OrderCloud
1"OrderReturnResponse": {2 "RefundAmount": 0,3 "ItemsToReturnCalcs": []4}56"LineItemReturnCalculation": {7 "LineItemID": "",8 "RefundAmount": ""9}
Notes:
The endpoint the Integration Event will
POST
the payload to is/calculateorderreturn
at theCustomImplementationUrl
Unlike other
IntegrationEvent
types, there are no publicly available endpoints associated with the event. It is called from within the OrderCloud code when anOrderReturn
is created or updatedIf a user with the
OrderAdmin
role passes in a validRefundAmount
(either one for everyItemToReturn
or if there are noItemsToReturn
a value at theOrderReturn
level), the IntegrationEvent will not be calledIf a user with the
Shopper
role submits a return butApiClient.OrderReturnIntegrationEventID
is not set then the IntegrationEvent will not be called however allRefundAmount
properties will be set to null
New Message Sender Types
OrderReturnSubmitted
OrderReturnApproved
OrderReturnDeclined
OrderReturnCompleted
OrderReturnSubmittedForApproval
OrderReturnSubmittedForYourApproval
OrderReturnSubmittedForYourApprovalHasBeenApproved
OrderReturnSubmittedForYourApprovalHasBeenDeclined
Notes:
To assign a
MessageSender
to the Marketplace Owner, leave bothBuyerID
andSupplierID
null when creating theMessageSender
assignment
New Properties
Payment.OrderReturnID
Used to populate OrderReturn.PaymentIDs
Refunds may not exceed the corresponding Order.Total or the refund amount on the OrderReturn
Payment.Amount should be negative to reflect a refund
Once a payment (or payments) has been created with an Amount equal to the OrderReturn.RefundAmount the OrderReturn will be marked as complete
Product.Returnable
Specify whether or not a product can be returned
API will restrict creating a return for a given LineItem.Product if this is false if user does not have OrderAdmin
ApiClient.OrderReturnIntegrationEventID
If populated, the OrderReturn Integration Event will be called when creating or updating an OrderReturn
Unsubmitted OrderReturn Cleanup
Unsubmitted
OrderReturns
that have not been updated in the past 14 days will be deleted
Still have questions?
Ask in our Community Channel