Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将商品说明和价格传递到paypal页面asp_C#_Asp.net_Paypal - Fatal编程技术网

C# 如何将商品说明和价格传递到paypal页面asp

C# 如何将商品说明和价格传递到paypal页面asp,c#,asp.net,paypal,C#,Asp.net,Paypal,当用户点击“立即购买”按钮时,我试图在重定向到paypal页面时传递课程描述和价格。我不知道如何为此编写代码,而且我是asp.NETC#的新手。请帮帮我。下面是html和c代码 您在这里所做的只是构建一个支付标准URL。您所需要做的就是将添加到字符串中,以便让它们按照您的意愿显示 下面是一个粗略的例子,说明你想要得到什么 https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=some@email.com &a

当用户点击“立即购买”按钮时,我试图在重定向到paypal页面时传递课程描述和价格。我不知道如何为此编写代码,而且我是asp.NETC#的新手。请帮帮我。下面是html和c代码


您在这里所做的只是构建一个支付标准URL。您所需要做的就是将添加到字符串中,以便让它们按照您的意愿显示

下面是一个粗略的例子,说明你想要得到什么

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=some@email.com
&first_name=Tester&last_name=Testerson&amount=10.00
&return={your_return_url}&cancel={your_cancel_url}
&item_name_1=Test Widget #1&amount_1=5.00
&item_name_2=Test Widget #2&item_amount=5.00
我已经将其拆分为单独的行,以便在这里更容易阅读,但当然,这只是一个长字符串/URL


因此,您可能会在某种类型的项目数组中循环,您可以生成URL的该部分,然后将其附加到其余部分,就像您已经在这里做的那样

那么问题是什么呢?
protected void gvPayPalPrice_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "buy")
    {
        ImageButton ib = (ImageButton)e.CommandSource;
        int index = Convert.ToInt32(ib.CommandArgument);
        GridViewRow row =gvPayPalPrice.Rows[index];

        //Pay pal process Refer for what are the variable are need to send http://www.paypalobjects.com/IntegrationCenter/ic_std-variable-ref-buy-now.html

        string redirectUrl = "";

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

        //First name I assign static based on login details assign this value
        redirectUrl += "&first_name=Joe_Seller";

        //Product Name
       redirectUrl += "&item_name=" + CourseName.Text;

        //Product Amount
        redirectUrl += "&amount=" + CoursePrice.Text;

        //Business contact paypal EmailID
        redirectUrl += "&business=joekhaung@outlook.com";

        //Quantiy of product, Here statically added quantity 1
        redirectUrl += "&quantity=1";

        //If transactioin has been successfully performed, redirect SuccessURL page- this page will be designed by developer
        redirectUrl += "&return=" +      ConfigurationManager.AppSettings["SuccessURL"].ToString();


        //If transactioin has been failed, redirect FailedURL page- this page will be designed by developer
        redirectUrl += "&cancel_return=" + ConfigurationManager.AppSettings["FailedURL"].ToString();

        Response.Redirect(redirectUrl);
    }
}
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=some@email.com
&first_name=Tester&last_name=Testerson&amount=10.00
&return={your_return_url}&cancel={your_cancel_url}
&item_name_1=Test Widget #1&amount_1=5.00
&item_name_2=Test Widget #2&item_amount=5.00