---
title: Create Customer
slug: payments/2adj-create-customer
description: Learn how to create a customer using the Breadwinner Global API. This document includes Apex code that creates a map to store customer information like name, email, phone number, and billing address. Discover how to serialize the data into a JSON request
docTags: 
createdAt: 2023-11-07T11:06:27.888Z
---

To create a Customer in the Payment Processor, use the action "CreateCustomer" and pass the Customer data in the RequestJSON under "customers."

:::hint{type="info"}
Note: You can only create one record at a time.
:::

The following is an example of creating a Customer where we are setting every possible field (See [Customer](docId\:DM98bI1-BrwesrPxuduVe) for the available fields). The response will return the response from the Payment Processor, which includes the  Customer ID (*internalId*) plus the newly created Salesforce ﻿Customer ID (*salesforceId*).

:::CodeblockTabs
```apex
//  Create a Map to store all the data of a Customer
  Map<String, Object> customerMap = new Map<String, Object>();
  customerMap.put('customerName', 'John Doe');
  customerMap.put('email', 'test@test.com');
  customerMap.put('customerPhone', '616-928-5098');
  
  //  Create Stripe Address data
  customerMap.put('billingStreetAddress1', '123 Main Street');
  customerMap.put('billingStreetAddress2', 'Apt 2');
  customerMap.put('billingCity', 'Anytown');
  customerMap.put('billingState', 'NY'); 
  customerMap.put('billingCountry', 'US');
  customerMap.put('billingPostalCode', '12345');

  //  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', 'CreateCustomer');
  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);

```

```json
{
  Action=CreateCustomer,
  timestamp=1599492195202, 
  validRequest=true,
  version=1.0, 
  statusCode=200,
  responseJSON={
    "customers": [
      {
        "taxType": null,
        "taxId": "",
        "taxExempt": "none",
        "shippingStreetAddress2": null,
        "shippingStreetAddress1": null,
        "shippingState": null,
        "shippingPostalCode": null,
        "shippingPhone": null,
        "shippingCountry": null,
        "shippingCity": null,
        "shippingAddressee": null,
        "salesforceName": "John Doe",
        "salesforceId": "salesforceId",
        "salesforceContact": null,
        "salesforceAccount": null,
        "referenceId": null,
        "processorType": "processorType",
        "processorOrgName": "processorOrgName",
        "processorOrgId": "processorId",
        "processorCustomerId": "processorCustomerId",
        "noAssociatedSFContact": false,
        "noAssociatedSFAccount": false,
        "liveMode": false,
        "lastName": null,
        "language": null,
        "invoicePrefix": "1F55E486",
        "hasSuccessfulPayments": false,
        "firstName": null,
        "errorMessage": null,
        "email": "test@gmail.com",
        "description": null,
        "delinquent": false,
        "defaultSource": "",
        "customerPhone": "616-928-5098",
        "customerName": "John Doe",
        "customerId": "processorCustomerId-processorType-processorOrgId",
        "customerAccountBalance": 0.00,
        "custCurrency": null,
        "createdVia": "Breadwinner API",
        "createdDateInProcessor": "2022-06-02T07:52:21.000Z",
        "company": null,
        "billingStreetAddress2": "Apt 2",
        "billingStreetAddress1": "123 Main Street",
        "billingState": "NY",
        "billingPostalCode": "12345",
        "billingCountry": "US",
        "billingCity": "Anytown"
      }
    ]
  }
 }

```
:::

