如何从中继响应 URL (SIM) Authorize.Net asp.net 获取交易数据,但它说不支持这种请求?

发布于 2024-11-27 07:21:52 字数 1151 浏览 0 评论 0原文

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"https://test.authorize.net/gateway/transact.dll");
        byte[] param = Encoding.ASCII.GetBytes("x_login=5RV7a3kUww&x_tran_key=4SzL379Tbc7Nt4MP");
        string strRequest = Encoding.ASCII.GetString(param);
        // append PayPal verification code to end of string    

        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = strRequest.Length;

        //     req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(authKey)));
        //  req.Headers.Add("name","value");
        // send data back to PayPal to request verification
        StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), Encoding.ASCII);
        streamOut.Write(strRequest);
        streamOut.Close();
        // receive response from PayPal
        HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
        StreamReader streamIn = new StreamReader(resp.GetResponseStream());
        string strResponse = streamIn.ReadToEnd();
        streamIn.Close();
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"https://test.authorize.net/gateway/transact.dll");
        byte[] param = Encoding.ASCII.GetBytes("x_login=5RV7a3kUww&x_tran_key=4SzL379Tbc7Nt4MP");
        string strRequest = Encoding.ASCII.GetString(param);
        // append PayPal verification code to end of string    

        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = strRequest.Length;

        //     req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(authKey)));
        //  req.Headers.Add("name","value");
        // send data back to PayPal to request verification
        StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), Encoding.ASCII);
        streamOut.Write(strRequest);
        streamOut.Close();
        // receive response from PayPal
        HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
        StreamReader streamIn = new StreamReader(resp.GetResponseStream());
        string strResponse = streamIn.ReadToEnd();
        streamIn.Close();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮萍、无处依 2024-12-04 07:21:52

中继响应与服务器集成方法 (SIM) API 一起使用。这是他们托管的付款表格。您在发布的代码中没有使用 SIM 卡。您似乎正在使用高级集成方法 (AIM) API。 AIM 不适用于中继响应,因为您不需要它,因为用户永远不会离开您的站点。

我还看到评论提到 Paypal,这完全没有意义。我不知道为什么会出现这种情况。

Relay Response is used with the Server Integrated Method (SIM) API. That's their hosted payment form. You're not using SIM in the code you posted. It looks like you're using the Advanced Integration Method (AIM) API. AIM does not work with Relay Response because you don't need it since the user never leaves your site.

I also see comments mentioning Paypal which makes absolutely no sense. I'm not sure why that's even there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文