// Create a Map to store all the data of a Customer
Map<String, Object> checkoutMap = new Map<String, Object>();
//checkoutMap.put('locationId',locationId); // if not entered, we will request to Square and fetch the main Location Id
checkoutMap.put('customerId',customerId);
checkoutMap.put('checkoutType', 'orderCheckout');
checkoutMap.put('allowTipping', true);
//Creating the line items
Map<String,Object> line_item = new Map<String,Object>();
line_item.put('quantity', '5');
line_item.put('unitPrice', '100');
line_item.put('itemCurrency', 'USD');
line_item.put('name', 'Ball');
line_item.put('note', 'To play cricket');
Map<String,Object> line_item1 = new Map<String,Object>();
line_item1.put('quantity', '1');
line_item1.put('unitPrice', '75000');
line_item1.put('itemCurrency', 'USD');
line_item1.put('name', 'Laptop');
line_item1.put('note', 'For gaming');
List<Object> line_items = new List<Object>();
line_items.add(line_item);
line_items.add(line_item1);
// Adding the line items
checkoutMap.put('lineItems', line_items);
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('checkout', new List<Object>{checkoutMap});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'CreateCheckoutURL');
reqObj.put('processorId',processorOrgId);
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = bw_payments.BreadwinnerPaymentsAPI.call(reqObj);
System.debug(resp);