Asp.net Paypal集成测试支付

本文关键字:集成测试 Paypal net Asp | 更新日期: 2023-09-27 18:28:28

我目前正在使用asp.net与贝宝进行集成。我在论坛上看过其他教程,但它似乎很旧。贝宝今天有了一个新的用户界面,这就是为什么我遇到了一些困难。我已经注册了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是我沙盒中的商业帐户。重定向后,我在沙箱中使用我的个人帐户测试并购买了此项目。当我尝试登录时,会出现"请检查您的电子邮件地址和密码,然后再试一次",我确信我已经正确创建了我的个人帐户。抱歉我英语不好。

Asp.net Paypal集成测试支付

URL必须是

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

如果您正在使用PayPal SandBox测试帐户,请确保使用上述链接。