Introducing Order Returns
Published by Miranda Danielson on May 16, 2022
Last updated on January 28, 2025
We’re excited to present a new set of features to enable all aspects of the Order Returns process.
Key Highlights
An
OrderReturnmust be affiliated with an existingOrder, andItemsToReturnmust be affiliated with existingLineItemsAn
OrderReturnis not required to have anyItemsToReturn, andItemsToReturnare not required to have aQuantityspecifiedThis 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
Shopperrole can create anOrderReturnfor any order from them (Order.FromUserID)Anonymous users are prohibited from creating or modifying
OrderReturns
A user with the
OrderAdminrole can create anOrderReturnfor anyOrdervisible 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.Statusmust beOpenorCompletedto create an associatedOrderReturnIf
Order.StatusisOpen, 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
SellerApprovalRulesresource
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/orderreturnsUse the optional
approvablefilter to listOrderReturnsawaiting the user's approval
GET v1/orderreturns/{returnID}POST v1/orderreturnsPUT 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}/submitPOST v1/orderreturns/{returnid}/approvePOST v1/orderreturns/{returnid}/declinePOST v1/orderreturns/{returnid}/cancelPOST v1/orderreturns/{returnid}/completeGET v1/orderreturns/{returnID}/approvalsGET v1/orderreturns/{returnID}/eliglbleapprovers
Notes
OrderIDis required, as isLineItemIDonItemsToReturnOrderReturn.RefundAmountis the sum of allRefundAmountsonItemsToReturn. If there are noItemsToReturn,Order.RefundAmountis writable by users with theOrderAdminrole
New Resource: SellerApprovalRule
1"SellerApprovalRule": {2 "ID": "",3 "Name": "",4 "Type": "OrderReturn",5 "Description": "",6 "OwnerID": "",7 "ApprovingGroupID": "",8 "RuleExpression": "",9}
Endpoints:
GET v1/approvalrulesGET v1/approvalrules/{ruleID}POST v1/approvalrulesPUt v1/approvalrules/{ruleID}PATCH v1/approvalrules/{ruleID}DELETE v1/approvalrules/{ruleID}
Notes:
This resource is not available to buyer users, regardless of assigned roles
OwnerIDis 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 theApprovingGroupIDand determine who is eligible to administer the ruleTo enable date based
RuleExpressionsthe rules engine now supports a new custom functionnow()which accepts an integer as a parameterFor example, if you wanted any
OrderReturnassociated with anOrderthat was completed prior to 30 days ago to route for approval, you would set up anSellerApprovalRulewith aRuleExpressionofOrder.DateCompleted < now(-30)Additionally, a developer can choose to enforce logic in the UI to prevent an
OrderReturnfrom being initiated on Orders completed more than a specific time ago
OrderReturnis 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.
OrderReturn within your middleware, such as PATCH or PUT, will be overwritten after OrderCloud receives your response. You must wait until after returning the response to OrderCloud to make any updates.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": [ // array of LineItemReturnCalculation4 {5 "LineItemID": "",6 "RefundAmount": ""7 }8 ],9 "xp": {} // optional, must be full xp object, existing OrderReturn xp will be overwritten with this value10}
Notes:
The endpoint the Integration Event will
POSTthe payload to is/calculateorderreturnat theCustomImplementationUrlUnlike other
IntegrationEventtypes, there are no publicly available endpoints associated with the event. It is called from within the OrderCloud code when anOrderReturnis created or updatedIf a user with the
OrderAdminrole passes in a validRefundAmount(either one for everyItemToReturnor if there are noItemsToReturna value at theOrderReturnlevel), the IntegrationEvent will not be calledIf a user with the
Shopperrole submits a return butApiClient.OrderReturnIntegrationEventIDis not set then the IntegrationEvent will not be called however allRefundAmountproperties will be set to null
New Message Sender Types
OrderReturnSubmittedOrderReturnApprovedOrderReturnDeclinedOrderReturnCompletedOrderReturnSubmittedForApprovalOrderReturnSubmittedForYourApprovalOrderReturnSubmittedForYourApprovalHasBeenApprovedOrderReturnSubmittedForYourApprovalHasBeenDeclined
Notes:
To assign a
MessageSenderto the Marketplace Owner, leave bothBuyerIDandSupplierIDnull when creating theMessageSenderassignment
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
OrderReturnsthat have not been updated in the past 14 days will be deleted
Still have questions?
Ask in our Community Channel