---
title: Create Transaction
slug: payments/tgrj-create-transaction
description: Learn how to create a transaction using the Breadwinner Global API with this example code snippet. Understand how to create a map of charge data including processorCustomerId, paymentMethodId, amount, chargeCurrency, description, and paymentMethodType. Se
docTags: 
createdAt: 2023-11-07T12:07:43.272Z
---

To create a Transaction in the Payment processor, use the action as ChargeProcessor and pass the Payment data in the RequestJSON under "Payments".

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

The following is an example of creating a Payment where we set every possible field (See[﻿](https://app.archbee.io/docs/-LIHUUnv_7XNQrtzHsKkC/hnjmkN99QxWdEafyYIFSq)﻿ [Transaction](docId\:XZUX8MG_AnYg7zKnpnErv) for all available fields).  The response will return the response from the Payment Processor, which includes the Payment ID (*internalId*), plus the newly created Salesforce Payment ID (*salesforceId*)

:::CodeblockTabs
```apex
Map<String, Object> chargeData = new Map<String, Object>();
        chargeData.put('processorCustomerId', 'processorCustomerId'); 
        chargeData.put('paymentMethodId', 'paymentMethodId'); 
       
        chargeData.put('amount', '123.12'); 
        chargeData.put('chargeCurrency', 'USD'); 
        chargeData.put('description', 'test payment'); 
        chargeData.put('paymentMethodType', 'Card'); 
                
        //  Initializing the RequestJSON Data to be passed.
        Map<String, Object> requestJSONMap = new Map<String, Object>();
        requestJSONMap.put('transactions', new List<Object>{chargeData});
        String reqJSON = JSON.serialize(requestJSONMap);
        
        Map<String, Object> reqObj = new Map<String, Object>();
        reqObj.put('version','1.0');
        reqObj.put('action','ChargeProcessor');
        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=ChargeProcessor,
  Version=1.0,
  statusCode=200,
  timestamp=1654158904112,
  validRequest=true.
  responseJSON={
    "transactions": [
      {
        "taxAmount": null,
        "status": "SUCCEEDED",
        "staffName": null,
        "source": "source",
        "salesforceId": "salesforceId",
        "salesforceContact": null,
        "salesforceAccount": null,
        "receiptUrl": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xR2I1TE1DRzkzNGZseHJYKLfs4ZQGMgZQ82sBe_U6LBa3h5-Am13_SoZaoFEPX86g6qsVsZ6mBt7qbBBfW3xjuuG54RObOx7jjMl4",
        "receiptNumber": null,
        "receiptEmail": null,
        "processorType": "processorType",
        "processorOrgId": "processorOrgId",
        "processorId": "processorId",
        "processorCustomerId": "processorCustomerId",
        "processingFee": null,
        "paymentMethodType": null,
        "paymentMethodId": null,
        "paymentIntentId": null,
        "locationId": null,
        "keyValue": null,
        "isChargeExept": null,
        "errorMessage": null,
        "description": "test payment",
        "customer": "customrId",
        "createdVia": "Breadwinner API",
        "createdDateInProcessor": "2022-06-02T08:35:02.000Z",
        "chargeStatus": null,
        "chargeCurrency": "USD",
        "captured": true,
        "billingStreetAddress2": "",
        "billingStreetAddress1": "",
        "billingPostalCode": "11111",
        "billingCountry": "",
        "billingCity": "",
        "applicationFee": null,
        "amountRefunded": 0.00,
        "amount": 123.12
      }
    ]
  }
}

```
:::

