import QRCode from 'qrcode';

export const createQrcode = (url: string, element: HTMLImageElement) => {
  if (!url) return;
  console.log('pay url', url);
  QRCode.toDataURL(
    url,
    {
      errorCorrectionLevel: 'H',
      type: 'image/jpeg',
      margin: 1,
      
      width: 300,
      color: {
        dark: '#000000',
        light: '#ffffff',
      },
    },
    function (err, url) {
      if (err) {
        console.log('err', err);
        throw err;
      }
      element.src = url;
    },
  );
};
