---
title: Create
slug: quickbooks/9yy4-create
description: Learn how to create a payment, set essential fields, and interact with the Breadwinner Global API using this comprehensive example. Access the QuickBooks Payment ID and Salesforce Payment ID, transaction date, and currency details in the response for effe
docTags: 
createdAt: 2021-10-29T05:37:19.000Z
---

The following is an example of create Payment (See [Payment](docId\:ASRn2GZJqlQI_5JeXDwaa) for the available fields). The response will return the exact request data plus the new QuickBooks Payment Id (Id) and the newly created Salesforce Payment Id (salesforceID).

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

:::CodeblockTabs
Request

```apex
//  Create a Map to store all the data of a Payment
Map<String, Object> paymentMap = new Map<String, Object>(); 
    paymentMap.put('TotalAmt','100');
    paymentMap.put('DisplayName','Breadwinner Inc');
    paymentMap.put('CustomerRef' , new Map<String, Object>{'value' => '99'});

//  Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
    requestJSONMap.put('payments', new List<Object>{paymentMap});
    String reqJSON = JSON.serialize(requestJSONMap);

Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'createPayment');
    reqObj.put('requestJSON', reqJSON);
    //Required, if QuickBooks Multi-Org is enabled in Breadwinner. 
    reqObj.put('qbOrgId', '4620816365285051610');

//  Placing a request to Breadwinner Global API
Map<String, Object> respMap = breadwinner_qbo.BreadwinnerQBAPI.call(reqObj);
System.debug(respMap);
```

Response

```json
{
   action=createPayment,
   responseJSON={
      "statusCode":200,
      "payments":[
         {
            "UnappliedAmt":100.00,
            "TxnDate":"2022-08-22",
            "TotalAmt":100.00,
            "SyncToken":"0",
            "sparse":false,
            "MetaData":{
               "LastUpdatedTime":"2022-08-22T03:41:03-07:00",
               "CreateTime":"2022-08-22T03:41:03-07:00"
            },
            "Line":[
               
            ],
            "Id":"420",
            "DepositToAccountRef":{
               "value":"4"
            },
            "CustomerRef":{
               "value":"99",
               "name":"Invoice August Acc"
            },
            "CurrencyRef":{
               "value":"USD",
               "name":"United States Dollar"
            }
         }
      ]
   },
   timestamp=1661164863899,
   validRequest=true,
   version=1.0
}
```
:::

Do you need to link this payment to an invoice? See [example](docId:7lQj9mhNlUViF0yJSMWdC).



