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 instance URL>
is the URL of the MYOB Acumatica
instance (such as https://my.acumatica.com/MyInstance). You can omit the instance
name in the URL (that is, you can use https://my.acumatica.com) if the instance
is installed in the root of the website.PUT ?$expand=Details HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/24.200.001/SalesOrder
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: an RMA Order with Shipments
A point-of-sale (POS) system can create a return for replacement at another price (that is, an order of the RM predefined order type) to perform a customer return in which the customer returns an inventory item for replacement. Both the return and the replacement are shipped to the customer.
Consider the following scenario example. In the 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 a 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 in the order the lines for the
following items:
- The previously issued sales invoice that contains the returned items
- The newly ordered items
- Creates shipments for the newly ordered items and confirms these shipments.
- Creates incoming shipments with the Receipt operation type for the returned items and confirms these shipments.
- Creates sales invoices and releases the invoices. 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.
Execution of this process in MYOB Acumatica is described in 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 a return:
- For a replacement: