我已经为 PayPal 创建了一个类,它非常适合添加单个项目,但是我现在正试图让它作为一个购物车工作,这样我就可以添加多个产品并使用我的徽标自定义页面。
任何人都可以提供任何关于我如何做到这一点的例子吗?我浏览了很多网站,但似乎没有一个能很好地解释。据我了解,我正在使用 PayPal Standard。
public static class PayPal
{
public static string _URLRedirect;
public static void ProcessPayment(int Amount, string ItemName)
{
const string Server_URL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";
const string return_URL = "https://www.paypal.com/xclick/Sample@gmail.com";
const string cancelreturn_URL = "http://www.PageWhenCancel.com/cc.fail.aspx";
//Assigning Cmd Path as Statically to Parameter
string cmd = "_xclick";
//Assigning business Id as Statically to Parameter
string business = "payments@xxx.xx.xx";// Enter your business account here
//Assigning item name as Statically to Parameter
string item_name = ItemName.ToString();
//Passing Amount as Statically to parameter
int amount = Amount;
//Passing Currency as Statically to parameter
string currency_code = "GBP";
string redirect = "";
//Pass your Server_Url,cmd,business,item_name,amount,currency_code variable.
redirect += Server_URL;
redirect += "cmd=" + cmd;
redirect += "&business=" + business;
redirect += "&item_name=" + item_name;
redirect += "&amount=" + amount;
redirect += "¤cy_code=" + currency_code;
redirect += "&return=" + return_URL;
redirect += "&cancel_return" + cancelreturn_URL;
//Redirect to the payment page
_URLRedirect = redirect.ToString();
}
}