Refund orders
Call this endpoint to issue a refund for one or more order lines in a specific order. Use this action when you need to refund items, partially or entirely, due to situations such as billing errors or customer returns.
Endpoint
POST https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/refundSample request
curl --request POST \ --url https://marketplace.walmartapis.com/v3/orders/purchaseOrderId/refund \ --header 'WM_GLOBAL_VERSION: 3.1' \ --header 'WM_MARKET: us' \ --header 'WM_QOS.CORRELATION_ID: <Correlation ID>' \ --header 'WM_SEC.ACCESS_TOKEN: eyJraWQiOiIredacted.....' \ --header 'WM_SVC.NAME: Walmart Marketplace' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '
{ "orderRefund": { "purchaseOrderId": "string", "orderLines": { "orderLine": [ { "lineNumber": "string", "isFullRefund": true, "refunds": { "refund": [ { "refundId": "string", "refundComments": "string", "refundCharges": { "refundCharge": [ { "refundReason": "string", "charge": { "chargeType": "string", "chargeName": "string", "chargeAmount": { "amount": 0, "currency": "AED" }, "tax": { "taxName": "string", "taxAmount": { "amount": 0, "currency": "AED" } }, "taxDetails": [ { "taxName": "string", "taxAmount": { "amount": 0, "currency": "AED" } } ] } } ] } } ] } } ] } }
}
'import requests url = "https://marketplace.walmartapis.com/v3/orders/PURCHASE_ORDER_ID/refund"
headers = { "WM_GLOBAL_VERSION": "3.1", "WM_MARKET": "us", "WM_QOS.CORRELATION_ID": "<Correlation ID>", "WM_SEC.ACCESS_TOKEN": "eyJraWQiOiIredacted.....", "WM_SVC.NAME": "Walmart Marketplace", "Accept": "application/json", "Content-Type": "application/json",
}
json_payload = { "orderRefund": { "purchaseOrderId": "string", "orderLines": { "orderLine": [ { "lineNumber": "string", "isFullRefund": True, "refunds": { "refund": [ { "refundId": "string", "refundComments": "string", "refundCharges": { "refundCharge": [ { "refundReason": "string", "charge": { "chargeType": "string", "chargeName": "string", "chargeAmount": {"amount": 0, "currency": "AED"}, "tax": {"taxName": "string", "taxAmount": {"amount": 0, "currency": "AED"}}, "taxDetails": [ {"taxName": "string", "taxAmount": {"amount": 0, "currency": "AED"}} ] } } ] } } ] } } ] } }
} r = requests.post(url, headers=headers, json=json_payload)
print(r.status_code, r.json() if r.headers.get("content-type","").startswith("application/json") else r.text)
Modify your code
- Replace
{purchaseOrderId}in the endpoint URL with the actual order ID. - Substitute
<Base64EncodedClientID:ClientSecret>with your Base64-encoded credentials. - Update
WM_QOS.CORRELATION_IDwith a unique value for tracking your request. - Adjust the
orderRefundpayload as needed, including theisFullRefundflag, refund reasons, and charge details.
Sample response
{ "order": { "purchaseOrderId": "0123456789012", "customerOrderId": "ABCDEFGHIJKL", "customerEmailId": "[email protected]", "orderDate": 1476392223000, "orderType": "PREORDER", "shippingInfo": { "phone": "0123456789", "estimatedDeliveryDate": 1479798000000, "estimatedShipDate": 1476424800000, "methodCode": "Standard", "postalAddress": { "name": "Customer Name", "address1": "860 Example Ave", "address2": "Suite 100", "city": "CITY", "state": "STATE", "postalCode": "ZIPCODE", "country": "COUNTRY", "addressType": "RESIDENTIAL" } }, "orderLines": { "orderLine": [ { "lineNumber": "1", "item": { "productName": "Example Tent", "sku": "SKU_REFUND_001" }, "charges": { "charge": [ { "chargeType": "PRODUCT", "chargeName": "ItemPrice", "chargeAmount": { "currency": "USD", "amount": 19.99 }, "tax": { "taxName": "Tax1", "taxAmount": { "currency": "USD", "amount": 0 } } }, { "chargeType": "SHIPPING", "chargeName": "Shipping", "chargeAmount": { "currency": "USD", "amount": 2 }, "tax": { "taxName": "Tax2", "taxAmount": { "currency": "USD", "amount": 0 } } } ] }, "orderLineQuantity": { "unitOfMeasurement": "EACH", "amount": "1" }, "statusDate": 1476470187000, "orderLineStatuses": { "orderLineStatus": [ { "status": "Shipped", "statusQuantity": { "unitOfMeasurement": "EACH", "amount": "1" }, "trackingInfo": { "shipDateTime": 1475008215000, "carrierName": { "carrier": "FedEx" }, "methodCode": "Standard", "trackingNumber": "TRACKNUM98765", "trackingURL": "http://www.fedex.com" } } ] }, "refund": { "refundCharges": { "refundCharge": [ { "refundReason": "BillingError", "charge": { "chargeType": "PRODUCT", "chargeName": "Billing Error", "chargeAmount": { "currency": "USD", "amount": -19.99 } } }, { "refundReason": "BillingError", "charge": { "chargeType": "SHIPPING", "chargeName": "Billing Error", "chargeAmount": { "currency": "USD", "amount": -2 } } } ] } }, "miscAttributes": { "miscAttribute": [ { "name": "PET_DETAILS", "details": { "detail": [ { "key": "PET_FIRST_NAME", "value": "Blue" }, { "key": "PET_LAST_NAME", "value": "Scarano" } ] } } ] } } ] } }
}Result
If successful, the API returns an HTTP status: 200 OK along with a JSON object showing the updated order details, including the refund information for the specified order lines.
Updated 15 days ago
