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}/refund
Sample request
curl -X POST "https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/refund" \ -H "Authorization: Basic <Base64EncodedClientID:ClientSecret>" \ -H "WM_SVC.NAME: Walmart Marketplace" \ -H "WM_QOS.CORRELATION_ID: 0123456" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "orderRefund": { "orderLines": { "orderLine": [ { "isFullRefund": false, "refunds": { "refund": [ { "refundCharges": { "refundCharge": [ { "refundReason": "BillingError", "charge": { "chargeAmount": { "currency": "AED" }, "tax": { "taxAmount": { "currency": "AED" } } } } ] } } ] } } ] } } }'
import requests url = "https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/refund" headers = { "Authorization": "Basic <Base64EncodedClientID:ClientSecret>", "WM_SVC.NAME": "Walmart Marketplace", "WM_QOS.CORRELATION_ID": "0123456", "Accept": "application/json", "Content-Type": "application/json"
} data = { "orderRefund": { "orderLines": { "orderLine": [ { "isFullRefund": False, "refunds": { "refund": [ { "refundCharges": { "refundCharge": [ { "refundReason": "BillingError", "charge": { "chargeAmount": { "currency": "AED" }, "tax": { "taxAmount": { "currency": "AED" } } } } ] } } ] } } ] } }
} response = requests.post(url, headers=headers, json=data)
print(response.json())
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_ID
with a unique value for tracking your request. - Adjust the
orderRefund
payload as needed, including theisFullRefund
flag, 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 } } } ] } } } ] } }
}
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 1 day ago