2013-08-21 177 views
4

我目前使用asp.net与贝宝集成。我已经看过论坛上的其他教程,但它似乎已经老了。 Paypal今天有一个新的UI,这就是为什么我有一些困难。我已注册w/developer.paypal.com,并在沙箱帐户中创建业务类型和个人类型帐户。现在这里是我的代码Asp.net贝宝集成测试付款

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 = "[email protected]";// 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); 

我把这段代码放在一个按钮中,所以当这个按钮被触发时,这段代码将运行。 正如您所见,[email protected]是我的沙箱中的商务帐户。重定向后,我用我的沙箱中的个人帐户来测试并购买此项目。当我尝试登录时,“请检查您的电子邮件地址和密码,然后重试”出现,并且我确信我已正确创建了我的个人帐户。 对不起,我的英语不好。

回答

3

该URL必须

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

如果您使用的是贝宝沙盒测试帐户,请确保您使用上面的链接。