ASP.NET PayPal集成测试付款

4

我目前正在使用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 是我沙箱中的商业账户。在重定向之后,我使用了我的个人沙箱账户来测试和购买此商品。但是当我尝试登录时,出现了“请检查您的电子邮件地址和密码,然后再试一次”的提示,我确定已经正确创建了我的个人账户。 抱歉我的英语不好。
1个回答

3

URL必须是有效的

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

如果您正在使用PayPal沙盒测试账户,请确保使用上面的链接。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接