/// <summary>
        /// Get Wechat Card QRCode url.
        /// </summary>
        /// <param name="cardId">Wechat Card Id</param>
        /// <param name="cardCode">Custom Card Code, optional. 20 characters.</param>
        /// <param name="isUnique">Is code unique. If true then the code can only be scanned once.</param>
        /// <returns></returns>
        public static string GetCardQRCodeUrl(string cardId, int expireSeconds, string cardCode = null, bool isUnique = true)
        {
            QRCodeRequest qrCodeRequest = new QRCodeRequest();

            qrCodeRequest.ActionName         = QRCodeRequest.ActionNames.QR_CARD.ToString();
            qrCodeRequest.ExpireSeconds      = expireSeconds;
            qrCodeRequest.ActionInfo.CardObj = new QRCodeRequest.QRCodeActionInfo.Card()
            {
                CardCode     = cardCode,
                CardId       = cardId,
                IsUniqueCode = isUnique
            };

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format(GetQRCodeUrlTemplate, AccessTokenData));

            request.Method      = "POST";
            request.ContentType = "application/json; charset=utf-8";
            Stream stream = request.GetRequestStream();

            DataContractJsonSerializer serRequest = new DataContractJsonSerializer(typeof(QRCodeRequest));

            serRequest.WriteObject(stream, qrCodeRequest);
            stream.Close();

            HttpWebResponse res         = (HttpWebResponse)request.GetResponse();
            string          respondText = new StreamReader(res.GetResponseStream()).ReadToEnd();


            Error error = JsonTypedSerializer <Error> .Deserialize(respondText);

            if (error.ErrorCode != 0)
            {
                throw new InvalidOperationException(string.Format("Error: {0}|{1}", error.ErrorCode, error.ErrorMessage));
            }

            QRCodeResponse response = JsonTypedSerializer <QRCodeResponse> .Deserialize(respondText);;

            return(string.Format(ShowQRCodeUrlTemplate, response.Ticket));
        }
        /// <summary>
        /// Get Wechat Permanant QRCode url.
        /// </summary>
        /// <param name="sceneString">Wechat Scene String, which is the text code embedded in the QR graph.</param>
        /// <returns></returns>
        public static string GetPermanantQRCodeUrl(string sceneString)
        {
            QRCodeRequest qrCodeRequest = new QRCodeRequest();

            qrCodeRequest.ActionName       = QRCodeRequest.ActionNames.QR_LIMIT_STR_SCENE.ToString();
            qrCodeRequest.ExpireSeconds    = 0;
            qrCodeRequest.ActionInfo.Scene = new QRCodeRequest.QRCodeActionInfo.QRCodeScene()
            {
                SceneString = sceneString
            };

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format(GetQRCodeUrlTemplate, AccessTokenData));

            request.Method      = "POST";
            request.ContentType = "application/json; charset=utf-8";
            Stream stream = request.GetRequestStream();

            DataContractJsonSerializer serRequest = new DataContractJsonSerializer(typeof(QRCodeRequest));

            serRequest.WriteObject(stream, qrCodeRequest);
            stream.Close();

            HttpWebResponse res         = (HttpWebResponse)request.GetResponse();
            string          respondText = new StreamReader(res.GetResponseStream()).ReadToEnd();


            Error error = JsonTypedSerializer <Error> .Deserialize(respondText);

            if (error.ErrorCode != 0)
            {
                throw new InvalidOperationException(string.Format("Error: {0}|{1}", error.ErrorCode, error.ErrorMessage));
            }

            QRCodeResponse response = JsonTypedSerializer <QRCodeResponse> .Deserialize(respondText);;

            return(string.Format(ShowQRCodeUrlTemplate, response.Ticket));
        }