PayPal与 asp.net 站点PayPal Web 服务的集成

本文关键字:PayPal 服务 集成 Web 站点 asp net | 更新日期: 2023-09-27 18:34:01

我现在从不使用任何支付网关......但是现在我需要为我的购物车集成PayPal。用户可以从那里购买多个数据并从PayPal网站为多个项目付款。我正在寻找如何将PayPal集成到我的网站中。我认为PayPal必须有用于支付集成的网络服务。我在谷歌上搜索向PayPal提交多个购物车项目数据。我得到了代码,但这不是很好的解决方案

String url;
url= “https://www.paypal.com/us/cgi-bin/webscr?” ;
url+= “cmd=_xclick”;
url+= “&business=vikvish@yahoo.co.in”;
url+= “&item_name=Sample_testing”;
url+= “&amount=10.50″;
url+= “&quantity=2″;
url+= “&return=http://www.google.com”;
url += “&cancel_return=http://www.rediffmail.com”;
url+= “&currency_code=USD”;
Response.Redirect(url);

这样我就不想将多个购物车数据发送到PayPal站点。

这里的另一种方式。

protected void btnPayPal_Click(object sender, ImageClickEventArgs e)
{
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head>");
System.Web.HttpContext.Current.Response.Write(
"</head><body onload='document.form1.submit()'>");
System.Web.HttpContext.Current.Response.Write(
"<form action='https://www.paypal.com/cgi-bin/webscr' " +
"name='form1' method='post'>");
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='cmd' value='_xclick'>");
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='business' " +
"value='bob@domain.com'>");
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='lc' value='US'>");
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='item_name' value='Widget'>");
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='amount' value='100.00'>");
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='currency_code' value='USD'>
System.Web.HttpContext.Current.Response.Write(
"<input type='hidden' name='bn' " +
"value='PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest'>
System.Web.HttpContext.Current.Response.Write(
"<input type='image' " +
"src='https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif' " +
"border='0' name='submit' alt=''>");
System.Web.HttpContext.Current.Response.Write(
"<img alt='' border='0' " +
"src='https://www.paypal.com/en_US/i/scr/pixel.gif' " +
"width='1' height='1'>");
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");
System.Web.HttpContext.Current.Response.End();

}

这样,我们就可以从代码隐藏将购物车项目数据发送到PayPal站点。

我需要将我的多个购物车项目发布到 PayPal 通过PayPal网络服务。因此,请从头开始详细告诉我所有步骤。我需要做什么。我是否需要在PayPal端创建买方和卖方两个帐户。如何获取PayPal Web 服务 URL。我需要示例PayPal Web 服务代码来将我的多个购物车PayPal项目数据发送到PayPal。测试如何一切正常。什么是PayPal沙盒网址。我是否需要向沙盒 URL 提供有效的信用卡号。如果是,那么从沙盒 URL 测试后,钱将如何再次返还。请详细讨论所有要点,并在所有阶段逐步指导我使用示例代码,例如从帐户创建到Web服务使用以将多个购物车数据发送到PayPal站点。谢谢

PayPal与 asp.net 站点PayPal Web 服务的集成

PayPal在不同的平台上为其所有产品提供了定义良好且公开可用的SDK。

阅读他们的文档并遵循他们记录的 API 说明对您很有帮助,而不是试图拼凑一个"解决方法" - 是的,您可以轻松地这样做(为 HTML 表单创建解决方法(,但您可能会错过安全性 - 例如,在上面的代码中,任何人都可以检查和篡改您的所有 FORM POST 值。