簡體   English   中英

ASP.Net C中的PayPal網關集成#

[英]PayPal Gateway Integration in ASP.Net C#

我想在我的網站中集成PayPal Gateway。 我想要一個帶有所需參數的返回URL,就像其他支付網關一樣,它返回一些參數,說付款成功和交易ID等。

在web.config中

<appSettings>
    <add key="token" value="PW1BDVNqVPVanwduF_Tb2Ey91aT1Uhx1kL7HPc-7e8S-6AnUwSSHyasolSe"/>
    <add key="paypalemail" value="@gmail.com"/>
    <add key="PayPalSubmitUrl" value="https://www.paypal.com/cgi-bin/webscr"/>
    <add key="FailedURL" value="http://www.mrsoft.co.in/ProceedToPayment.aspx"/>
    <add key="SuccessURL" value="http://www.mrsoft.co.in/ProceedToPayment.aspx"/>
</appSettings>

protected void PayWithPayPal(string amount, string itemInfo, string name, string phone, string email, string currency)
{ 
    string redirecturl = "";

    //Mention URL to redirect content to paypal site
    redirecturl += "https://www.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=" + name;

    //City i assign static based on login user detail you change this value
    redirecturl += "&city=bhubaneswar";

    //State i assign static based on login user detail you change this value
    redirecturl += "&state=Odisha";

    //Product Name
    redirecturl += "&item_name=" + itemInfo;

    //Product Name
    redirecturl += "&amount=" + amount;

    //Phone No
    redirecturl += "&night_phone_a=" + phone;

    //Product Name
    redirecturl += "&item_name=" + itemInfo;

    //Address 
    redirecturl += "&address1=" + email;

    //Business contact id
    // redirecturl += "&business=k.tapankumar@gmail.com";

    //Shipping charges if any
    redirecturl += "&shipping=0";

    //Handling charges if any
    redirecturl += "&handling=0";

    //Tax amount if any
    redirecturl += "&tax=0";

    //Add quatity i added one only statically 
    redirecturl += "&quantity=1";

    //Currency code 
    redirecturl += "&currency=" + currency;

    //Success return page url
    redirecturl += "&return=" + ConfigurationManager.AppSettings["SuccessURL"].ToString();

    //Failed return page url
    redirecturl += "&cancel_return=" + ConfigurationManager.AppSettings["FailedURL"].ToString();

    Response.Redirect(redirecturl);
}

返回Url看..

對於Html變量, 請參閱

用於mvc整合paypal 看看

您可以使用源代碼下載NopCommerce2.8http://nopcommerce.codeplex.com/ 它實現了Paypal(所有方法)和許多支付網關。

http://www.superstarcoders.com/blogs/posts/paypal-with-asp-net-mvc.aspx

http://www.mindstick.com/Articles/41de052a-37e1-41db-aa4c-123313be444a/?How%20to%20integrate%20PayPal%20in%20A

http://blog.liamcavanagh.com/2012/06/how-to-use-paypal-with-asp-net-mvc/

看看“自定義”html變量......

我弄臟了......在“return”html變量中傳遞id ... / Event / RedirectFromPaypal?eventId = 26 ..

“幫助openSource ...... :)”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM