Create an RMA Order for a Return
By using the REST API, you can create a return merchandise authorization (RMA) order—that is, a return order of the RM type. You can view the created RMA order on the Sales Orders (SO301000) form.
System Preparation
Before you test the code below, you need to do the following to configure your client application and the MYOB Acumatica instance to be used:
- Deploy a new MYOB Acumatica instance with the U100 dataset. For details on deploying an instance, see Instance Deployment: To Deploy an Instance with Demo Data.
- To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the HEADOFFICE branch.
- If you are using Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection, make sure that the collection’s variables have the proper values. This collection is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub.
- On the Enable/Disable Features (CS100000) form, make sure that the Inventory and Order Management and Advanced SO Invoices features are enabled.
- Prepare a sales order, shipment, and an invoice as follows:Tip:If you use the IntegrationDevelopmentGuide.postman_collection.json Postman collection for testing, you do not need to perform the following configuration steps because they are performed in the pre-request script.
- On the Sales Orders (SO301000) form, create a sales order to sell one SWB-32OZ-GBT item from the Retail warehouse to the FRUITICO customer.
- On the form toolbar, click Create Shipment to create a shipment for the sales order.
- In the Specify Shipment Parameters dialog box, which opens, specify today's date as the shipment date and Retail as the warehouse, and click OK.
- On the Shipments (SO302000) form, which opens, click Confirm Shipment and then click Prepare Invoice.
- On the Invoices (SO303000) form, which opens, click Release. In this example, the invoice number is supposed to be 000126.
Request
<MYOB Acumatica host> is the URL of the MYOB Acumatica
host (such as https://my.acumatica.com). You need to use the instance name in the
URL of the request (such as https://my.acumatica.com/MyInstance) if the instance
is not installed in the root of the website.PUT /entity/Default/25.200.001/SalesOrder?$expand=Details HTTP/1.1
Host: <MYOB Acumatica host>
Accept: application/json
Content-Type: application/json
{
"CustomerID": { "value": "FRUITICO" },
"OrderType": { "value": "RM" },
"Details": [
{
"InvoiceType": { "value": "Invoice" },
"InvoiceNbr": { "value": "000126" },
"Operation": { "value": "Receipt" },
"InvoiceLineNbr": { "value": "1" },
"OrderQty": { "value": -1 },
"AutoCreateIssue": { "value": false }
},
{
"Branch": { "value": "HEADOFFICE" },
"Operation": { "value": "Issue" },
"InventoryID": { "value": "PEARJAM96" },
"OrderQty": { "value": 1 },
"UOM": { "value": "PIECE" },
"WarehouseID": { "value": "RETAIL" },
"AutoCreateIssue": { "value": false }
}
]
}
Usage Notes for an RMA Order with Shipments
If a customer is returning an inventory item for replacement at a different price, a point-of-sale (POS) system can create an RMA order to perform this customer return. (An RMA order is a return order of the RM predefined order type.) Shipments for both the return and the replacement are performed.
Consider the following example. In an online shop, a customer bought a 32-ounce glass bottle, which was shipped to the customer. Then the customer decides to return this bottle. In the online shop, the customer creates an order that includes both the returned item and a 16-ounce glass bottle that the customer wants to buy. Thus, the customer would like to buy a smaller bottle and to return the larger one.
To process a return for replacement with shipments, the POS system performs the following steps:
- For the returned items that are linked to a sales order and shipment, creates an
RMA order (return order of the RM type), and adds lines to the order for
the following items:
- The returned items, which it selects from the previously issued sales invoice
- The newly ordered items
- Creates a shipment for the newly ordered items and confirms this shipment.
- Creates an incoming shipment with the Receipt operation type for the returned items and confirms this shipment.
- Creates sales invoices and releases them. For the return, the system generates an invoice of the Credit Memo type; for the shipment, the system generates a sales invoice of the Invoice type.
To learn about the execution of this process in MYOB Acumatica, see Returns for Replacement at Another Price: General Information.
You can use the following sequence of requests to implement this process through the REST API:
- Create an RMA Order for a Return
- For the return:
- For the replacement:
