// Create a Map to store all the data of a RMA
Map<String, Object> nsRMA = new Map<String, Object>();
nsRMA.put('classification', new Map<String, Object>{'internalId'=>'1'});
nsRMA.put('currencyRecord', new Map<String, Object>{'internalId'=>'1'});
nsRMA.put('department', new Map<String, Object>{'internalId'=>'1'});
nsRMA.put('discountItem', new Map<String, Object>{'internalId'=>'-6'});
nsRMA.put('discountRate', '-15');
nsRMA.put('entity', new Map<String, Object>{'internalId'=>'362'});
nsRMA.put('memo', 'Order 25');
nsRMA.put('otherRefNum', '4343399');
nsRMA.put('tranDate', DateTime.newInstance(2020, 09, 07).getTime()/1000);
// Initializing the RMA Custom Fields
List<Object> rmaCustomFieldList = new List<Object>();
Map<String, Object> rmaCustomField = new Map<String, Object>();
rmaCustomField.put('fieldType', 'select');
rmaCustomField.put('scriptId', 'custbody_customlist');
rmaCustomField.put('valueLookup', new Map<String, Object>{'internalId'=>'2'});
rmaCustomFieldList.add(rmaCustomField);
// Adding the RMA Custom Fields
nsRMA.put('customFieldList', new Map<String, Object>{'customField'=>rmaCustomFieldList});
// Initializing the RMA Line Items
List<Object> lineItemList = new List<Object>();
Map<String, Object> lineItem = new Map<String, Object>();
lineItem.put('description', 'A weapon for shooting arrows');
lineItem.put('item', new Map<String, Object>{'internalId'=>'239'});
lineItem.put('quantity', 1);
// Initializing the Line Item custom fields
List<Object> liCustomFieldList = new List<Object>();
Map<String, Object> liCustomField = new Map<String, Object>();
liCustomField.put('fieldType', 'boolean');
liCustomField.put('scriptId', 'custcol_checkbox');
liCustomField.put('value', 'true');
liCustomFieldList.add(liCustomField);
// Adding the RMA Line Item Custom Fields
lineItem.put('customFieldList', new Map<String, Object>{'customField'=>liCustomFieldList});
lineItemList.add(lineItem);
// Adding the Line Items to RMA
Map<String, Object> rmaLineitemList = new Map<String, Object>();
rmaLineitemList.put('item', lineItemList);
nsRMA.put('itemList', rmaLineitemList);
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('returnAuthorizations', new List<Object>{nsRMA});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'createReturnAuthorization');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);