Walmart Order Refund
Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | 19/12/2023 | Hristiyan | First publish |
v1.1 | 15/05/2024 | Hristiyan | Added Return logic |
API Docs : https://developer.walmart.com/api/us/mp/orders
Just like most markerplaces, there are two types of order refunds = pre-shipment and post-shipment.
The pre-shipment refunds are called “cancellations” and the post-shipment ones are called “refunds”. Walmart supports both calls so we need to be able to push the correct calls when doing the refunds/cancellations.
Walmart supports order line cancellations which means we will have to include every cancelled/refunded line when pushing the info to them. Even if we want to make a full order cancellation this means we will need to include all lines on the order.
Cancellation:
API Call : POST https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/cancel
The purhcaseOrderID
is mapped from Orders
> Marketplace Order ID
All triggers, validations etc. are as per our refunds abstraction found here Refunds send general logic
Example request payload :
{
"orderCancellation": {
"orderLines": {
"orderLine": [
{
"lineNumber": "1",
"orderLineStatuses": {
"orderLineStatus": [
{
"status": "Cancelled",
"cancellationReason": "CUSTOMER_REQUESTED_SELLER_TO_CANCEL",
"statusQuantity": {
"unitOfMeasurement": "EA",
"amount": "1"
}
}
]
}
}
]
}
}
}
Request mapping :
Walmart Field | Hemi Mapping | Notes | |||||
---|---|---|---|---|---|---|---|
orderCancellation |
N/A | ||||||
orderLines |
N/A | ||||||
orderLine |
N/A | ||||||
lineNumber |
Products On Order > Item Order Line ID |
||||||
orderLineStatuses |
N/A | ||||||
orderLineStatus |
N/A | ||||||
status |
N/A | Hardcoded as “Cancelled” | |||||
cancellationReason |
Order Payment > Reason |
Please find all the Walmart Order Refundbelow which are enums and we need to add them to the Order Refund Reasons table for Walmart. |
|||||
statusQuantity |
N/A | ||||||
unitOfMeasurement |
N/A | Hardcoded as “EACH” | |||||
amount |
N/A | Since we do not have refunds based on quantity we need to look at different approach on how to send this. | |||||
As far as I checked we are keeping each lineNumber as a single quantity record in Hemi and we will not have a line with more than one quantity but rather single quantity records in Product on Order even if we have multi quantity ordered of the same product. |
Please note that the response should be a 200 Successful operation with a full info payload on the order. Unfortunately the only identifier to check if the order was indeed successfully cancelled is a status
node in the payload which will be as “Cancelled
" however Walmart do not provide us with any kind of cancellation ID so there is nothing to store from the payload and we are to act as per the abstraction ****Refunds send general logic in the case that we are not receicing a cancellation ID . If we get any different than successful response we are to store the error from the response in the Order Errors
table with Type
= Refund Send.
Refunds:
API Call : POST https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/refund
The purhcaseOrderID
is mapped from Orders
> Marketplace Order ID
All triggers, validations etc. are as per our refunds abstraction found here Refunds send general logic
Sample request payload :
{
"orderRefund": {
"purchaseOrderId": "2577453162650",
"orderLines": {
"orderLine": [
{
"lineNumber": "4",
"isFullRefund": false,
"refunds": {
"refund": [
{
"refundComments": "test test",
"refundCharges": {
"refundCharge": [
{
"refundReason": "Merchandise not received",
"charge": {
"chargeType": "PRODUCT",
"chargeName": "Item Price",
"chargeAmount": {
"currency": "USD",
"amount": -0.1
},
"tax": {
"taxName": "Item Price Tax",
"taxAmount": {
"currency": "USD",
"amount": -0.1
}
}
}
}
]
}
}
]
}
}
]
}
}
}
Request mapping :
Walmart Field | Hemi Mapping | Notes | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
orderRefund |
N/A | |||||||||
purchaseOrderId |
Orders > Marketplace Order ID |
|||||||||
orderLines |
N/A | |||||||||
orderLine |
N/A | |||||||||
lineNumber |
Products On Order > Item Order Line ID |
|||||||||
isFullRefund |
N/A | This is not a requried field so we should be able to exclude it from the payload. | ||||||||
refunds |
N/A | |||||||||
refund |
N/A | |||||||||
refundComments |
N/A | This is not a requried field so we should be able to exclude it from the payload. | ||||||||
refundCharges |
N/A | |||||||||
refundCharge |
N/A | |||||||||
refundReason |
Order Payment > Reason |
Please find all the reasons Walmart Order Refundwhich are enums and we need to add them to the Order Refund Reasons table for Walmart. |
||||||||
charge |
N/A | |||||||||
chargeType |
N/A | Walmart supports these charge types: |
• PRODUCT: The product charges for the specified line item in Purchase Order.
• SHIPPING: The shipping charges for the specified Purchase Order line item
The good thing is we keep them exactly like this in Hemi so we can easily distinguish which ones to send. If we have both product and refund shipping we just include both chargeTypes
|
| | | | | | | | chargeName
| | N/A | string
• If chargeType
is PRODUCT, chargeName
is “ItemPrice”.
• If chargeType
is SHIPPING, chargeName
is “Shipping” |
| | | | | | | | chargeAmount
| | N/A | |
| | | | | | | | | currency
| Orders
> Currency
| We want to have internal validation and if Currency is blank, we want to store an error in Order Errors
with type Refund Send
|
| | | | | | | | | amount
| Order Refund Row
> Amount
| This has to be send as a negative number and will be transformed in the code. In the UI we will have the normal positive amount that we store by default. |
| | | | | | | tax
| | | N/A | |
| | | | | | | | taxName
| | N/A | |
| | | | | | | | taxAmount
| | N/A | |
| | | | | | | | | currency
| N/A | |
| | | | | | | | | amount
| N/A | Needs to be negative |
The response should be a 200 Successful operation with a full info payload on the order again Walmart does not provide any kind of ID so we will need to treat the refund as completed as long as we get the successfull response. If any different than successful response we are to store the error from the response in the Order Errors
table with Type
= Refund Send
.
Walmart Refund Reasons :
These reasons should be added in the Order Refund Reasons
table for distinct marketplace Walmart. These should be available in the dropdown menu from the refund panel. The refund reasons should be in a format [Refund] - reason and cancellations should be [Cancellation] - reason
Refund reasons | Cancellation reasons |
---|---|
BillingError | CUSTOMER_REQUESTED_SELLER_TO_CANCEL |
TaxExemptCustomer | SELLER_CANCEL_PRICING_ERROR |
ItemNotAsAdvertised | SELLER_CANCEL_OUT_OF_STOCK |
IncorrectItemReceived | SELLER_CANCEL_FRAUD_STOP_SHIPMENT |
CancelledYetShipped | SELLER_CANCEL_ADDRESS_NOT_SERVICEABLE |
ItemNotReceivedByCustomer | |
IncorrectShippingPrice | |
DamagedItem | |
DefectiveItem | |
CustomerChangedMind | |
CustomerReceivedItemLate | |
Missing Parts / Instructions | |
Finance -> Goodwill | |
Finance -> Rollback | |
Buyer canceled | |
Customer returned item | |
General adjustment | |
Merchandise not received | |
Quality -> Missing Parts / Instructions | |
Shipping & Delivery -> Damaged | |
Shipping & Delivery -> Shipping Price Discrepancy | |
Others |
<v1.1.>
Return:
Docs : https://developer.walmart.com/api/us/mp/returns API Call : POST https://marketplace.walmartapis.com/v3/returns/{returnOrderId}/refund
We need to use a specific call when there is a return request. This request will be linked to a claim that we have downloaded so we can link them when pushing the refund from the modal. The {returnOrderId} should be taken from Order Claim
> Marketplace ID
as this is where it will be stored
Sample request :
{
"customerOrderId": "1535274411287",
"refundLines": [
{
"returnOrderLineNumber": 1,
"quantity": {
"unitOfMeasure": "EA",
"measurementValue": 2
}
}
]
}
Mapping :
Walmart FIeld | Hemi Field | Notes | |
---|---|---|---|
customerOrderId |
Orders > Selling Manager Sales Record Number |
||
refundLines |
|||
returnOrderLineNumber |
TBA | ||
quantity |
|||
unitOfMeasure |
Hardcoded as “EA” | ||
measurementValue |
Since we do not have refunds based on quantity we need to look at different approach on how to send this. | ||
As far as I checked we are keeping each lineNumber as a single quantity record in Hemi and we will not have a line with more than one quantity but rather single quantity records in Product on Order even if we have multi quantity ordered of the same product. |
|||