gpt4 book ai didi

asp.net - Paypal 多参数返回,cancel_return urls

转载 作者:太空宇宙 更新时间:2023-11-03 16:35:52 26 4
gpt4 key购买 nike

我在 ASP.NET 应用程序中进行简单的 Paypal 支付集成,我尝试为成功和取消构建返回查询字符串,但它不起作用,因为我在查询字符串中发送了多个参数

string returnUrl = ConfigurationManager.AppSettings["PayPalSandBoxUrl"] + "&business=" + email;
returnUrl += "&amount= 100";
returnUrl += "&item_name=Invoice to somebody";
// the problem goes in following params
returnUrl += "&return=" + ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?param1=" + param1 + "&param2=" + param2 ;
returnUrl += "&cancel_return=" + ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?cancel=true&param1=" + param1;

我认为 paypal 请求参数和返回查询参数之间有些混淆,对此有什么解决方案吗??

最佳答案

当您在 URL 参数上添加包含可能混淆真实参数的符号时,如 ?&/ 等符号,你必须用 UrlEncode 对它们进行编码

所以让你的字符串为:

string returnUrl = 
ConfigurationManager.AppSettings["PayPalSandBoxUrl"]
+ "&business=" + HttpServerUtility.UrlEncode(email);
returnUrl += "&amount= 100";
returnUrl += "&item_name=" + HttpServerUtility.UrlEncode("Invoice to somebody");
// the problem goes in following params
returnUrl += "&return="
+ HttpServerUtility.UrlEncode(ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?param1=" + param1 + "&param2=" + param2) ;
returnUrl += "&cancel_return="
+ HttpServerUtility.UrlEncode(ConfigurationManager.AppSettings["Domain"] + "Payment.aspx?cancel=true&param1=" + param1 );

关于asp.net - Paypal 多参数返回,cancel_return urls,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15322148/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com