Creates an RMA (return) for one or more items (products) in an order. The response has the new return’s ID, which you pass to OrderReturnList_Received when the items come back.
Before you begin#
- The API token needs
OrderItemList_CreateReturn, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- Miva version 10.00.00 or later.
- You need the order ID and the
line_idof each item.OrderList_Load_Queryreturns both.
Example requests#
Create a return#
Creates a return for lines 141 and 142 of order 200292.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "OrderItemList_CreateReturn",
"Order_Id": "200292",
"line_ids": [141, 142]
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Order_ID |
Number | Order Id | |
line_ids |
Array | Yes | Array of line ids to Return. |
Example response#
{
"success": 1,
"data": {
"id": 5,
"order_id": 200292,
"code": "200292-20200713-00005",
"status": 500,
"dt_issued": 1594666197,
"dt_recvd": 0
}
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
id |
Number | Id of newly created RMA |
order_id |
Number | Order ID |
code |
String | RMA Code auto-generated by Miva |
status |
Number | RMA Status: 500 - RMA issued or 600 - Returned |
dt_issued |
Timestamp | Unix Timestamp for when the RMA was created |
dt_recvd |
Timestamp | Unix Timestamp for when the Item was marked as returned. 0 means the item has not been returned. |
Error responses#
| Error Code | Error Message | Error Description |
|---|---|---|
| MER-JSN-ORD-00025 | Order number not found. | Order number not found. |
| MER-JSN-ORD-00059 | No valid order items specified. | The line_ids passed don’t match up to any line_ids on the order. |
| MER-JSN-00023 | One or more parameters are invalid | Missing line_ids parameter. |
Related functions#
| Function | Use it to |
|---|---|
OrderReturnList_Received |
Mark the return as received and restock the items |
OrderList_Load_Query |
Find the order and its line IDs |
OrderPayment_Refund |
Refund the payment for returned items |
OrderItemList_Cancel |
Cancel items that haven’t shipped |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Orders > OrderItemList_CreateReturn. See Set Up Postman.