如何使用asp.net向paypal发送多个项目

时间:2013-12-31 10:19:43

标签: c# asp.net vb.net paypal

您好我使用paypal sanbox整合asp.net网站。我可以将单项名称发送给PayPal。

但我不知道如何发送多个项目。我试图搜索很多但没有得到任何具体的答案。

请告诉我如何向paypal发送多个参数。

这是我的代码:

Protected Sub imgbtn_Click(sender As Object, e As ImageClickEventArgs) Handles imgbtn.Click

Dim qty As Integer = Request.QueryString("qty")
Dim Amount As String = Request.QueryString("price")
Dim ItemDescription As String = Request.QueryString("ItemDescription")
Dim redirectUrl As String = ""

'Mention URL to redirect content to paypal site
redirectUrl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" & ConfigurationManager.AppSettings("paypalemail").ToString()

'Product Name
redirectUrl += "&item_name=" + ItemDescription

'Product Amount
redirectUrl += "&amount=" + Amount

'Business contact paypal EmailID
redirectUrl += "&xxxxx-facilitator@gmail.com"

'Quantiy of product, Here statically added quantity 1
redirectUrl += "&quantity=" + qty.ToString()

'If transactioin has been successfully performed, redirect SuccessURL page- this page will be designed by developer
redirectUrl += "&return=" & ConfigurationManager.AppSettings("SuccessURL").Trim()"?item_name= & itemname


redirectUrl += "&cancel_return=" & ConfigurationManager.AppSettings("FailedURL").ToString()

Response.Redirect(redirectUrl)

这是代码,我可以将单个项目发送到paypal.But我有多个项目的gridview,所以我可以如何向paypal发送多个值。

请建议我。

1 个答案:

答案 0 :(得分:0)

找到答案无需使用

GridView.Rows.Count

just use a simple int to iterate 

int i = 0;
foreach(GridViewRow row in  temp_gridView.Rows)
{

box.Item_id = temp_gridView.Rows[i].Cells[0].Text;
box.Quantity = temp_gridView.Rows[i].Cells[1].Text;
box.Total = temp_gridView.Rows[i].Cells[2].Text;

i++;

}