Skip to content

Create Dynamic QR Code for B2C Invoice#

E-invoicing is only for the B2B transactions. In e-invoicing QR codes are generated by the IRP and not by the taxpayer. However, under B2C invoices, a taxpayer can generate QR code using their own QR code. Taxpayer will have to display this QR on the invoice shared with the customers.

Route

/enriched/o/{flynn-version}/b2c-invoices

  • active ‘flynn-version’: v1.0
  • method: POST

URL Parameters#

Name Description Type
flynn-version version of the API
for example, v1.0
string

Headers#

All required headers to make an authenticated API call.

Request#

Example

{
  "invoice-details": {
    "amount": 11800,
    "date": "18/03/2021",
    "number": "I/20210318213929"
  },
  "supplier-details": {
    "bank-details": {
      "account-number": "xxxx007",
      "ifsc": "I0000000000000001"
    },
    "gstin": "27AAAPI3182M002",
    "upi-id": "example@ybl"
  },
  "tax-details": {
    "cess": 0,
    "cgst": 900,
    "igst": 0,
    "sgst": 900
  }
}

please remember we don’t do any validations - it is a client’s responsibility to share the correct details to display it to the end-user.

Json Schema#

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "Title": "Vayana Network Document",
  "Description": "Format for B2C QR Code Generation",
  "type": "object",
  "properties": {
    "invoice-details": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "integer"
        },
        "date": {
          "type": "string"
        },
        "number": {
          "type": "string"
        }
      },
      "required": [
        "amount",
        "date",
        "number"
      ]
    },
    "supplier-details": {
      "type": "object",
      "properties": {
        "bank-details": {
          "type": "object",
          "properties": {
            "account-number": {
              "type": "string"
            },
            "ifsc": {
              "type": "string"
            }
          },
          "required": [
            "account-number",
            "ifsc"
          ]
        },
        "gstin": {
          "type": "string"
        },
        "upi-id": {
          "type": "string"
        }
      },
      "required": [
        "bank-details",
        "gstin",
        "upi-id"
      ]
    },
    "tax-details": {
      "type": "object",
      "properties": {
        "cess": {
          "type": "integer"
        },
        "cgst": {
          "type": "integer"
        },
        "igst": {
          "type": "integer"
        },
        "sgst": {
          "type": "integer"
        }
      },
      "required": [
        "cess",
        "cgst",
        "igst",
        "sgst"
      ]
    }
  },
  "required": [
    "invoice-details",
    "supplier-details",
    "tax-details"
  ]
}

Response#

JSON#

When you have accept header set as application/json.

Sample Response Body

{
  "data": {
    "reference-id": "bda53dd2-a32a-40c7-8f43-6e9af442fa7c",
    "code": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADIAQAAAACFI5MzAAABtklEQVR4Xu2WUWrEMAxEDb6WQVcX+FqG7Dx5NwlL+ye1PzFpWOsFLE1GStvx22rfgXM95CGsvyTeWj/mnPoxhs3YVpB57LjN1VfrbGuIx07hofjc2yLi3SPs9n6wiCxFVhttVBLgDh6rGdsSgiXmtb68k0dYOlmlDqR9R/KJt47Xm+JLL1DLSgh6qlRlYD7MjWwqiFzY8QdtzP1ySC6RkMfCjIqbwn5Wmkv2e5OoHbOYBP5kkEtcKsJjVvA7tvkkahxdxeoZOivcmE9QkwpNTWXhkvPNpRJq41tBaKHqTdFMonay/c2gp8L0JQQdJagGEaLqdiqaTHTujg3EVJmnBtmE6z2R7D57U8kyncm5K564a51KYu6FR9RaMW2v3HKJ6X8GwyLRXP2uaCLZb81iuOpvcqsgUWXnS0G16GpFhDFOAqRDc10Z5BKZQp9YFWr4JUxfQhpu39NotG34AsLC8bIJRok8KggtG5No3+T+j6K5ZHI5Rw8KPm6K5hJHTllEzaVstKyOUJ4zLFp4pYrQV4w8p7NWEdGlDKSmZkQ02F3rPCIVO0nIJwfCbsvnk5/XQx7C+n/yAvs6Rn/Fj4oAAAAAAElFTkSuQmCC"
  }
}

How to use generate image from the given json?

The attribute code in the above representational response is Base64 encoded string of the png image. To re-create an image, first decode base64 string and get bytes array. Then use decode bytes to generate generate a png image.

Image (png)#

When you have accept header set as image/png.

Sample Response Image

QR Code

Image (bmp)#

When you have accept header set as image/bmp.

Sample Response Image

QR Code


Last update: August 17, 2022