c# - Asp.net Paypal 集成测试支付

标签 c# asp.net paypal paypal-sandbox

我目前正在使用 asp.net 与 paypal 集成。我看过论坛中的其他教程,但它似乎很旧。 Paypal 今天有一个新的用户界面,这就是我遇到一些困难的原因。我已经注册了 developer.paypal.com 并在沙盒帐户中创建了业务类型和个人类型帐户。现在这是我的代码

string Server_URL = "https://www.paypal.com/ph/cgi-bin/webscr?";

//Assigning Cmd Path as Statically to Parameter
string cmd = "_xclick";

//Assigning business Id as Statically to Parameter
string business = "Test1@gmail.com";// Enter your business account here 

//Assigning item name as Statically to Parameter
string item_name = "Item 1";

//Passing Amount as Statically to parameter 
double amount = 30000.00;

//Passing Currency as Statically to parameter
string currency_code = "PHP";

string redirect = "";

//Pass your Server_Url,cmd,business,item_name,amount,currency_code variable.        
redirect += Server_URL;
redirect += "cmd=" + cmd;
redirect += "&business=" + business;
redirect += "&first_name=" + "Name";
redirect += "&item_name=" + item_name;
redirect += "&amount=" + amount;
redirect += "&quantity=1";
redirect += "&currency_code=" + currency_code;

redirect += "&return=" + ConfigurationManager.AppSettings["SuccessURL"].ToString();
redirect += "&cancel_return=" + ConfigurationManager.AppSettings["FailedURL"].ToString();

Response.Redirect(redirect);

我将这段代码放在一个按钮中,这样当该按钮被触发时,这段代码就会运行。 如您所见,Test1@gmail.com 是我在沙盒中的企业帐户。重定向后,我在我的沙盒中使用我的个人帐户来测试并购买了这个项目。当我尝试登录时,出现“请检查您的电子邮件地址和密码,然后重试”,我确定我已经正确创建了我的个人帐户。 抱歉我的英语不好。

最佳答案

网址必须是

string Server_URL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";

如果您使用的是 PayPal SandBox 测试帐户,请确保使用上面的链接。

关于c# - Asp.net Paypal 集成测试支付,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18347564/

相关文章:

php - Paypal Pro 不在 magento 中显示运输方式

c# - ASP.NET Core 在默认域 (*.azurewebsites.net) 上跨 Azure Web 应用程序共享身份 Cookie

c# - 如何删除 VS 2010 中的语言依赖性?

ASP.NET MVC : Tracking Page Views and view Duration

c# - 没有 MediaTypeFormatter 可用于读取 asp.net web api 中类型为 'Advertisement' 的对象

ruby - 沙盒中的 PayPal 支付 "Sender has insufficient funds"

c# - .NET 中 CIL 知识的优势

c# - 如何在WebAPI Controller 中接收动态数据

asp.net - 为什么单选按钮列表总是换行?

asp.net-mvc - Market Place Paypal 整合