web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

KSA e-invoicing QR code generation using X++

(0) ShareShare
ReportReport
Posted on by 133
Dear experts,
 
I am working on Saudi e-invoicing QR code generation.
To generate QR code, below steps involved
1. Convert Seller, VAT, amounts details to hexadecimal format
2. Create TLV format to converted Hexadecimal values
3. Convert TLV string to Base64
4. Create QR code to Base64
 
Till step 2 I am able to achieved but converting TLV string to Bse64 I am unable to achieved.
I wrote below code to convert string to Base but not able to achieve desired result: 
 
        tlvstR = tlvstr + tlvstr2 +tlvstr3 +tlvstr4 +tlvstr5;
        // tlvstr = hex;
        // convert string to stream
        System.Text.Encoding    encodingUTF8;
        encodingUTF8 = System.Text.Encoding::get_UTF8();
        Byte[] bytes = encodingUTF8.GetBytes(tlvstr);
        memoryStream = new System.IO.MemoryStream(bytes);
        qrCodeBase64 = System.Convert::ToBase64String(memoryStream.ToArray());
 
 
Example:
Lets assume I have TLV value is 010c426f62732
Actual Base64 converted value: NTA2MTcyNjE3MzY4NzU3MjYxNkQ=
Expected Base64 converted value: AQxCB2JZlFJIY29yZHMCDzMxMDEy
 
Please advice where I am doing mistake and how I should get the expected Base64 values
 
 
I have the same question (0)
  • Martin Dráb Profile Picture
    235,838 Most Valuable Professional on at
    KSA e-invoicing QR code generation using X++
    By the way, please look at your older threads. You're getting replies and you don't respond to people who're trying to help you. Please react to them and verify answers when you get them. If you don't know that you should verify answers or how, please refer to Suggested and verified forum answers.
  • Martin Dráb Profile Picture
    235,838 Most Valuable Professional on at
    KSA e-invoicing QR code generation using X++
    Where did you get the expected value? It looks wrong to me. I tried base64encode.org and got a different result: MDEwYzQyNmY2MjczMg==.
     
    Your expected value can't be decoded to anything meaningful.
     
    Your "actual" value encodes 5061726173687572616D, which doesn't match your alleged input.
     
    By the way, the step where you take a byte array, put it into a stream and then convert the stream back to a byte array doesn't look useful to me.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 708 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 589 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 553

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans