Update Customer
1 min
The following is an example of updating the Customer where we change some fields. (See Customer for all available fields). The Processor Customer ID (processorCustomerId) is required to update the customer.
Note: You can only update one record at a time
The response returns the complete customer information, which you can see in our example.
// Create a Map to store all the data of a Customer
Map<String, Object> customerMap = new Map<String, Object>();
customerMap.put('processorCustomerId', 'processorCustomerId');
customerMap.put('customerName', 'Johnny Doe');
customerMap.put('email', '[email protected]');
customerMap.put('customerPhone', '616-928-5099');
// Create Stripe Address data
customerMap.put('line1', '124 Main Street');
customerMap.put('line2', 'Apt 3');
customerMap.put('city', 'Anytown');
customerMap.put('state', 'NY');
customerMap.put('postal_code', '12346');
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('customers', new List<Object>{customerMap});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'UpdateCustomer');
reqObj.put('processorId', 'processorId');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = bw_payments.BreadwinnerPaymentsAPI.call(reqObj);
System.debug(resp);