> For the complete documentation index, see [llms.txt](https://docs.cleartax.in/cleartax-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cleartax.in/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/cleartax-e-invoicing-apis-xml-schema/b2c-e-invoicing-apis/b2c-qr-code-apis.md).

# Generate B2C Payment QR Code

You can generate a B2C QR code by sending a **`POST`** request to B2C QR code API.&#x20;

### Request Method

POST

### **Request URL**

```
{{HOST}}/einv/v1/b2c/generate-qr-code
```

### Request Headers

<table><thead><tr><th>Parameter</th><th width="162">Data Type</th><th>Field Validations</th><th>Description</th></tr></thead><tbody><tr><td>X-Cleartax-Auth-Token</td><td>String</td><td>NA</td><td>Mandatory. The auth token generated from ClearTax user id and password.</td></tr><tr><td>Content-Type</td><td>String</td><td>NA</td><td>Mandatory. This will always be <br>"application/json" for JSON</td></tr><tr><td>Gstin</td><td>String</td><td>NA</td><td>Mandatory. GSTIN number for the user.</td></tr></tbody></table>

### Request Path Params <a href="#request-path-params" id="request-path-params"></a>

There are no path parameters for this API.

### Request Query Params <a href="#request-query-params" id="request-query-params"></a>

There are no query parameters for this API.

### **Request Body** <a href="#request-body" id="request-body"></a>

| Parameter   | Data Type | Field Validations | Description                                                                                                                                            |
| ----------- | --------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| transaction | Object    | ​NA               | Mandatory.[ E-Invoice Object](https://docs.cleartax.in/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/resources-and-master/e-invoice-object). |

### Response Status Codes

| HTTP Status Code | Description                                                                  |
| ---------------- | ---------------------------------------------------------------------------- |
| 200              | For a successfully processed request (may be a success or validation error). |
| 401              | If the user is not authenticated for the operation.                          |
| 403              | If the user is not authorized for the operation.                             |
| 500              | If there are any unhandled exceptions on the Clear side.                     |

### Response Schema

| Parameter       | Data Type | Field Validations | Description                                                                     |
| --------------- | --------- | ----------------- | ------------------------------------------------------------------------------- |
| transaction\_id | String    | NA                | Created by ClearTax. To be used in print/delete APIs.                           |
| qr\_code        | String    | NA                | QR code string in base 64 format. Value will be null in negative case scenario. |
| raw\_qrCode     | String    | NA                | Always be Null. Can be ignored.                                                 |
| error           | List      | NA                | List of Error objects. Will be null in a successful API call.                   |

#### Error Details Object

| Parameter      | Data Type | Field Validations | Description                        |
| -------------- | --------- | ----------------- | ---------------------------------- |
| error\_code    | Number    | NA                | Specific code as per the error.    |
| error\_message | String    | NA                | Specific message as per the error. |
| error\_source  | String    | CLEARTAX          | Source of the error.               |

### Sample Request and Response

#### Request

```json
  {
    "transaction": {
      "Version": "1.1",
      "TranDtls": {
        "TaxSch": "GST",
        "SupTyp": "B2C",
        "RegRev": "Y",
        "EcmGstin": null,
        "IgstOnIntra": "N"
      },
      "DocDtls": {
        "Typ": "INV",
        "No": "TESTB2C5",
        "Dt": "09/05/2023"
      },
      "SellerDtls": {
        "Gstin": "29AAFCD5862R000",
        "LglNm": "NIC company pvt ltd",
        "TrdNm": "NIC Industries",
        "Addr1": "5th block, kuvempu layout",
        "Addr2": "kuvempu layout",
        "Loc": "GANDHINAGAR",
        "Pin": 560037,
        "Stcd": "29",
        "Ph": "9000000000",
        "Em": "abc@gmail.com"
      },
      "BuyerDtls": {
        "Gstin": "",
        "LglNm": "XYZ company pvt ltd",
        "TrdNm": "XYZ Industries",
        "Pos": "12",
        "Addr1": "7th block, kuvempu layout",
        "Addr2": "kuvempu layout",
        "Loc": "GANDHINAGAR",
        "Pin": 562160,
        "Stcd": "29",
        "Ph": "91111111111",
        "Em": "xyz@yahoo.com"
      },
      "DispDtls": {
        "Nm": "ABC company pvt ltd",
        "Addr1": "7th block, kuvempu layout",
        "Addr2": "kuvempu layout",
        "Loc": "Banagalore",
        "Pin": 562160,
        "Stcd": "29"
      },
      "ShipDtls": {
        "Gstin": "",
        "LglNm": "CBE company pvt ltd",
        "TrdNm": "kuvempu layout",
        "Addr1": "7th block, kuvempu layout",
        "Addr2": "kuvempu layout",
        "Loc": "Banagalore",
        "Pin": 562160,
        "Stcd": "29"
      },
      "ItemList": [
        {
          "SlNo": "1",
          "PrdDesc": "Rice",
          "IsServc": "N",
          "HsnCd": "10019920",
          "Barcde": "123456",
          "Qty": 100.345,
          "FreeQty": 10,
          "Unit": "BAG",
          "UnitPrice": 99.545,
          "TotAmt": 9988.84,
          "Discount": 10,
          "PreTaxVal": 1,
          "AssAmt": 9978.84,
          "GstRt": 12.0,
          "IgstAmt": 1197.46,
          "CgstAmt": 0,
          "SgstAmt": 0,
          "CesRt": 5,
          "CesAmt": 498.94,
          "CesNonAdvlAmt": 10,
          "StateCesRt": 12,
          "StateCesAmt": 1197.46,
          "StateCesNonAdvlAmt": 5,
          "OthChrg": 10,
          "TotItemVal": 12897.7,
          "OrdLineRef": "3256",
          "OrgCntry": "AG",
          "PrdSlNo": "12345",
          "BchDtls": {
            "Nm": "123456",
            "ExpDt": "05/05/2023",
            "WrDt": "05/05/2023"
          },
          "AttribDtls": [
            {
              "Nm": "Rice",
              "Val": "10000"
            }
          ]
        }
      ],
      "ValDtls": {
        "AssVal": 9978.84,
        "CgstVal": 0,
        "SgstVal": 0,
        "IgstVal": 1197.46,
        "CesVal": 508.94,
        "StCesVal": 1202.46,
        "Discount": 10,
        "OthChrg": 20,
        "RndOffAmt": 0.3,
        "TotInvVal": 12908,
        "TotInvValFc": 12897.7
      },
      "PayDtls": {
                "Nm": "ABCDE",
                "AccDet": null,
                "Mode": "Cash",
                "FinInsBr": null,
                "PayTerm": null,
                "PayInstr": null,
                "CrTrn": null,
                "DirDr": null,
                "CrDay": null,
                "PaidAmt": null,
                "PaymtDue": null,
                "PayeeUPI": "mehrotra@prakhar"
         },
      "RefDtls": {
        "InvRm": "TEST",
        "DocPerdDtls": {
          "InvStDt": "01/05/2023",
          "InvEndDt": "05/05/2023"
        },
        "PrecDocDtls": [
          {
            "InvNo": "DOC/002",
            "InvDt": "01/05/2023",
            "OthRefNo": "123456"
          }
        ],
        "ContrDtls": [
          {
            "RecAdvRefr": "Doc/003",
            "RecAdvDt": "01/05/2023",
            "Tendrefr": "Abc001",
            "Contrrefr": "Co123",
            "Extrefr": "Yo456",
            "Projrefr": "Doc-456",
            "Porefr": "Doc-789",
            "PoRefDt": "01/05/2023"
          }
        ]
      },
      "ExpDtls": {
        "ShipBNo": "A-248",
        "ShipBDt": "01/05/2023",
        "Port": "INABG1",
        "RefClm": "N",
        "ForCur": "AED",
        "CntCode": "AE"
      },
      
      "custom_fields": {
      "customfieldLable1": "CustomFieldValue1",
      "customfieldLable2": "CustomFieldValue2",
      "customfieldLable3": "CustomFieldValue3"
    }
    }
  }
```

#### Response (Success)&#x20;

**HTTP Status Code: 200 OK**

```json
{
    "transaction_id": "29AAFCD5862R000_TESTB2C5_INV_2023",
    "qr_code": "iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCAQAAAABUY/ToAAAG70lEQVR4Xu2bQY7qSBBEE7FgyRF8E7gYkpF8MbgJR+ilF4iceJFmZppuyaO/mUW6pKbbropaxM+MisziR/7huMXnm/86NuTa2JBrY0OujQ25Njbk2tiQa2NDro0NuTYW5C0iDq/j9IhdPofMr/Ghx2vkKy7DIXNiid7dv7Rw1xF5149ej4/U+uFwO055yK/LECfB9TEJxBJtWYv7Ib9iEJnPIeKYDyGvMUPhvBN8PrPHOa+DSL+E9+iJvGvBOw6fw3xS4CURKeT+4TiMc29k5jUqtATn0fBYEhIkVHdFJvkppHgcExkLQMpUCCZd57Pe/ZafTZAiMxx9qx9vqrshPchKlJ05/QXVsVNYittnQLAy9Z/VzZDidtD6K3oulnnEJ1TOegB/C1pHJKskT2POwQIcgxXMWyohZRv4a464RE/kMnexuQwtGB/BHgdPvABxABKMZSDaIVFxh5ZZhlttJE8V8K0PideNYHwdvbwh0jaTVZxzeE1vJJ9wTiXkTh+in/yE9HNLpN7IGMhSLkKVVHR2UvvEg5dX1+P4qWBdkEdzu08TVxmIZEnGVAfLl4cnyNSP/OyCvInW+URCwp7I5ChUugalirNyxjFoyeT1/ZBIFtw6DYMD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yHSpYojTVk52VPRRrHrnJi9LK6zJZLXysB9HYC2lAeMOPUKLe1puUIC9MODtUA6P/GVs9sAfBBzqJXfWdoUfeTnMpohJVSOuX9lZRV4pKu1TBJvi8VsR2RyLeIMtIwpKwm3JyEoS36neUKV90t+dkHSVEpMwEzD1h0A75GWNix5UPiaVkjviAzyc+KFgowit2zmOfEJFnqkjbCMb9HXBXlzP+ltJOE2nalJfrpP6YqOzX9kdg+kM1C0PuoAhGBiTpNfJfSVn4Sg+e6IdPWGZNlTWdB4dwe5M1K7ZYlXRyTRJ1FHz30HgHjZZgL3VwGQd9crvGuIlImSfwqas9y5nclPdCvwnx7OSvkE79sQeafFdsc6oVF6GySk3i3KHoM1XpvHz/xsgay/CcE4mkdl6s2dJRsIXwSgYEx8vwPoghSZgdc0d/4L66Rh8bphGzgKa4I4bIck5Tj2qpVUwUg7cqntmOWMRPfrsR/SdwCE1gluoXrGHfC/GyF4SlcuC/NtkapNbCQfenENKroh/SUIDKdZDvb9hds2SO5jdxZ1TLdd552NaBd4N2/eFKkfr5JGjWj81aL+cCuumtuuV+6/+IQeSBLS4iUTQFknuMxlEH1LuqJvzt7fTocGyD8YG3JtbMi1sSHXxoZcGxtybWzItbEh18aGXBv/C/IvesN+XciFDysAAAAASUVORK5CYII=",
    "raw_qrCode": null,
    "error": null
}
```

#### Response (Failure)

**HTTP Status Code: 200 OK**

```json
{
    "transaction_id": "29AAFCD5862R000_WARB2C6_INV_2023",
    "qr_code": null,
    "raw_qrCode": null,
    "error": {
        "errors": [
            {
                "error_code": "107",
                "error_message": "null : UPI Id can not be left blank",
                "error_source": "CLEARTAX"
            }
        ]
    }
}
```

### API Validations

Currently there are no known validations for this API.

### API Constraints

Payee UPI Id is mandatory to generate B2C QR Code.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cleartax.in/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/cleartax-e-invoicing-apis-xml-schema/b2c-e-invoicing-apis/b2c-qr-code-apis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
